/* ====================================
   PHYSICS CONTENT STYLES
   Mobile-first responsive design
   Optimized for tables on phones
   ==================================== */

:root {
    /* Physics Color Palette */
    --physics-primary: #2c3e50;        /* Dark blue-gray */
    --physics-secondary: #3498db;       /* Bright blue */
    --physics-accent: #e67e22;          /* Orange */
    --physics-success: #27ae60;         /* Green */
    --physics-warning: #c0392b;         /* Red */
    --physics-info: #3498db;            /* Info blue */
    --physics-light: #ecf0f1;           /* Light gray */
    --physics-dark: #2c3e50;            /* Dark */
    --physics-border: #bdc3c7;          /* Border color */
    --physics-card-bg: #ffffff;         /* White */
    
    /* Gradients */
    --gradient-physics: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    --gradient-mechanics: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    --gradient-waves: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
    --gradient-electricity: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    
    /* Shadows */
    --card-shadow: 0 4px 12px rgba(44, 62, 80, 0.08);
    --hover-shadow: 0 8px 20px rgba(44, 62, 80, 0.15);
    
    /* Spacing */
    --space-xs: 0.25rem;    /* 4px */
    --space-sm: 0.5rem;     /* 8px */
    --space-md: 1rem;       /* 16px */
    --space-lg: 1.5rem;     /* 24px */
    --space-xl: 2rem;       /* 32px */
    --space-xxl: 3rem;      /* 48px */
    
    /* Typography */
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-md: 1rem;       /* 16px */
    --font-size-lg: 1.125rem;   /* 18px */
    --font-size-xl: 1.25rem;    /* 20px */
    --font-size-xxl: 1.5rem;    /* 24px */
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-xxl: 24px;
    --radius-round: 9999px;
}

/* ===== PHYSICS HERO SECTION ===== */
.physics-hero {
    background: var(--gradient-physics);
    color: white;
    padding: var(--space-xl) var(--space-md);
    border-radius: var(--radius-xxl);
    margin-bottom: var(--space-xl);
    position: relative;
    overflow: hidden;
}

.physics-hero h1 {
    color: white;
    margin-bottom: var(--space-sm);
    position: relative;
    z-index: 1;
    font-size: var(--font-size-xxl);
}

.physics-hero-subtitle {
    font-size: var(--font-size-lg);
    opacity: 0.9;
    margin-bottom: var(--space-md);
    max-width: 800px;
    position: relative;
    z-index: 1;
}

.physics-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-round);
    font-size: var(--font-size-sm);
    font-weight: 500;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ===== NOTE BOXES ===== */
.physics-note-box {
    background: var(--physics-light);
    border-left: 4px solid var(--physics-primary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    flex-wrap: wrap;
    width: 100%;
}

.physics-note-icon {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: var(--card-shadow);
}

.physics-note-content {
    flex: 1;
    min-width: 200px;
}

.physics-note-content p:last-child {
    margin-bottom: 0;
}

/* ===== SECTION STYLES ===== */
.physics-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    border: 1px solid var(--physics-border);
    box-shadow: var(--card-shadow);
    width: 100%;
    overflow: hidden;
}

.physics-section h2 {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--physics-light);
    color: var(--physics-primary);
    font-size: var(--font-size-xl);
}

.physics-section h3 {
    color: var(--physics-secondary);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-lg);
}

/* ===== GRID SYSTEMS - MOBILE FIRST ===== */
.physics-grid-2col,
.physics-grid-3col,
.physics-grid-4col,
.physics-grid-auto {
    display: grid;
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: var(--space-md);
    margin: var(--space-lg) 0;
    width: 100%;
}

/* Tablet (640px and up) */
@media screen and (min-width: 640px) {
    .physics-grid-2col {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .physics-grid-4col {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .physics-grid-auto {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop (992px and up) */
@media screen and (min-width: 992px) {
    .physics-grid-3col {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .physics-grid-4col {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .physics-grid-auto {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* ===== CARDS ===== */
.physics-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--physics-border);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.physics-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hover-shadow);
    border-color: var(--physics-secondary);
}

.physics-card-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-physics);
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
}

.physics-card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--physics-primary);
    margin-bottom: var(--space-sm);
}

.physics-card-content {
    flex: 1;
}

.physics-card-footer {
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--physics-light);
}

/* ===== MOBILE-FRIENDLY TABLES ===== */
.physics-table-container {
    width: 100%;
    margin: var(--space-lg) 0;
    border-radius: var(--radius-lg);
    background: white;
    border: 1px solid var(--physics-border);
    overflow: hidden;
}

/* Card-based table for mobile (horizontal scroll fallback) */
.physics-table {
    width: 100%;
    border-collapse: collapse;
}

.physics-table th {
    background: var(--gradient-physics);
    color: white;
    padding: var(--space-md);
    font-weight: 600;
    text-align: left;
    font-size: var(--font-size-sm);
}

.physics-table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--physics-light);
    font-size: var(--font-size-sm);
}

.physics-table tr:last-child td {
    border-bottom: none;
}

/* Mobile card table (alternative to horizontal scroll) */
.physics-table-cards {
    display: none; /* Hidden by default, shown on mobile */
}

/* For tables that must stay as tables, enable horizontal scroll */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: var(--space-lg) 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--physics-border);
    background: white;
}

.table-scroll table {
    min-width: 500px; /* Forces scroll on mobile */
    width: 100%;
    border-collapse: collapse;
}

.table-scroll th {
    background: var(--gradient-physics);
    color: white;
    padding: var(--space-md);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.table-scroll td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--physics-light);
    white-space: nowrap;
}

/* Mobile-friendly card-based table (BEST for phones) */
@media screen and (max-width: 640px) {
    /* Hide traditional table on mobile */
    .physics-table.desktop-only {
        display: none;
    }
    
    /* Show card-based table */
    .physics-table-cards {
        display: flex;
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .data-card {
        background: white;
        border-radius: var(--radius-lg);
        padding: var(--space-md);
        border: 1px solid var(--physics-border);
        box-shadow: var(--card-shadow);
    }
    
    .data-card-header {
        background: var(--gradient-physics);
        color: white;
        padding: var(--space-sm) var(--space-md);
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        margin: calc(-1 * var(--space-md)) calc(-1 * var(--space-md)) var(--space-md) calc(-1 * var(--space-md));
        font-weight: 600;
    }
    
    .data-row {
        display: flex;
        justify-content: space-between;
        padding: var(--space-xs) 0;
        border-bottom: 1px dashed var(--physics-light);
    }
    
    .data-row:last-child {
        border-bottom: none;
    }
    
    .data-label {
        font-weight: 600;
        color: var(--physics-primary);
    }
    
    .data-value {
        color: var(--physics-secondary);
    }
}

/* ===== FORMULAE STYLES ===== */
.physics-formula {
    background: var(--physics-light);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    text-align: center;
    font-size: var(--font-size-lg);
    margin: var(--space-md) 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-family: 'Courier New', monospace, 'SF Mono', Monaco, monospace;
}

.physics-formula.equation {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--physics-primary);
}

.variable-definition {
    display: inline-block;
    background: white;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    margin: 0.2rem;
    font-size: var(--font-size-sm);
    border: 1px solid var(--physics-border);
}

.subscript {
    font-size: 0.75em;
    vertical-align: sub;
    line-height: 0;
}

.superscript {
    font-size: 0.75em;
    vertical-align: super;
    line-height: 0;
}

/* ===== PROCESS STEPS ===== */
.physics-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

@media screen and (min-width: 768px) {
    .physics-steps {
        flex-direction: row;
    }
}

.physics-step {
    flex: 1;
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--physics-border);
    position: relative;
}

.physics-step-number {
    width: 36px;
    height: 36px;
    background: var(--gradient-physics);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

/* ===== DATA DISPLAY ===== */
.physics-data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin: var(--space-md) 0;
}

@media screen and (min-width: 480px) {
    .physics-data-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (min-width: 768px) {
    .physics-data-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.data-item {
    background: var(--physics-light);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    text-align: center;
}

.data-item-label {
    font-size: var(--font-size-xs);
    color: var(--physics-primary);
    opacity: 0.8;
}

.data-item-value {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--physics-secondary);
}

/* ===== GRAPHS AND DIAGRAMS (placeholders) ===== */
.physics-diagram {
    background: var(--physics-light);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin: var(--space-lg) 0;
    text-align: center;
    border: 2px dashed var(--physics-border);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--physics-primary);
}

/* ===== HIGHLIGHT BOX ===== */
.physics-highlight {
    background: var(--physics-light);
    border-left: 4px solid var(--physics-accent);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    margin: var(--space-lg) 0;
}

.physics-highlight strong {
    color: var(--physics-accent);
}

/* ===== KEY TERMS CLOUD ===== */
.physics-terms-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin: var(--space-lg) 0;
}

.physics-term-tag {
    background: var(--physics-light);
    color: var(--physics-primary);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-round);
    font-size: var(--font-size-sm);
    border: 1px solid var(--physics-border);
    transition: all 0.2s ease;
    cursor: default;
}

.physics-term-tag:hover {
    background: var(--physics-primary);
    color: white;
}

/* ===== CALCULATOR / INTERACTIVE ELEMENTS ===== */
.physics-calculator {
    background: linear-gradient(145deg, #2c3e50, #34495e);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin: var(--space-lg) 0;
    color: white;
}

.calculator-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: var(--space-md) 0;
    flex-wrap: wrap;
}

.calculator-input {
    flex: 1;
    min-width: 120px;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    border: none;
    font-size: var(--font-size-md);
}

.calculator-output {
    background: rgba(255,255,255,0.15);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: var(--font-size-xl);
    font-weight: 700;
}

/* ===== QUIZ STYLES ===== */
.physics-quiz-section {
    background: var(--physics-light);
    border-radius: var(--radius-xxl);
    padding: var(--space-xl);
    margin: var(--space-xxl) 0;
}

.physics-question-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    border-left: 4px solid var(--physics-primary);
}

.physics-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-sm);
    margin: var(--space-lg) 0;
}

@media screen and (min-width: 640px) {
    .physics-options {
        grid-template-columns: repeat(2, 1fr);
    }
}

.physics-option {
    background: var(--physics-light);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.physics-option:hover {
    background: white;
    border-color: var(--physics-secondary);
}

.physics-option input[type="radio"] {
    accent-color: var(--physics-primary);
    width: 20px;
    height: 20px;
    margin-right: var(--space-sm);
}

.physics-btn {
    background: var(--gradient-physics);
    color: white;
    border: none;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-round);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: var(--font-size-md);
    min-height: 44px;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.physics-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
}

.physics-feedback {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
    display: none;
}

.physics-feedback.success {
    background: #e8f5e9;
    color: var(--physics-success);
    border-left: 4px solid var(--physics-success);
    display: block;
}

.physics-feedback.error {
    background: #ffebee;
    color: var(--physics-warning);
    border-left: 4px solid var(--physics-warning);
    display: block;
}

/* ===== FORMULA CARDS ===== */
.physics-formula-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

@media screen and (min-width: 640px) {
    .physics-formula-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.physics-formula-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 2px solid var(--physics-border);
    text-align: center;
}

.physics-formula-name {
    font-weight: 600;
    color: var(--physics-primary);
    margin-bottom: var(--space-xs);
}

.physics-formula-display {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--physics-secondary);
    margin: var(--space-sm) 0;
    font-family: 'Courier New', monospace;
}

.physics-formula-units {
    font-size: var(--font-size-xs);
    color: var(--physics-primary);
    opacity: 0.7;
}

/* ===== UNIT CONVERSION TABLES ===== */
.conversion-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-size: var(--font-size-sm);
}

.conversion-table th {
    background: var(--physics-primary);
    color: white;
    padding: var(--space-sm);
}

.conversion-table td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--physics-light);
    text-align: center;
}

/* Mobile-friendly conversion cards */
@media screen and (max-width: 480px) {
    .conversion-table.desktop-only {
        display: none;
    }
    
    .conversion-cards {
        display: flex;
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .conversion-card {
        background: white;
        border-radius: var(--radius-md);
        padding: var(--space-md);
        border: 1px solid var(--physics-border);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .conversion-from {
        font-weight: 600;
        color: var(--physics-primary);
    }
    
    .conversion-arrow {
        color: var(--physics-accent);
        font-size: 1.2rem;
    }
    
    .conversion-to {
        font-weight: 600;
        color: var(--physics-secondary);
    }
}

/* ===== EXPERIMENT / LAB CARDS ===== */
.physics-experiment-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 2px solid var(--physics-border);
    margin-bottom: var(--space-md);
    transition: all 0.3s ease;
}

.physics-experiment-card:hover {
    border-color: var(--physics-accent);
    box-shadow: var(--hover-shadow);
}

.experiment-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.experiment-badge {
    background: var(--physics-accent);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-round);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

/* ===== SAFETY NOTES ===== */
.physics-safety {
    background: #fff3e0;
    border-left: 4px solid var(--physics-warning);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    margin: var(--space-lg) 0;
}

.physics-safety h4 {
    color: var(--physics-warning);
    margin-bottom: var(--space-sm);
}

/* ===== SUMMARY SECTION ===== */
.physics-summary {
    background: var(--physics-light);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin: var(--space-xxl) 0;
}

.physics-summary-list {
    list-style: none;
    padding: 0;
}

.physics-summary-list li {
    padding: var(--space-sm) 0 var(--space-sm) 2rem;
    position: relative;
    border-bottom: 1px solid rgba(44, 62, 80, 0.1);
}

.physics-summary-list li:last-child {
    border-bottom: none;
}

.physics-summary-list li::before {
    content: "✓";
    color: var(--physics-success);
    font-weight: 700;
    position: absolute;
    left: 0;
    font-size: var(--font-size-lg);
}

/* ===== TOPIC NAVIGATION ===== */
.topic-nav {
    display: flex;
    justify-content: space-between;
    margin: var(--space-xxl) 0;
    padding: var(--space-md) 0;
    border-top: 1px solid var(--physics-border);
    border-bottom: 1px solid var(--physics-border);
    gap: var(--space-sm);
}

.topic-nav a {
    color: var(--physics-primary);
    text-decoration: none;
    font-weight: 500;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    background: var(--physics-light);
    text-align: center;
    flex: 1;
}

.topic-nav a:hover {
    background: var(--physics-primary);
    color: white;
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }
.mt-5 { margin-top: var(--space-xxl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }
.mb-5 { margin-bottom: var(--space-xxl); }

.p-1 { padding: var(--space-sm); }
.p-2 { padding: var(--space-md); }
.p-3 { padding: var(--space-lg); }
.p-4 { padding: var(--space-xl); }

.w-100 { width: 100%; }

/* Hide/show utilities */
.hide-mobile {
    display: none;
}

@media screen and (min-width: 768px) {
    .hide-mobile {
        display: initial;
    }
    
    .show-mobile {
        display: none;
    }
}

/* Touch-friendly targets */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ===== PRINT STYLES ===== */
@media print {
    .physics-hero {
        background: white;
        color: black;
        border: 2px solid var(--physics-primary);
    }
    
    .physics-hero h1 {
        color: var(--physics-primary);
    }
    
    .physics-quiz-section,
    .physics-btn,
    .topic-nav {
        display: none !important;
    }
    
    .physics-card,
    .physics-section,
    .physics-experiment-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}