/* CSS Variables for consistent theming */
:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-content h1 {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header-content .subtitle {
    color: #e2e8f0;
    font-size: 1.1rem;
    font-weight: 400;
}

.header-content i {
    margin-right: 0.5rem;
    color: var(--accent-color);
}

/* Main Content */
.main-content {
    display: grid;
    gap: 2rem;
}

/* Theory Section */
.theory-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.theory-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theory-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.theory-card {
    background: linear-gradient(135deg, #f0f4ff 0%, #e0edff 100%);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.theory-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.theory-card h3 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.theory-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.formula {
    background: var(--card-bg);
    padding: 0.8rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--danger-color);
    text-align: center;
    border: 2px solid var(--border);
}

/* Laboratory Section */
.laboratory-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.laboratory-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Experiment Controls */
.experiment-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: var(--border-radius);
    border: 2px dashed var(--border);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 500;
    color: var(--text-primary);
}

.control-group select {
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background: white;
}

.control-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.experiment-btn, .reset-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.experiment-btn {
    background: var(--success-color);
    color: white;
}

.experiment-btn:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-2px);
}

.experiment-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

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

.reset-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* Laboratory Apparatus */
.lab-apparatus {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(to bottom, #e0f2fe 0%, #b3e5fc 100%);
    border-radius: var(--border-radius);
    min-height: 300px;
}

/* Test Tube */
.test-tube-container {
    text-align: center;
}

.test-tube {
    width: 60px;
    height: 200px;
    background: linear-gradient(to bottom, transparent 0%, rgba(173, 216, 230, 0.3) 100%);
    border: 3px solid #4a90e2;
    border-radius: 0 0 30px 30px;
    position: relative;
    margin: 0 auto 1rem;
    overflow: hidden;
}

.solution {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0;
    background: #87ceeb;
    transition: height 1s ease-in-out;
    border-radius: 0 0 26px 26px;
}

.metal-sample {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 10px;
    background: #c0c0c0;
    border-radius: 2px;
    opacity: 0;
    transition: var(--transition);
}

.bubbles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.bubble {
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: bubble-rise 2s infinite linear;
}

@keyframes bubble-rise {
    0% {
        bottom: 0;
        opacity: 1;
        transform: translateX(-50%);
    }
    100% {
        bottom: 100%;
        opacity: 0;
        transform: translateX(-50%) scale(1.5);
    }
}

.tube-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Bunsen Burner */
.burner-container {
    text-align: center;
}

.bunsen-burner {
    width: 80px;
    height: 120px;
    background: linear-gradient(to bottom, #666 0%, #333 100%);
    margin: 0 auto 1rem;
    position: relative;
    border-radius: 0 0 8px 8px;
}

.bunsen-burner::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 20px;
    background: #444;
    border-radius: 50% 50% 0 0;
}

.flame {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 60px;
    background: linear-gradient(to top, #ff4500 0%, #ffa500 50%, #ffff00 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    opacity: 0;
    transition: var(--transition);
    animation: flicker 0.5s infinite alternate;
}

@keyframes flicker {
    0% { transform: translateX(-50%) scale(1) rotate(-2deg); }
    100% { transform: translateX(-50%) scale(1.1) rotate(2deg); }
}

.burner-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Results Panel */
.results-panel {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    padding: 2rem;
    border-radius: var(--border-radius);
    border: 2px solid var(--success-color);
    margin-top: 2rem;
}

.results-panel h3 {
    color: var(--success-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.equation-result {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
    text-align: center;
    border: 2px solid var(--success-color);
}

.observation-result {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.gas-evolution {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--warning-color);
    font-weight: 600;
    background: #fef3c7;
    padding: 0.8rem;
    border-radius: 8px;
    border: 2px solid var(--warning-color);
}

/* Activity Section */
.activity-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.activity-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.activity-series {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--border-radius);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.activity-item {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.2rem;
    color: white;
    transition: var(--transition);
    cursor: pointer;
}

.activity-item.high {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.activity-item.medium {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.activity-item.low {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.activity-item:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.activity-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.legend-color.high {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.legend-color.medium {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.legend-color.low {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* Quiz Section */
.quiz-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.quiz-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.question {
    margin-bottom: 2rem;
}

.question h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.quiz-options {
    display: grid;
    gap: 0.5rem;
}

.quiz-option {
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-size: 1rem;
}

.quiz-option:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

.quiz-option.correct {
    background: #dcfce7;
    border-color: var(--success-color);
    color: var(--success-color);
}

.quiz-option.wrong {
    background: #fef2f2;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.quiz-result {
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    margin-top: 1rem;
}

.quiz-result.correct {
    background: #dcfce7;
    color: var(--success-color);
    border: 2px solid var(--success-color);
}

.quiz-result.wrong {
    background: #fef2f2;
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .experiment-controls {
        grid-template-columns: 1fr;
    }
    
    .lab-apparatus {
        flex-direction: column;
        gap: 2rem;
        align-items: center;
    }
    
    .activity-series {
        justify-content: center;
    }
    
    .activity-legend {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .theory-cards {
        grid-template-columns: 1fr;
    }
    
    .activity-series {
        gap: 0.3rem;
    }
    
    .activity-item {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
}

/* Animation Classes */
.animate-in {
    animation: slideIn 0.5s ease-out forwards;
}

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

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.glow {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.5);
}

/* Reaction Animation Classes */
.react-water {
    background: #4fc3f7 !important;
}

.react-oxygen {
    background: #ffab91 !important;
}

.react-acid {
    background: #a5d6a7 !important;
}

.metal-dissolving {
    animation: dissolve 2s ease-in-out;
}

@keyframes dissolve {
    0% { opacity: 1; }
    100% { opacity: 0.3; }
}

.heating {
    filter: brightness(1.5) saturate(1.5);
}