/*
 * Learning Modules CSS Framework
 * Comprehensive styling system for interactive educational content
 * Based on the ABG learning module design patterns
 * 
 * Usage: Include this CSS file in any learning module HTML page
 * for consistent styling and responsive design
 */

/* ==================== CSS VARIABLES ==================== */
:root {
    /* Primary Brand Colors */
    --primary-color: #03629c;
    --primary-light: #038ADD;
    --primary-dark: #024B78;
    
    /* Status Colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    /* Neutral Colors */
    --neutral-100: #f5f5f5;
    --neutral-200: #e5e5e5;
    --neutral-300: #d4d4d4;
    --neutral-600: #525252;
    --neutral-800: #262626;
    --neutral-900: #171717;
    
    /* Semantic Colors for Medical Content */
    --acidosis-color: #ef4444;
    --alkalosis-color: #7c3aed;
    --respiratory-color: #3b82f6;
    --metabolic-color: #10b981;
    --compensated-color: #059669;
    
    /* Layout Variables */
    --container-max-width: 1200px;
    --border-radius-small: 8px;
    --border-radius-medium: 12px;
    --border-radius-large: 16px;
    --border-radius-xl: 20px;
    
    /* Shadow Variables */
    --shadow-small: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-large: 0 8px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 10px 30px rgba(3, 98, 156, 0.3);
    
    /* Animation Variables */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Mobile-specific Variables */
    --swipe-indicator-opacity: 0;
}

/* ==================== RESET & BASE STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--neutral-800);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* ==================== LAYOUT COMPONENTS ==================== */

/* Main Container */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    overflow-x: hidden;
}

/* Header Section */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: var(--border-radius-xl);
    color: white;
    box-shadow: var(--shadow-xl);
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 12px;
    font-weight: 700;
    color: white !important;
    text-shadow: none;
}

.header p {
    font-size: 1rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
    color: white !important;
    line-height: 1.5;
}

/* ==================== LEARNING MODULE FRAMEWORK ==================== */

/* Main Learning Module Container */
.learning-module {
    background: white;
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-large);
    border: 2px solid var(--neutral-200);
    overflow: hidden;
    margin-bottom: 30px;
    width: 100%;
    max-width: 100%;
}

/* Tab System */
.tab-container {
    display: flex;
    background: var(--neutral-100);
    border-bottom: 2px solid var(--neutral-200);
    position: relative;
    --swipe-indicator-opacity: 0;
    align-items: stretch;
}

.tab-container::after {
    content: "← Swipe →";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: var(--border-radius-medium);
    font-size: 0.7rem;
    font-weight: 600;
    pointer-events: none;
    opacity: var(--swipe-indicator-opacity);
    transition: opacity var(--transition-normal);
    z-index: 10;
}

.tab {
    flex: 1;
    padding: 15px 20px;
    text-align: center;
    background: var(--neutral-100);
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--neutral-600);
    transition: all var(--transition-normal);
    border-right: 1px solid var(--neutral-200);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
}

.tab:last-child {
    border-right: none;
}

.tab.active {
    background: white;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: -2px;
}

.tab:hover:not(.active) {
    background: var(--neutral-200);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 25px;
}

.tab-content.active {
    display: block;
}

/* ==================== INTERACTIVE COMPONENTS ==================== */

/* Simulator Framework */
.simulator-container {
    background: white;
    border-radius: var(--border-radius-large);
    padding: 25px;
    box-shadow: var(--shadow-large);
    border: 2px solid var(--neutral-200);
    max-width: 800px;
    margin: 0 auto;
}

.simulator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.simulator-left {
    border-right: 2px solid var(--neutral-200);
    padding-right: 25px;
}

/* Parameter Controls */
.parameter-group {
    margin-bottom: 25px;
}

.parameter-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 1.1rem;
}

.parameter-value {
    font-size: 1.2rem;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: var(--border-radius-small);
    min-width: 80px;
    text-align: center;
}

/* Sliders */
.slider-container {
    position: relative;
    margin: 10px 0;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--neutral-200);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.normal-range {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--neutral-600);
    margin-top: 5px;
}

/* ==================== CONTENT SECTIONS ==================== */

/* Interpretation Panel */
.interpretation {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: var(--border-radius-medium);
    padding: 20px;
    border-left: 5px solid var(--primary-color);
}

.interpretation h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Diagnosis Cards */
.diagnosis-card {
    background: white;
    border-radius: var(--border-radius-small);
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-small);
}

.diagnosis-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.diagnosis-details {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 10px;
}

/* Status Indicators */
.compensation-status {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
}

.status-normal {
    background: #dcfce7;
    color: #166534;
}

.status-acidosis {
    background: #fef2f2;
    color: #991b1b;
}

.status-alkalosis {
    background: #fefce8;
    color: #a16207;
}

/* ==================== TEACHING COMPONENTS ==================== */

/* Teaching Sections */
.teaching-section {
    background: white;
    border-radius: var(--border-radius-large);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-large);
    border: 2px solid var(--neutral-200);
}

.teaching-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

/* Steps Grid */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.step-card {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: var(--border-radius-medium);
    padding: 20px;
    border-left: 4px solid var(--primary-color);
}

.step-number {
    background: var(--primary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 10px;
}

.step-title {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

/* ==================== TUTORIAL SYSTEM ==================== */

/* Tutorial Progress */
.tutorial-progress {
    background: var(--neutral-200);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 30px;
    text-align: center;
}

.progress-bar {
    background: var(--neutral-300);
    border-radius: 20px;
    height: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    height: 100%;
    width: 12.5%;
    transition: width var(--transition-normal);
}

.progress-text {
    font-weight: 600;
    color: var(--primary-color);
}

/* Tutorial Lessons */
.tutorial-container {
    position: relative;
    min-height: 600px;
}

.tutorial-lesson {
    display: none;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius-medium);
    box-shadow: var(--shadow-medium);
}

.tutorial-lesson.active {
    display: block;
    animation: slideIn var(--transition-normal);
}

.tutorial-lesson h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.4rem;
}

/* Tutorial Navigation */
.tutorial-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--neutral-100);
    border-radius: var(--border-radius-medium);
    margin-top: 30px;
}

.tutorial-navigation button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    font-weight: 600;
    transition: background var(--transition-normal);
}

.tutorial-navigation button:disabled {
    background: var(--neutral-300);
    cursor: not-allowed;
}

.tutorial-navigation button:not(:disabled):hover {
    background: var(--primary-dark);
}

/* ==================== EDUCATIONAL ELEMENTS ==================== */

/* Concept Boxes */
.concept-box {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 2px solid var(--primary-light);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.concept-box h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* Highlight Text */
.highlight {
    background: #fef3c7;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Interactive Demos */
.interactive-demo {
    background: #f8fafc;
    border: 2px dashed var(--neutral-300);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

/* Clinical Insights */
.clinical-insight {
    background: linear-gradient(135deg, #fef7ff, #fae8ff);
    border-left: 4px solid #a855f7;
    padding: 20px;
    margin: 20px 0;
    border-radius: var(--border-radius-small);
}

.clinical-insight h4 {
    color: #7c3aed;
    margin-bottom: 10px;
}

/* Memory Aids */
.memory-aid {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 2px solid var(--warning-color);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.memory-aid h4 {
    color: #92400e;
    margin-bottom: 15px;
}

/* Learning Tips */
.learning-tip {
    background: linear-gradient(135deg, #fef7cd, #fef3c7);
    border: 1px solid #f59e0b;
    border-radius: var(--border-radius-small);
    padding: 15px;
    margin-top: 15px;
}

.learning-tip ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.learning-tip li {
    margin: 5px 0;
}

/* ==================== SCENARIO SYSTEM ==================== */

/* Scenarios Section */
.scenarios-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.scenario-card {
    background: white;
    border: 2px solid var(--neutral-200);
    border-radius: var(--border-radius-large);
    padding: 25px;
    box-shadow: var(--shadow-medium);
    transition: all var(--transition-normal);
    cursor: pointer;
    position: relative;
}

.scenario-card.interactive:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-large);
    border-color: var(--primary-color);
}

.scenario-card.interactive:active {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.scenario-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.scenario-description {
    margin-bottom: 15px;
}

.scenario-description strong {
    color: #1f2937;
    font-size: 1.1rem;
}

.scenario-context {
    color: #6b7280;
    font-style: italic;
    display: block;
    margin-top: 8px;
}

.scenario-button {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    margin-top: 15px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-normal);
    opacity: 0.8;
}

.scenario-card.interactive:hover .scenario-button {
    opacity: 1;
    transform: scale(1.05);
}

.scenario-values {
    background: var(--neutral-100);
    border-radius: var(--border-radius-small);
    padding: 15px;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

/* ==================== PRACTICE MODES ==================== */

/* Practice Mode */
.practice-mode {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 2px solid var(--success-color);
    border-radius: var(--border-radius-medium);
    padding: 20px;
    margin-top: 20px;
}

.practice-mode h3 {
    color: var(--success-color);
    margin-bottom: 15px;
}

.practice-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.practice-buttons .button {
    flex: 1;
    min-width: 150px;
}

/* ==================== BUTTONS ==================== */

/* Primary Button */
.button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius-small);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 1rem;
}

.button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Reveal Button */
.reveal-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin: 10px 0;
    transition: background var(--transition-normal);
}

.reveal-btn:hover {
    background: var(--primary-dark);
}

/* Example Buttons */
.example-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition-normal);
    text-align: left;
    box-shadow: 0 4px 12px rgba(0, 130, 246, 0.3);
}

.example-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 130, 246, 0.4);
}

.example-btn small {
    display: block;
    margin-top: 5px;
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Answer Choice Buttons */
.answer-choices {
    margin: 15px 0;
}

.answer-choices button {
    display: block;
    width: 100%;
    background: var(--neutral-100);
    border: 2px solid var(--neutral-200);
    padding: 15px;
    margin: 10px 0;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-normal);
}

.answer-choices button:hover {
    background: var(--primary-light);
    color: white;
}

.answer-choices button.correct {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.answer-choices button.incorrect {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

/* ==================== TABLES ==================== */

/* Reference Tables */
.reference-table {
    background: white;
    border-radius: var(--border-radius-medium);
    overflow: hidden;
    margin-top: 30px;
    box-shadow: var(--shadow-medium);
}

.reference-table table {
    width: 100%;
    border-collapse: collapse;
}

.reference-table th {
    background: var(--primary-color);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.reference-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--neutral-200);
}

.reference-table tr:nth-child(even) {
    background: var(--neutral-100);
}

/* ==================== ADVANCED TOOLS ==================== */

/* Advanced Tools Grid */
.advanced-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    margin: 20px 0;
}

.tool-card {
    background: white;
    border: 2px solid var(--neutral-200);
    border-radius: var(--border-radius-large);
    padding: 25px;
    box-shadow: var(--shadow-medium);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.tool-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

/* Calculator Inputs */
.calculator-inputs {
    margin: 20px 0;
}

.input-group {
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group label {
    font-weight: 600;
    min-width: 120px;
    color: var(--neutral-800);
}

.input-group input, .input-group select {
    padding: 10px;
    border: 2px solid var(--neutral-200);
    border-radius: var(--border-radius-small);
    font-size: 1rem;
    flex: 1;
    max-width: 120px;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(3, 98, 156, 0.1);
}

/* Calculator Buttons */
.calc-button {
    all: initial;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 15px 0;
    transition: transform var(--transition-fast);
    display: inline-block;
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
}

.calc-button:hover {
    transform: translateY(-2px);
}

/* Calculator Results */
.calc-result {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 2px solid var(--primary-light);
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
    min-height: 60px;
    font-weight: 600;
}

/* ==================== ALERTS & WARNINGS ==================== */

/* Warning Messages */
.constraint-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 12px 16px;
    border-radius: var(--border-radius-small);
    margin-top: 15px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
    transform: translateY(-20px);
    opacity: 0;
    transition: all var(--transition-normal);
    display: none;
}

.constraint-warning.show {
    transform: translateY(0);
    opacity: 1;
    display: block;
}

/* Critical Alerts */
.critical-card {
    padding: 20px;
    border-radius: var(--border-radius-medium);
    margin: 15px 0;
    box-shadow: var(--shadow-medium);
}

.critical-card.emergency {
    background: linear-gradient(135deg, #fef2f2, #fecaca);
    border: 3px solid var(--error-color);
}

.critical-card.warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 3px solid var(--warning-color);
}

/* Answers and Explanations */
.answer {
    background: white;
    border: 2px solid var(--success-color);
    border-radius: var(--border-radius-small);
    padding: 15px;
    margin: 10px 0;
}

.answer.hidden {
    display: none;
}

.explanation {
    background: #f0f9ff;
    border: 2px solid var(--success-color);
    border-radius: var(--border-radius-small);
    padding: 15px;
    margin: 15px 0;
}

/* ==================== SEMANTIC MEDICAL CLASSES ==================== */

/* Medical Condition Classes */
.acidosis { color: var(--acidosis-color); font-weight: bold; }
.alkalosis { color: var(--alkalosis-color); font-weight: bold; }
.respiratory { color: var(--respiratory-color); font-weight: bold; }
.metabolic { color: var(--metabolic-color); font-weight: bold; }
.compensated { color: var(--compensated-color); font-weight: bold; }

/* Value Status Classes */
.low-ph, .low-co2, .low-hco3 { color: #dc2626; }
.high-ph, .high-co2, .high-hco3 { color: #7c3aed; }
.normal-hco3 { color: #059669; }

/* ==================== TOOLTIPS ==================== */

.tooltip {
    position: relative;
    cursor: help;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--neutral-900);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
}

/* ==================== MOBILE RESPONSIVE DESIGN ==================== */

/* Responsive Text Buttons */
.button-text-mobile {
    display: none;
}

.button-text-desktop {
    display: inline;
}

/* Tablet Styles (768px and below) */
@media (max-width: 768px) {
    /* Container adjustments */
    .container {
        padding: 0 15px;
    }
    
    /* Header adjustments */
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header p {
        font-size: 0.9rem;
    }
    
    /* Learning module adjustments */
    .learning-module {
        margin: 0 -10px;
    }
    
    /* Tab system adjustments */
    .tab-container {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        --swipe-indicator-opacity: 1;
        padding: 0;
        white-space: nowrap;
    }

    .tab-container::after {
        opacity: var(--swipe-indicator-opacity);
        right: 5px;
        padding: 3px 6px;
        font-size: 0.65rem;
    }

    .tab-container::-webkit-scrollbar {
        display: none;
    }

    .tab {
        flex: none;
        display: inline-block;
        min-width: 110px;
        max-width: 130px;
        padding: 12px 6px;
        font-size: 0.75rem;
        white-space: nowrap;
        border-right: 1px solid var(--neutral-200);
        text-align: center;
        vertical-align: top;
    }

    .tab:first-child {
        margin-left: 0;
    }

    .tab:last-child {
        border-right: 1px solid var(--neutral-200);
        margin-right: 40px;
    }

    .tab-content {
        padding: 15px;
    }
    
    /* Simulator adjustments */
    .simulator-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .simulator-left {
        border-right: none;
        border-bottom: 2px solid var(--neutral-200);
        padding-right: 0;
        padding-bottom: 20px;
    }
    
    /* Parameter adjustments */
    .parameter-group {
        margin-bottom: 20px;
    }

    .parameter-label {
        font-size: 1rem;
    }

    .parameter-value {
        font-size: 1.1rem;
        padding: 6px 10px;
        min-width: 70px;
    }

    .normal-range {
        font-size: 0.8rem;
    }
    
    /* Scenarios adjustments */
    .scenarios-section {
        grid-template-columns: 1fr;
    }
    
    /* Practice mode adjustments */
    .practice-mode {
        padding: 15px;
        margin-top: 15px;
    }

    .practice-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .practice-buttons .button {
        width: 100%;
        min-width: auto;
        margin: 0;
        padding: 12px 8px;
        font-size: 0.85rem;
    }

    .button-text-mobile {
        display: inline;
    }

    .button-text-desktop {
        display: none;
    }

    .button {
        padding: 10px 15px;
        font-size: 0.9rem;
        margin: 5px 0;
        display: block;
        width: 100%;
    }
    
    /* Advanced tools adjustments */
    .advanced-tools-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .tool-card {
        padding: 15px;
        margin: 0;
    }
    
    .calc-button {
        padding: 10px 20px;
        font-size: 13px;
        margin: 12px 0;
        max-width: calc(100vw - 60px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .calculator-inputs {
        padding: 0 5px;
    }
    
    .input-group {
        margin: 8px 0;
    }
    
    .input-group input,
    .input-group select {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Reference table adjustments */
    .reference-table {
        font-size: 0.9rem;
        overflow-x: auto;
    }

    .reference-table table {
        min-width: 100%;
    }

    .reference-table th,
    .reference-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}

/* Mobile Styles (480px and below) */
@media (max-width: 480px) {
    /* Container adjustments */
    .container {
        padding: 0 10px;
    }
    
    /* Header adjustments */
    .header h1 {
        font-size: 1.3rem;
    }
    
    /* Tab adjustments */
    .tab {
        min-width: 95px;
        max-width: 110px;
        font-size: 0.7rem;
        padding: 10px 4px;
        line-height: 1.2;
    }

    .tab:last-child {
        margin-right: 35px;
    }

    .tab-container::after {
        right: 3px;
        padding: 2px 4px;
        font-size: 0.6rem;
    }

    .tab-content {
        padding: 10px;
    }
    
    /* Parameter adjustments */
    .parameter-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .parameter-value {
        align-self: flex-end;
    }

    .slider-container {
        margin: 15px 0;
    }

    .normal-range {
        font-size: 0.7rem;
        margin-top: 5px;
    }
    
    /* Interpretation adjustments */
    .interpretation h2 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }

    .diagnosis-title {
        font-size: 1rem;
    }

    .diagnosis-details {
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    /* Advanced tools adjustments */
    .tool-card {
        padding: 12px;
        margin: 0 5px;
    }
    
    .calc-button {
        padding: 8px 16px;
        font-size: 12px;
        margin: 10px 0;
        max-width: calc(100vw - 40px);
        border-radius: 6px;
    }
    
    .calculator-inputs {
        padding: 0 2px;
    }
    
    .input-group {
        margin: 6px 0;
    }
    
    .input-group label {
        font-size: 13px;
        display: block;
        margin-bottom: 4px;
    }
    
    .input-group input,
    .input-group select {
        font-size: 14px;
        padding: 6px 8px;
    }
}

/* ==================== ANIMATIONS ==================== */

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== DISCLAIMER ==================== */

.disclaimer {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 2px solid #f59e0b;
    border-radius: var(--border-radius-medium);
    padding: 20px;
    margin: 30px auto;
    max-width: var(--container-max-width);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

/* ==================== UTILITY CLASSES ==================== */

/* Spacing utilities */
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

/* Text utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-normal { font-weight: 400; }

/* Color utilities */
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-error { color: var(--error-color); }

/* Hidden utility */
.hidden { display: none; }

/* ==================== PRINT STYLES ==================== */

@media print {
    .tab-container,
    .tutorial-navigation,
    .practice-buttons,
    .button,
    .calc-button,
    .reveal-btn {
        display: none !important;
    }
    
    .tab-content {
        display: block !important;
    }
    
    .learning-module {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .header {
        background: #f5f5f5 !important;
        color: #000 !important;
    }
    
    .header h1,
    .header p {
        color: #000 !important;
    }
}

/* ==================== HIGH CONTRAST MODE ==================== */

@media (prefers-contrast: high) {
    :root {
        --primary-color: #000080;
        --primary-light: #0000cd;
        --primary-dark: #000050;
        --neutral-200: #808080;
        --neutral-600: #404040;
        --neutral-800: #000000;
    }
    
    .tab {
        border: 2px solid #000;
    }
    
    .button,
    .calc-button,
    .reveal-btn {
        border: 2px solid #000;
    }
}

/* ==================== REDUCED MOTION ==================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .tab-container {
        scroll-behavior: auto;
    }
}

/* ==================== MED MATCH GAME STYLES ==================== */

/* Game Stats Display */
.game-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: var(--border-radius-medium);
    border: 2px solid var(--primary-light);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--neutral-600);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.game-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-small);
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    font-size: 0.9rem;
    min-width: 130px;
    box-shadow: var(--shadow-small);
}

.game-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(3, 98, 156, 0.3);
}

.game-button:active {
    transform: translateY(0);
}

/* Main Game Layout */
.med-match-game {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin: 2rem 0;
    min-height: 600px;
}

/* Medications Pool */
.medications-pool {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius-medium);
    padding: 1.5rem;
}

.medications-pool h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

.med-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom scrollbar for med list */
.med-list::-webkit-scrollbar {
    width: 6px;
}

.med-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.med-list::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

/* Medication Items */
.medication-item {
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: var(--border-radius-small);
    padding: 0.75rem 1rem;
    cursor: grab;
    transition: var(--transition-normal);
    font-weight: 500;
    color: var(--primary-color);
    user-select: none;
    position: relative;
    box-shadow: var(--shadow-small);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.medication-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(3, 98, 156, 0.2);
}

.medication-item.dragging {
    opacity: 0.6;
    transform: rotate(5deg);
    cursor: grabbing;
    z-index: 1000;
}

.medication-item.placed {
    opacity: 0.3;
    cursor: not-allowed;
    background: #f1f5f9;
    color: #94a3b8;
}

/* Drug Classes Grid */
.drug-classes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* For the 8 categories, ensure good spacing */
@media (min-width: 1200px) {
    .drug-classes {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Drug Class Containers */
.drug-class-container {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius-medium);
    overflow: hidden;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-small);
}

.drug-class-container.highlight {
    border-color: var(--success-color);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
    transform: scale(1.02);
}

/* Class Headers */
.class-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 1rem;
    text-align: center;
}

.class-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.class-hint {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 0.5rem;
    font-style: italic;
    line-height: 1.3;
}

.class-hint.hidden {
    display: none;
}

/* Drop Zones */
.drop-zone {
    min-height: 120px;
    padding: 1rem;
    border: 3px dashed #cbd5e1;
    margin: 1rem;
    border-radius: var(--border-radius-small);
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.drop-zone.drag-over {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    border-style: solid;
}

.drop-zone.correct {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    border-style: solid;
}

.drop-zone.incorrect {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
    border-style: solid;
}

.drop-message {
    color: #94a3b8;
    text-align: center;
    font-style: italic;
    margin: auto;
    font-size: 0.9rem;
}

/* Dropped Medications */
.dropped-med {
    background: rgba(3, 98, 156, 0.1);
    border: 1px solid var(--primary-light);
    border-radius: var(--border-radius-small);
    padding: 0.5rem;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
}

.dropped-med:hover {
    background: rgba(3, 98, 156, 0.2);
    transform: translateY(-1px);
}

.dropped-med.correct {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success-color);
    color: var(--success-color);
}

.dropped-med.incorrect {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error-color);
    color: var(--error-color);
}

.dropped-med.correct::after {
    content: "✓";
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
}

.dropped-med.incorrect::after {
    content: "✗";
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
}

/* Game Feedback */
.game-feedback {
    margin: 2rem 0;
    padding: 1.5rem;
    border-radius: var(--border-radius-medium);
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 2px solid #0ea5e9;
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.game-feedback.show {
    display: block;
}

.feedback-content {
    text-align: center;
}

.feedback-content h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feedback-success {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-color: var(--success-color);
}

.feedback-success h3 {
    color: var(--success-color);
}

.feedback-partial {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-color: var(--warning-color);
}

.feedback-partial h3 {
    color: var(--warning-color);
}

/* Learning Summary */
.learning-summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: var(--border-radius-medium);
    border: 2px solid #e2e8f0;
}

.learning-summary h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.summary-card {
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius-small);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-small);
}

.summary-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.summary-card p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--neutral-600);
}

.summary-card p strong {
    color: var(--neutral-800);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.medication-item.incorrect-drop {
    animation: shake 0.5s ease-in-out;
}

/* Mobile Responsiveness for Med Match Game */
@media (max-width: 768px) {
    .game-stats {
        gap: 1rem;
        padding: 0.75rem;
        flex-wrap: wrap;
    }
    
    .stat-item {
        flex: 1;
        min-width: 80px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .game-controls {
        gap: 0.5rem;
    }
    
    .game-button {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        min-width: 100px;
        flex: 1;
        max-width: 120px;
    }
    
    .med-match-game {
        grid-template-columns: 1fr;
        gap: 1rem;
        min-height: auto;
    }
    
    .medications-pool {
        order: 1;
        max-height: 250px;
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 10;
        background: #f8fafc;
        border-bottom: 3px solid var(--primary-color);
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .medications-pool h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .med-list {
        max-height: 150px;
        gap: 0.4rem;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        overflow-y: auto;
        padding: 0.5rem;
    }
    
    .medication-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        text-align: center;
        border-radius: 8px;
        cursor: grab;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .medication-item:active {
        cursor: grabbing;
    }
    
    .drug-classes {
        order: 2;
        display: block;
        overflow-x: auto;
        padding: 1rem 0;
        white-space: nowrap;
        scroll-snap-type: x mandatory;
    }
    
    .drug-class-container {
        display: inline-block;
        width: 280px;
        margin-right: 1rem;
        vertical-align: top;
        white-space: normal;
        scroll-snap-align: start;
    }
    
    .drug-class-container:last-child {
        margin-right: 0;
    }
    
    .drop-zone {
        min-height: 120px;
        padding: 0.75rem;
        margin: 0.5rem 0;
        font-size: 0.9rem;
        border-radius: 12px;
    }
    
    .class-header {
        padding: 0.75rem;
        border-radius: 8px 8px 0 0;
    }
    
    .class-header h4 {
        font-size: 0.95rem;
        margin: 0;
    }
    
    .class-hint {
        font-size: 0.75rem;
        margin-top: 0.25rem;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .learning-summary {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .game-stats {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .stat-item {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem;
        background: #f1f5f9;
        border-radius: 8px;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0 1rem;
    }
    
    .game-button {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .medications-pool {
        margin: 0 -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .drug-classes {
        padding: 0.5rem;
        margin: 0 -1rem;
    }
    
    .drug-class-container {
        width: 250px;
        margin-right: 0.75rem;
    }
    
    .drop-zone {
        min-height: 100px;
        padding: 0.5rem;
    }
    
    .class-header h4 {
        font-size: 0.85rem;
    }
    
    .med-list {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        max-height: 120px;
    }
    
    .medication-item {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
        min-height: 35px;
    }
    
    /* Add scroll indicators */
    .drug-classes::after {
        content: "← Swipe to see more categories →";
        position: absolute;
        bottom: -25px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.7rem;
        color: #64748b;
        white-space: nowrap;
    }
    
    .drug-classes {
        position: relative;
        padding-bottom: 2rem;
    }
}

/* Game Stats Styling */
.stat-item {
    display: flex;
    align-items: center;
    background: white;
    padding: 0.5rem;
    border-radius: var(--border-radius-small);
}
    
    .stat-label {
        display: inline;
        margin-bottom: 0;
        font-weight: 500;
    }
    
    .medication-item {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    
    .dropped-med {
        font-size: 0.8rem;
        padding: 0.4rem;
    }
    
    .class-header h4 {
        font-size: 0.9rem;
    }
    
    .class-hint {
        font-size: 0.75rem;
    }
    
    .drop-zone {
        min-height: 60px;
        padding: 0.5rem;
        margin: 0.5rem;
    }
    
    .drop-message {
        font-size: 0.8rem;
    }
}

/* Touch-specific styles for mobile devices */
@media (pointer: coarse) {
    .medication-item {
        padding: 0.75rem 1rem;
        min-height: 44px; /* Minimum touch target size */
    }
    
    .dropped-med {
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .game-button {
        min-height: 44px;
    }
    
    .drop-zone {
        min-height: 100px;
    }
}

/* High contrast mode support for Med Match Game */
@media (prefers-contrast: high) {
    .medication-item {
        border-width: 3px;
    }
    
    .drop-zone {
        border-width: 4px;
    }
    
    .drug-class-container {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .medication-item,
    .dropped-med,
    .drug-class-container,
    .game-button {
        transition: none;
    }
    
    .medication-item:hover,
    .game-button:hover {
        transform: none;
    }
    
    .game-feedback {
        animation: none;
    }
    
    .medication-item.incorrect-drop {
        animation: none;
        border-color: var(--error-color);
        border-width: 3px;
    }
}
