/* ----- Variables & Theming ----- */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient-1: #f8fafc;
    --bg-gradient-2: #f1f5f9;
    --text-main: #1e1b4b;
    --text-muted: #4338ca;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --danger: #ef4444;
    --success: #10b981;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* ----- Background Animated Shapes ----- */
.background-shapes {
    display: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite alternate ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: #818cf8;
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: #c084fc;
    bottom: 10vh;
    right: -50px;
    animation-delay: -5s;
}

.shape-3 {
    width: 250px;
    height: 250px;
    background: #38bdf8;
    top: 40vh;
    left: 40vw;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* ----- Layout ----- */
.container {
    max-width: 1800px;
    width: 100%;
    margin: 0 auto;
    padding: clamp(24px, 4vw, 40px);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

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

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.icon {
    font-size: 2.5rem;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #312e81, #4338ca);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ----- Glassmorphism Cards ----- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.15);
}

.hidden {
    display: none !important;
}

/* ----- Forms ----- */
.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

input, select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--text-main);
    transition: all 0.2s ease;
    outline: none;
}

input:focus, select:focus {
    border-color: var(--primary-color);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

input::placeholder {
    color: #9ca3af;
}

/* ----- Buttons ----- */
button {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.btn-primary {
    width: 100%;
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1.1rem;
    margin-top: 1rem;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255,255,255,0.6);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: white;
    transform: translateY(-1px);
}

/* ----- Loading State ----- */
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner-container h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

@keyframes skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ----- Results Area ----- */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

/* Markdown Rendering Styles */
.markdown-body {
    font-size: 1rem;
    line-height: 1.7;
    color: #334155;
}

.markdown-body h1 {
    font-size: 1.75rem;
    color: #1e293b;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-body h2 {
    font-size: 1.5rem;
    color: #334155;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    padding-bottom: 0.2rem;
}

.markdown-body h3 {
    font-size: 1.25rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.markdown-body p, .markdown-body ul, .markdown-body ol {
    margin-bottom: 1rem;
}

.markdown-body ul, .markdown-body ol {
    padding-left: 1.5rem;
}

.markdown-body li {
    margin-bottom: 0.25rem;
}

.markdown-body strong {
    color: #0f172a;
}

/* ----- Footer ----- */
.app-footer {
    text-align: center;
    margin-top: auto;
    padding-top: 2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ----- Responsive / Mobile ----- */
@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .glass-card {
        padding: 1.5rem;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* ----- Print Styles ----- */
@media print {
    body {
        background: white;
    }
    .background-shapes, .app-header, .generator-card, .app-footer, .action-buttons {
        display: none !important;
    }
    .glass-card {
        box-shadow: none;
        border: none;
        padding: 0;
        background: transparent;
    }
    .container {
        padding: 0;
        max-width: 100%;
    }
    .markdown-body {
        color: black;
    }
}
/ *   - - - - -   T o a s t   N o t i f i c a t i o n s   - - - - -   * / 
 . t o a s t - c o n t a i n e r   { 
         p o s i t i o n :   f i x e d ; 
         b o t t o m :   2 0 p x ; 
         r i g h t :   2 0 p x ; 
         d i s p l a y :   f l e x ; 
         f l e x - d i r e c t i o n :   c o l u m n ; 
         g a p :   1 0 p x ; 
         z - i n d e x :   9 9 9 9 ; 
 } 
 
 . t o a s t   { 
         b a c k g r o u n d :   v a r ( - - d a n g e r ) ; 
         c o l o r :   w h i t e ; 
         p a d d i n g :   1 r e m   1 . 5 r e m ; 
         b o r d e r - r a d i u s :   8 p x ; 
         b o x - s h a d o w :   0   4 p x   1 2 p x   r g b a ( 0 , 0 , 0 , 0 . 1 5 ) ; 
         f o n t - w e i g h t :   5 0 0 ; 
         t r a n s f o r m :   t r a n s l a t e X ( 1 2 0 % ) ; 
         o p a c i t y :   0 ; 
         t r a n s i t i o n :   a l l   0 . 3 s   c u b i c - b e z i e r ( 0 . 6 8 ,   - 0 . 5 5 ,   0 . 2 6 5 ,   1 . 5 5 ) ; 
 } 
 
 . t o a s t . s h o w   { 
         t r a n s f o r m :   t r a n s l a t e X ( 0 ) ; 
         o p a c i t y :   1 ; 
 }  
 /* ----- Dashboard Tabs ----- */
.tabs-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding: 10px;
    white-space: nowrap;
    position: sticky;
    top: 90px;
    z-index: 90;
    backdrop-filter: blur(10px);
}
/* Hide scrollbar for tabs */
.tabs-nav::-webkit-scrollbar {
    display: none;
}
.tab-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 15px;
    border-radius: 8px;
    color: var(--text-color);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.tab-contents {
    padding: 20px;
}
.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}
.tab-pane.active {
    display: block;
}

/* ----- Dashboard Overview Grid ----- */
.dashboard-grid, .homework-grid, .resources-grid {
    display: grid;
    gap: 24px;
    margin-bottom: 32px;
    width: 100%;
}

/* Custom Responsive Grid Layouts */
/* Mobile (<768px): 1 column */
@media (max-width: 767px) {
    .dashboard-grid, .gallery-grid, .homework-grid, .resources-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Tablet (768-1023px): 2 columns */
@media (min-width: 768px) and (max-width: 1023px) {
    .dashboard-grid, .gallery-grid, .homework-grid, .resources-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Laptop (1024-1439px): 3 columns */
@media (min-width: 1024px) and (max-width: 1439px) {
    .dashboard-grid, .gallery-grid, .homework-grid, .resources-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Desktop (>=1440px): 4 columns for dashboard, 3 for gallery/homework */
@media (min-width: 1440px) {
    .dashboard-grid, .resources-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    .gallery-grid, .homework-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
.metric-card {
    background: rgba(255, 255, 255, 0.3);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.5);
}
.metric-card h4 {
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 5px;
}
.metric-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* ----- Vertical Timeline ----- */
.timeline {
    position: relative;
    width: 100%;
    margin: 0 auto;
    padding-left: 20px;
}
.timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background-color: var(--primary-color);
    top: 0;
    bottom: 0;
    left: 0;
    border-radius: 4px;
}
.timeline-item {
    padding: 10px 20px;
    position: relative;
    background: inherit;
    width: 100%;
}
.timeline-item::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    right: auto;
    background-color: white;
    border: 4px solid var(--primary-color);
    top: 15px;
    border-radius: 50%;
    z-index: 1;
    left: -8px;
}
.timeline-content {
    padding: 15px 20px;
    background-color: rgba(255,255,255,0.4);
    position: relative;
    border-radius: 8px;
}
.timeline-time {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

/* ----- Collapsible Sections ----- */
details.lesson-section {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    width: 100%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    transition: all 0.3s ease;
}
details.lesson-section:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 6px 12px rgba(0,0,0,0.05);
}
details.lesson-section summary {
    padding: 15px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
details.lesson-section summary::-webkit-details-marker {
    display: none;
}
details.lesson-section summary::after {
    content: '?';
    font-size: 0.8rem;
    transition: transform 0.2s;
}
details.lesson-section[open] summary::after {
    transform: rotate(180deg);
}
.lesson-section-content {
    padding: 0 15px 15px 15px;
    border-top: 1px solid rgba(255,255,255,0.2);
    margin-top: 10px;
    padding-top: 15px;
}

/* ----- Topic Tree Map ----- */
.tree-map {
    font-family: monospace;
    font-size: 1.1rem;
    background: rgba(255,255,255,0.3);
    padding: 20px;
    border-radius: 8px;
    white-space: pre-wrap;
}

/* Outcomes List */
.outcomes-list {
    list-style: none;
    padding: 0;
}
.outcomes-list li {
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
}
.outcomes-list li::before {
    content: '?';
    color: var(--success);
    margin-right: 10px;
    font-weight: bold;
}

/* =========================================================
   TEACHER DASHBOARD STYLES
   ========================================================= */

/* Full Width Layout overrides */
.full-width-layout {
    width: 100%;
    max-width: 1800px !important;
    margin: 0 auto;
    padding: 24px;
    border-radius: 12px;
}

@media (min-width: 1440px) {
    .container {
        max-width: 1600px;
    }
}

/* Sticky Header */
.sticky-lesson-header {
    position: sticky;
    top: 20px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.6);
    backdrop-filter: blur(20px);
}
.header-details h2 {
    margin: 0 0 10px 0;
    font-size: 1.8rem;
    color: var(--text-main);
}
.header-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.header-actions {
    text-align: right;
    color: var(--text-muted);
}

/* Floating Toolbar */
.floating-toolbar {
    display: flex;
    gap: 10px;
    padding: 10px 20px;
    margin-bottom: 25px;
    justify-content: flex-end;
    align-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.4);
}
.toolbar-btn {
    background: white;
    color: var(--text-main);
    border: 1px solid rgba(0,0,0,0.1);
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.toolbar-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.toolbar-btn.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sticky-lesson-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .floating-toolbar {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Callout Boxes & Highlight Panels */
.info-panel {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 0 8px 8px 0;
}
.info-panel h4 {
    margin-top: 0;
    color: var(--primary-color);
}
.activity-card {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
.quiz-card {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
.quiz-card h4 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    line-height: 1.5;
}
.quiz-card .options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.quiz-card .options li {
    background: rgba(255,255,255,0.8);
    padding: 12px 16px;
    border-radius: 8px;
    list-style: none;
    border: 1px solid rgba(0,0,0,0.05);
}
.quiz-card .explanation {
    margin-top: 15px;
    padding: 15px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    border-left: 4px solid var(--success);
}

/* Fix for previous summary arrow */
details.lesson-section summary::after {
    content: '▼';
}
.outcomes-list li::before {
    content: '✔';
}

/* ----- Visualization Image Gallery Styles ----- */
.gallery-grid {
    display: grid;
    gap: 24px;
    margin-top: 24px;
    width: 100%;
}

.gallery-card {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
}
.gallery-img-container {
    width: 100%;
    height: 300px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
    margin-bottom: 15px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gallery-img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.2s;
}
.gallery-img-container img:hover {
    transform: scale(1.03);
}
.gallery-attribution {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    margin-bottom: 10px;
}
.viz-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: flex-end;
}
.viz-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}
.viz-btn:hover { background: #5046e5; }
.viz-btn:disabled { background: #a5b4fc; cursor: not-allowed; }

/* Lightbox Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.lightbox-modal.show {
    display: flex;
}
.lightbox-content {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 8px;
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

/* ----- Premium UI Updates ----- */
.hw-card, .viz-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    border-top: 4px solid var(--primary-color);
}

.hw-card:hover, .viz-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(31, 38, 135, 0.15);
}

.bg-danger { background-color: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.bg-warning { background-color: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.bg-success { background-color: #d1fae5; color: #047857; border: 1px solid #6ee7b7; }

.flashcard {
    perspective: 1000px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.5) 100%);
}

.flashcard:hover {
    transform: scale(1.02);
    box-shadow: var(--glass-shadow);
}

.flashcard.flipped .front {
    display: none;
}
.flashcard.flipped .back {
    display: block !important;
    animation: fadeIn 0.4s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.styled-table {
    border-collapse: collapse;
    font-size: 0.9em;
    font-family: sans-serif;
    min-width: 400px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.styled-table thead tr {
    background-color: var(--primary-color);
    color: #ffffff;
    text-align: left;
}

.styled-table th,
.styled-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dddddd;
}

.styled-table tbody tr:last-of-type {
    border-bottom: 2px solid var(--primary-color);
}
