/* ====================================
   CHEMISTRY INTERACTIVE STYLES
   Gamified learning experience
   Mobile-first responsive design
   ==================================== */

:root {
    /* Chemistry Color Palette - Using theme variables */
    --chem-primary: var(--math-primary);
    --chem-secondary: var(--math-secondary);
    --chem-accent: var(--math-accent);
    --chem-light: var(--math-highlight);
    --chem-highlight: var(--math-card-alt);
    --chem-success: var(--math-success);
    --chem-warning: var(--math-warning);
    --chem-border: var(--math-border);
    --chem-text: var(--math-text);
    --chem-text-light: var(--math-text-light);
    --chem-card-bg: var(--math-card-bg);
    --chem-card-alt: var(--math-card-alt);
    
    /* Chemistry-specific Gradients */
    --gradient-lab: linear-gradient(135deg, var(--math-primary), var(--math-secondary));
    --gradient-beaker: linear-gradient(135deg, var(--math-success), var(--math-teal));
    --gradient-flame: linear-gradient(135deg, var(--math-warning), var(--math-accent));
    --gradient-crystal: linear-gradient(135deg, var(--math-purple), var(--math-info));
    --gradient-toxic: linear-gradient(135deg, var(--math-success), var(--math-teal));
    
    /* Glow Effects */
    --chem-neon-blue: 0 0 20px rgba(25, 118, 210, 0.5);
    --chem-neon-amber: 0 0 20px rgba(255, 152, 0, 0.5);
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-xxl: 3rem;
}

/* ===== CHEMISTRY GAME ZONE ===== */
.chem-game-zone {
    background: linear-gradient(145deg, var(--math-card-alt), var(--math-card-bg));
    border-radius: 40px;
    padding: 2.5rem;
    margin: 3rem 0;
    box-shadow: 0 30px 60px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--chem-border);
}

.chem-game-zone::before {
    content: "⚗️";
    position: absolute;
    top: -30px;
    right: -30px;
    font-size: 10rem;
    opacity: 0.05;
    transform: rotate(15deg);
    pointer-events: none;
}

.game-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.game-header h3 {
    color: var(--chem-text);
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.game-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    font-weight: 600;
}

.game-badge span {
    background: var(--chem-accent);
    padding: 0.2rem 0.8rem;
    border-radius: 30px;
    color: #1a2634;
    font-weight: 700;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
    color: var(--chem-text);
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    background: var(--chem-card-alt);
    padding: 1rem 2rem;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    min-width: 120px;
    border: 1px solid var(--chem-border);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--chem-accent);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ===== PERIODIC TABLE MEMORY GAME ===== */
.element-memory-game {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.element-card {
    aspect-ratio: 1;
    background: linear-gradient(145deg, var(--chem-secondary), var(--chem-primary));
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.2);
    text-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.element-card.flipped {
    background: var(--chem-card-bg);
    color: var(--chem-primary);
    transform: scale(0.98);
    box-shadow: var(--chem-neon-blue);
    border: 2px solid var(--chem-primary);
}

.element-card.matched {
    background: linear-gradient(145deg, var(--chem-success), var(--chem-teal));
    color: white;
    cursor: default;
    animation: pulse 0.5s ease;
    box-shadow: 0 0 30px rgba(46, 204, 113, 0.5);
}

.element-symbol {
    font-size: 2rem;
    font-weight: 800;
}

.element-name {
    font-size: 0.7rem;
    opacity: 0.9;
}

/* ===== CHEMICAL EQUATION BALANCING GAME ===== */
.balancing-game {
    background: linear-gradient(145deg, var(--math-card-alt), var(--math-card-bg));
    border-radius: 40px;
    padding: 2rem;
    margin: 2rem 0;
    color: var(--chem-text);
    border: 1px solid var(--chem-border);
}

.equation-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.reactant, .product {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--chem-card-alt);
    padding: 1rem 2rem;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    border: 1px solid var(--chem-border);
}

.arrow {
    font-size: 2.5rem;
    color: var(--chem-accent);
}

.coefficient-input {
    width: 60px;
    height: 60px;
    text-align: center;
    font-size: 1.8rem;
    border: 3px solid var(--chem-accent);
    border-radius: 15px;
    background: var(--chem-card-bg);
    color: var(--chem-text);
    font-weight: 700;
}

.coefficient-input:focus {
    outline: none;
    box-shadow: var(--chem-neon-amber);
}

/* ===== PH SCALE INTERACTIVE ===== */
.ph-scale-game {
    background: linear-gradient(145deg, var(--chem-success), var(--chem-teal));
    border-radius: 40px;
    padding: 2rem;
    margin: 2rem 0;
    color: white;
}

.ph-meter {
    height: 60px;
    background: linear-gradient(90deg, #e74c3c, #f39c12, #f1c40f, #3498db, #9b59b6);
    border-radius: 30px;
    margin: 2rem 0;
    position: relative;
}

.ph-indicator {
    width: 20px;
    height: 80px;
    background: white;
    border-radius: 10px;
    position: absolute;
    top: -10px;
    left: 0;
    transform: translateX(-50%);
    box-shadow: 0 0 20px rgba(255,255,255,0.5);
    cursor: grab;
    transition: left 0.3s ease;
}

.ph-value {
    text-align: center;
    font-size: 3rem;
    font-weight: 700;
    margin: 1rem 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.ph-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.ph-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.ph-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* ===== MOLECULE BUILDER ===== */
.molecule-builder {
    background: linear-gradient(145deg, var(--chem-purple), var(--math-purple));
    border-radius: 40px;
    padding: 2rem;
    margin: 2rem 0;
    color: white;
}

.atom-bank {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.atom {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: grab;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.atom-carbon { background: #34495e; }
.atom-hydrogen { background: #ecf0f1; color: #2c3e50; }
.atom-oxygen { background: #e74c3c; }
.atom-nitrogen { background: #3498db; }

.builder-canvas {
    background: rgba(255,255,255,0.1);
    border-radius: 30px;
    padding: 2rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    backdrop-filter: blur(5px);
    margin: 1rem 0;
}

.placed-atom {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    animation: placeAtom 0.3s ease;
}

@keyframes placeAtom {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ===== LAB SAFETY GAME ===== */
.safety-game {
    background: linear-gradient(145deg, var(--chem-warning), var(--chem-accent));
    border-radius: 40px;
    padding: 2rem;
    margin: 2rem 0;
    color: white;
}

.safety-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.safety-card {
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    backdrop-filter: blur(5px);
}

.safety-card:hover {
    transform: translateY(-5px);
    background: rgba(255,255,255,0.2);
}

.safety-card.correct {
    border-color: var(--chem-success);
    background: rgba(46, 204, 113, 0.2);
}

.safety-card.incorrect {
    border-color: var(--chem-warning);
    background: rgba(231, 76, 60, 0.2);
}

.safety-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ===== QUIZ CARDS ===== */
.quiz-showcase {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.quiz-card {
    background: var(--chem-card-bg);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--chem-border);
}

.quiz-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(13, 71, 161, 0.15);
}

.quiz-card-header {
    background: var(--gradient-lab);
    padding: 1.5rem;
    color: white;
    font-size: 1.5rem;
    text-align: center;
}

.quiz-card-content {
    padding: 1.5rem;
}

.quiz-card h4 {
    color: var(--chem-primary);
    margin-bottom: 0.5rem;
}

.quiz-meta {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.quiz-tag {
    background: var(--chem-light);
    color: var(--chem-primary);
    padding: 0.2rem 0.8rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ===== PERIODIC TABLE QUIZ ===== */
.periodic-quiz {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin: 2rem 0;
}

.element-quiz-card {
    background: var(--chem-card-bg);
    border: 2px solid var(--chem-border);
    border-radius: 12px;
    padding: 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--chem-text);
}

.element-quiz-card:hover {
    transform: scale(1.05);
    border-color: var(--chem-primary);
    box-shadow: var(--chem-neon-blue);
}

.element-quiz-card.selected {
    background: var(--chem-primary);
    color: white;
    border-color: var(--chem-primary);
}

/* ===== ACHIEVEMENT BADGES ===== */
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.achievement-badge {
    background: var(--chem-card-bg);
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    filter: grayscale(1);
    opacity: 0.5;
    border: 1px solid var(--chem-border);
}

.achievement-badge.unlocked {
    filter: grayscale(0);
    opacity: 1;
    border-color: var(--chem-accent);
    box-shadow: var(--chem-neon-amber);
    animation: unlockPulse 0.5s ease;
}

@keyframes unlockPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.badge-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.badge-title {
    font-weight: 600;
    color: var(--chem-primary);
    margin-bottom: 0.3rem;
}

.badge-desc {
    font-size: 0.8rem;
    color: var(--chem-text-light);
}

/* ===== ACTIVE QUIZ CONTAINER ===== */
.active-quiz-container {
    background: var(--chem-card-bg);
    border-radius: 24px;
    padding: 2rem;
    margin-top: 2rem;
    border: 2px solid var(--chem-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.quiz-progress {
    height: 8px;
    background: var(--chem-light);
    border-radius: 4px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.quiz-progress-bar {
    height: 100%;
    background: var(--gradient-lab);
    width: 0%;
    transition: width 0.3s ease;
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

/* ===== CHEMICAL REACTION SPEED GAME ===== */
.reaction-speed-game {
    background: linear-gradient(145deg, var(--chem-success), var(--chem-teal));
    border-radius: 40px;
    padding: 2rem;
    margin: 2rem 0;
    color: white;
    text-align: center;
}

.reaction-target {
    font-size: 3rem;
    font-weight: 700;
    margin: 2rem 0;
    padding: 2rem;
    background: rgba(255,255,255,0.1);
    border-radius: 30px;
    backdrop-filter: blur(5px);
    animation: pulse 2s infinite;
}

.reaction-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.reaction-btn {
    padding: 1.5rem;
    font-size: 1.2rem;
    border: none;
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 2px solid transparent;
}

.reaction-btn:hover {
    transform: translateY(-3px);
    background: rgba(255,255,255,0.3);
}

.reaction-btn.correct {
    border-color: white;
    background: rgba(255,255,255,0.4);
    animation: correctFlash 0.5s ease;
}

@keyframes correctFlash {
    0%, 100% { background: rgba(255,255,255,0.4); }
    50% { background: rgba(255,255,255,0.8); }
}

/* ===== PERIODIC TRENDS GAME ===== */
.trends-game {
    background: linear-gradient(145deg, var(--chem-secondary), var(--chem-primary));
    border-radius: 40px;
    padding: 2rem;
    margin: 2rem 0;
    color: white;
}

.trend-graph {
    height: 200px;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin: 2rem 0;
    padding: 1rem;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
}

.trend-bar {
    flex: 1;
    background: var(--chem-accent);
    border-radius: 10px 10px 0 0;
    transition: height 1s ease;
    position: relative;
    min-width: 30px;
}

.trend-bar::after {
    content: attr(data-label);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    white-space: nowrap;
    color: var(--chem-text);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .quiz-showcase,
    .achievement-grid,
    .safety-items,
    .reaction-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .periodic-quiz {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .quiz-showcase,
    .achievement-grid,
    .safety-items,
    .reaction-options,
    .periodic-quiz,
    .element-memory-game {
        grid-template-columns: 1fr;
    }
    
    .equation-container {
        font-size: 1.2rem;
    }
    
    .reactant, .product {
        padding: 0.8rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .coefficient-input {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .stat-item {
        width: 100%;
    }
    
    .atom-bank {
        gap: 0.5rem;
    }
    
    .atom {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
    
    .chem-game-zone {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .game-header h3 {
        font-size: 1.8rem;
    }
    
    .stat-item {
        padding: 0.8rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.float {
    animation: float 3s ease-in-out infinite;
}

.spin {
    animation: spin 4s linear infinite;
}

/* ===== LUCIDE ICON STYLING ===== */
.chem-note-icon i,
.concept-icon i,
.game-badge i,
.stat-item i,
.quiz-card-header i,
.achievement-badge i,
.safety-icon i,
.reaction-btn i {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.safety-icon i {
    width: 40px;
    height: 40px;
}

.quiz-card-header i {
    width: 32px;
    height: 32px;
    margin-right: 0.5rem;
}

.achievement-badge i {
    width: 48px;
    height: 48px;
    margin-bottom: 0.5rem;
    color: var(--chem-primary);
}

/* ===== CHEMISTRY NOTE BOX ===== */
.chem-note-box {
    background: var(--chem-card-alt);
    border-left: 4px solid var(--chem-accent);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border: 1px solid var(--chem-border);
}

.chem-note-icon {
    width: 40px;
    height: 40px;
    background: var(--chem-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.chem-note-content {
    color: var(--chem-text);
    line-height: 1.6;
    flex: 1;
}

/* ===== CHEMISTRY SECTION ===== */
.chem-section {
    margin-bottom: 3rem;
}

.chem-section h2 {
    color: var(--chem-primary);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    border-bottom: 2px solid var(--chem-border);
    padding-bottom: 0.5rem;
}

.chem-section h3 {
    color: var(--chem-secondary);
    margin: 1.5rem 0 1rem;
    font-size: 1.4rem;
}

/* ===== CHEMISTRY BUTTONS ===== */
.chem-btn {
    background: var(--gradient-lab);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.2);
}

.chem-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--chem-neon-blue);
}

.chem-btn:active {
    transform: translateY(0);
}

.chem-btn i {
    width: 18px;
    height: 18px;
}

/* ===== CHEMISTRY TERMS CLOUD ===== */
.chem-terms-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.chem-term-tag {
    background: var(--chem-card-alt);
    color: var(--chem-text);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.9rem;
    border: 1px solid var(--chem-border);
    transition: all 0.2s ease;
}

.chem-term-tag:hover {
    background: var(--chem-primary);
    color: white;
    transform: translateY(-2px);
}

/* ===== CHEMISTRY QUESTION CARD ===== */
.chem-question-card {
    background: var(--chem-card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--chem-border);
}

.chem-question-text {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--chem-text);
}

.chem-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chem-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chem-option:hover {
    background: var(--chem-light);
}

.chem-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ===== CHEMISTRY FEEDBACK ===== */
.chem-feedback {
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    display: none;
}

.chem-feedback.success {
    background: var(--chem-success);
    color: white;
    display: block;
}

.chem-feedback.error {
    background: var(--chem-warning);
    color: white;
    display: block;
}

/* ===== CHEMISTRY SUMMARY ===== */
.chem-summary {
    background: var(--chem-card-alt);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid var(--chem-border);
}

.summary-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
}

.summary-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--chem-text);
    border-bottom: 1px solid var(--chem-border);
}

.summary-list li:last-child {
    border-bottom: none;
}

.summary-list li::before {
    content: "•";
    color: var(--chem-accent);
    font-weight: bold;
    position: absolute;
    left: 0;
    font-size: 1.2rem;
}