/* ========================================
   ISOMÉRISATION FLASHCARD APP - STYLES
   ======================================== */

/* CSS Variables */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-light: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Isomer type colors */
    --color-enantiomerie: #8b5cf6;
    --color-tautomerie: #06b6d4;
    --color-epimerie: #f59e0b;
    --color-diastereoisomerie: #ef4444;
    --color-anomerie: #22c55e;
    
    /* Molecule colors */
    --mol-carbon: #374151;
    --mol-oxygen: #ef4444;
    --mol-nitrogen: #3b82f6;
    --mol-hydrogen: #9ca3af;
    --mol-highlight: #fbbf24;
    --mol-chiral: #f59e0b;
    
    --card-width: 600px;
    --card-height: 450px;
    --border-radius: 20px;
    --transition: 0.3s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* App Container */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.app-header {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 20px;
}

.app-header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Category Navigation */
.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 25px;
}

.cat-btn {
    background: var(--bg-card);
    border: 2px solid transparent;
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cat-btn:hover {
    background: var(--bg-card-light);
    color: var(--text-primary);
}

.cat-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.cat-btn[data-category="enantiomerie"].active { background: var(--color-enantiomerie); border-color: var(--color-enantiomerie); }
.cat-btn[data-category="tautomerie"].active { background: var(--color-tautomerie); border-color: var(--color-tautomerie); }
.cat-btn[data-category="epimerie"].active { background: var(--color-epimerie); border-color: var(--color-epimerie); }
.cat-btn[data-category="diastereoisomerie"].active { background: var(--color-diastereoisomerie); border-color: var(--color-diastereoisomerie); }
.cat-btn[data-category="anomerie"].active { background: var(--color-anomerie); border-color: var(--color-anomerie); }

.cat-icon {
    font-size: 1.1rem;
}

/* Progress Bar */
.progress-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 0 10px;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    min-width: 60px;
    text-align: right;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
}

.mode-btn {
    background: var(--bg-card);
    border: 2px solid var(--bg-card-light);
    color: var(--text-secondary);
    padding: 10px 25px;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.mode-btn:hover {
    border-color: var(--primary);
}

.mode-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Flashcard Area */
.flashcard-area {
    perspective: 1500px;
    margin-bottom: 25px;
}

.flashcard-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Flashcard */
.flashcard {
    width: var(--card-width);
    height: var(--card-height);
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius);
    padding: 30px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.card-front {
    background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-card-light) 100%);
    border: 2px solid var(--bg-card-light);
}

.card-back {
    background: linear-gradient(145deg, var(--bg-card-light) 0%, var(--bg-card) 100%);
    border: 2px solid var(--primary);
    transform: rotateY(180deg);
    overflow-y: auto;
}

/* Card Content */
.card-category {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    align-self: flex-start;
}

.card-category.enantiomerie { background: var(--color-enantiomerie); }
.card-category.tautomerie { background: var(--color-tautomerie); }
.card-category.epimerie { background: var(--color-epimerie); }
.card-category.diastereoisomerie { background: var(--color-diastereoisomerie); }
.card-category.anomerie { background: var(--color-anomerie); }

.card-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.card-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    overflow: hidden;
}

.card-visual svg {
    max-width: 100%;
    max-height: 100%;
}

.card-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Card Back Content */
.card-definition {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--bg-card-light);
}

.card-details {
    margin-bottom: 15px;
}

.card-details ul {
    list-style: none;
    padding: 0;
}

.card-details li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: var(--text-secondary);
}

.card-details li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
}

.card-details .highlight {
    color: var(--warning);
    font-weight: 600;
    text-decoration: underline;
}

.card-example {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary);
    padding: 12px 15px;
    border-radius: 0 10px 10px 0;
    margin-bottom: 15px;
}

.card-example h4 {
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 5px;
}

.card-example p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.card-mnemonic {
    background: linear-gradient(90deg, rgba(236, 72, 153, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
    padding: 12px 15px;
    border-radius: 10px;
    margin-top: auto;
}

.card-mnemonic h4 {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-bottom: 5px;
}

.card-mnemonic p {
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* Quiz Overlay */
.quiz-overlay {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--card-width);
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--primary);
    z-index: 10;
}

.quiz-question {
    font-size: 1.3rem;
    margin-bottom: 25px;
    text-align: center;
    color: var(--text-primary);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-option {
    background: var(--bg-card-light);
    border: 2px solid transparent;
    color: var(--text-primary);
    padding: 15px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    text-align: left;
}

.quiz-option:hover {
    border-color: var(--primary);
    transform: translateX(5px);
}

.quiz-option.correct {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--success);
}

.quiz-option.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

.quiz-feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    display: none;
}

.quiz-feedback.show {
    display: block;
}

.quiz-feedback.correct {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.quiz-feedback.incorrect {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Navigation Controls */
.nav-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.nav-btn {
    background: var(--bg-card);
    border: 2px solid var(--bg-card-light);
    color: var(--text-primary);
    padding: 12px 25px;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.nav-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.shuffle-btn {
    background: var(--bg-card-light);
}

/* Assessment Buttons */
.assessment-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.assess-btn {
    padding: 15px 35px;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.assess-btn.review {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: white;
}

.assess-btn.review:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(245, 158, 11, 0.3);
}

.assess-btn.got-it {
    background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
    color: white;
}

.assess-btn.got-it:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(34, 197, 94, 0.3);
}

/* Stats Panel */
.stats-panel {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 15px;
    margin-bottom: 25px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat:first-child .stat-value { color: var(--success); }
.stat:nth-child(2) .stat-value { color: var(--warning); }

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Legend Panel */
.legend-panel {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
}

.legend-panel h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.legend-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.legend-list li {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 5px 0;
}

.legend-list li strong {
    color: var(--primary);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid var(--bg-card-light);
}

.app-footer p {
    color: var(--text-muted);
    margin-bottom: 15px;
}

.reset-btn {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.reset-btn:hover {
    background: var(--danger);
    color: white;
}

/* ========================================
   SVG MOLECULE STYLES
   ======================================== */

/* Atom styling */
.atom {
    font-family: 'Segoe UI', sans-serif;
    font-weight: bold;
}

.atom-C { fill: var(--mol-carbon); }
.atom-O { fill: var(--mol-oxygen); }
.atom-N { fill: var(--mol-nitrogen); }
.atom-H { fill: var(--mol-hydrogen); }

.bond {
    stroke: var(--text-secondary);
    stroke-width: 2;
    fill: none;
}

.bond-double {
    stroke-width: 2;
}

.chiral-center {
    fill: var(--mol-chiral);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { filter: drop-shadow(0 0 5px var(--mol-chiral)); }
    50% { filter: drop-shadow(0 0 15px var(--mol-chiral)); }
}

.mirror-line {
    stroke: var(--text-muted);
    stroke-width: 2;
    stroke-dasharray: 8, 4;
}

.highlight-circle {
    fill: none;
    stroke: var(--warning);
    stroke-width: 3;
    stroke-dasharray: 5, 3;
    animation: rotate 10s linear infinite;
}

@keyframes rotate {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: 100; }
}

.arrow {
    fill: var(--primary);
}

.equilibrium-arrow {
    stroke: var(--text-secondary);
    stroke-width: 2;
    fill: none;
}

/* Molecule labels */
.mol-label {
    font-size: 14px;
    fill: var(--text-primary);
    font-weight: 600;
}

.mol-sublabel {
    font-size: 12px;
    fill: var(--text-secondary);
}

.config-label {
    font-size: 16px;
    font-weight: bold;
}

.config-L { fill: var(--color-enantiomerie); }
.config-D { fill: var(--secondary); }
.config-alpha { fill: var(--success); }
.config-beta { fill: var(--danger); }

/* Sugar ring styles */
.sugar-ring {
    stroke: var(--text-secondary);
    stroke-width: 2;
    fill: rgba(255, 255, 255, 0.05);
}

.anomeric-carbon {
    fill: var(--color-anomerie);
}

.oh-up {
    fill: var(--success);
}

.oh-down {
    fill: var(--danger);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    :root {
        --card-width: 100%;
        --card-height: 500px;
    }
    
    .app-header h1 {
        font-size: 1.8rem;
    }
    
    .category-nav {
        gap: 8px;
    }
    
    .cat-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .cat-icon {
        display: none;
    }
    
    .card-face {
        padding: 20px;
    }
    
    .card-title {
        font-size: 1.4rem;
    }
    
    .stats-panel {
        gap: 20px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .legend-list {
        grid-template-columns: 1fr;
    }
    
    .nav-controls {
        flex-wrap: wrap;
    }
    
    .nav-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .assessment-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .assess-btn {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 10px;
    }
    
    .flashcard {
        height: 450px;
    }
    
    .card-visual {
        min-height: 150px;
    }
}

/* ========================================
   ANIMATIONS & EFFECTS
   ======================================== */

/* Card entrance animation */
.flashcard {
    animation: cardEntrance 0.5s ease-out;
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Button press effect */
.nav-btn:active,
.cat-btn:active,
.assess-btn:active {
    transform: scale(0.95);
}

/* Correct/Wrong shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Success bounce animation */
@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.bounce {
    animation: bounce 0.3s ease-in-out;
}

/* Tooltip styles */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-dark);
    color: var(--text-primary);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

[data-tooltip]:hover::after {
    opacity: 1;
}
