/* --- MODERN BLACK & WHITE THEME --- */
:root {
    --bg-primary: #0a0a0a; /* Near black for main background */
    --bg-secondary: #1a1a1a; /* Dark gray for secondary elements */
    --bg-tertiary: #2a2a2a; /* Lighter gray for hovers */
    --text-primary: #f5f5f5; /* Off-white for primary text */
    --text-secondary: #a3a3a3; /* Muted gray for secondary text */
    --accent-primary: #ffffff; /* White for key actions and highlights */
    --accent-red: #ef4444; /* A modern, sharp red for destructive actions */
    --border-color: #333333; /* Subtle border color */
    --focus-ring-color: rgba(245, 245, 245, 0.5); /* Semi-transparent white for focus rings */

    /* Finder Window Specific Variables */
    --finder-bg-primary: #1c1c1c;
    --finder-bg-secondary: #0a0a0a;
    --finder-text-primary: #f5f5f5;
    --finder-text-secondary: #a3a3a3;
    --finder-border-color: #333333;
    --finder-titlebar-bg: #2a2a2a;
    --finder-hover-bg: #333333;
    --finder-active-bg: var(--accent-primary);
    --finder-active-text: #0a0a0a;
}

/* --- LIGHT THEME OVERRIDES --- */
body.light-theme {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e5e5e5;
    --text-primary: #0a0a0a;
    --text-secondary: #737373;
    --accent-primary: #0a0a0a;
    --border-color: #d4d4d4;
    --focus-ring-color: rgba(10, 10, 10, 0.5);

    /* Finder Window Light Theme */
    --finder-bg-primary: #ffffff;
    --finder-bg-secondary: #f5f5f5;
    --finder-text-primary: #0a0a0a;
    --finder-text-secondary: #737373;
    --finder-border-color: #d4d4d4;
    --finder-titlebar-bg: #e5e5e5;
    --finder-hover-bg: #e5e5e5;
    --finder-active-bg: var(--accent-primary);
    --finder-active-text: #ffffff;
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

button,
input,
textarea,
select {
    transition: all .2s ease-in-out;
    font-family: inherit;
}

button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Keyframe animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* --- LOGIN PAGE --- */
#authWrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    z-index: 1001;
}

.login-left-panel,
.login-right-panel {
    width: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.login-left-panel {
    background: var(--bg-primary);
    color: var(--text-primary);
    flex-direction: column;
    text-align: center;
}

.login-left-panel h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 1rem;
}

.login-left-panel p {
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.5;
    margin-bottom: .5rem;
    color: var(--text-secondary);
}

.login-right-panel {
    background: var(--bg-secondary);
    flex-direction: column;
}

#authContainer {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background-color: var(--bg-primary);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

#authContainer h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: .75rem;
    cursor: pointer;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1rem;
}
.google-btn:hover { background-color: var(--bg-tertiary); border-color: var(--text-secondary); }
.google-btn img { height: 20px; }

#accessCodeInput {
     background-color: var(--bg-secondary);
     border: 1px solid var(--border-color);
     color: var(--text-primary);
     padding: 12px;
     border-radius: 8px;
     width: 100%;
     margin-bottom: 1rem;
     text-align: center;
     font-size: 1rem;
}
#accessCodeInput:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.btn-primary {
     background-color: var(--accent-primary);
     color: var(--bg-primary);
     padding: .75rem 1.5rem;
     border-radius: 8px;
     border: none;
     cursor: pointer;
     font-weight: 600;
     font-size: 1rem;
}

body.light-theme .btn-primary {
    color: var(--bg-primary);
}

.btn-primary:hover {
     opacity: 0.85;
     transform: translateY(-1px);
}

#appSection {
    display: none;
    flex-direction: column;
    height: 100vh;
    background-color: var(--bg-primary);
    animation: fadeIn .6s ease-out both;
}

/* --- HEADER --- */
header {
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.logo-container {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.logo-container h1 {
    font-size: 1.25rem;
    font-weight: 700;
}
.logo-container p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Navigation */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-actions .tab,
.header-actions .dropdown-menu > button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    transition: background 0.2s, color 0.2s;
}

.header-actions .tab:hover,
.header-actions .dropdown-menu > button:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.header-actions .tab.active,
.header-actions .dropdown-menu > button.active {
    background: var(--bg-secondary);
    color: var(--accent-primary);
    font-weight: 600;
}

/* Dropdown Menu */
.dropdown-menu {
    position: relative;
}

.dropdown-menu-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--bg-secondary);
    min-width: 180px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
    border-radius: 8px;
    overflow: hidden;
    z-index: 20;
}

.dropdown-menu-content a {
    display: block;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.dropdown-menu-content a:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Show menu on hover */
.dropdown-menu:hover .dropdown-menu-content {
    display: block;
}
/* Modernized Header Buttons */
.header-actions .tab {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: .2s;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.875rem;
}

.header-actions .tab:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.header-actions .tab.active {
    background: var(--bg-secondary);
    color: var(--accent-primary);
    font-weight: 600;
}

.user-info { display: flex; align-items: center; gap: 1rem; margin-left: 1rem; }
#userDisplayName { font-weight: 500; cursor: pointer; }
.logout-btn { background: none; border: 1px solid var(--border-color); color: var(--text-secondary); cursor: pointer; padding: 6px 12px; border-radius: 8px; font-weight: 600; }
.logout-btn:hover { background: var(--accent-red); border-color: var(--accent-red); color: var(--accent-primary); }

#switchRoleButton {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-weight: 600;
}
#switchRoleButton:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--text-secondary);
}

/* --- DROPDOWN MENU --- */
.dropdown-menu {
    position: relative;
    display: inline-block;
}

.dropdown-menu-content {
    display: none;
    position: absolute;
    top: 110%; /* Adjusted to be clearly below the button */
    left: 0;
    background-color: var(--bg-secondary);
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    z-index: 10;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 4px;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-menu-content button {
    color: var(--text-secondary);
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.875rem;
}

.dropdown-menu-content button:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.dropdown-menu:hover .dropdown-menu-content {
    display: block;
}

/* Dropdown Menu Fix */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown .tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  font-weight: 500;
  cursor: pointer;
}

.dropdown .tab:hover {
  color: var(--accent-primary);
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--bg-secondary);
  min-width: 180px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-top: 8px;
  padding: 8px 0;
  z-index: 999;
}

.dropdown-content li {
  list-style: none;
}

.dropdown-content a {
  display: block;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text-primary);
}

.dropdown-content a:hover {
  background-color: var(--bg-tertiary);
  color: var(--accent-primary);
}

/* Show dropdown on hover */
.dropdown:hover .dropdown-content {
  display: block;
}

/* --- MAIN CONTENT --- */
main {
    flex: 1;
    display: flex;
    overflow-y: auto;
    padding: 32px;
    gap: 32px;
    justify-content: center; /* Center content horizontally */
}

#homeSection, #gradingSection, #chatSection, #studentManagementSection, #profileSection, #tutorialSection, #pastPapersSection, #exerciseSection {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    width: 100%; /* Take full width of main */
    max-width: 900px; /* Max width for content readability */
    margin: 0 auto; /* Center content within main */
}

#gradingSection, #chatSection, #studentManagementSection {
    max-width: 900px; /* Consistent max-width for these sections */
    margin: 0 auto;
}

/* --- FORMS --- */
label { display: block; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
input[type="text"], input[type="number"], input[type="email"], select, input[type="url"], textarea, input[type="date"] {
    width: 100%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}
textarea { resize: vertical; min-height: 120px; }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    cursor: pointer;
    word-wrap: break-word;
    padding: 1rem;
    text-align: center;
}
.drop-zone.highlight {
    border-color: var(--accent-primary);
    background: rgba(245, 245, 245, .05);
}

body.light-theme .drop-zone.highlight {
    background: rgba(10, 10, 10, .05);
}

.file-preview { max-width: 100%; height: auto; border-radius: 8px; margin-top: 10px; max-height: 200px; object-fit: contain; }
.error-message { color: var(--accent-red); font-size: 0.875rem; margin-top: -1rem; margin-bottom: 1rem; }

#resultContainer { margin-top: 1.5rem; padding: 1.5rem; border-radius: 8px; background-color: var(--bg-secondary); border: 1px solid var(--border-color); min-height: 100px; white-space: pre-wrap; }
#pastSubmissions { margin-top: 1.5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.submission-card { background-color: var(--bg-secondary); padding: 1rem; border-radius: 8px; border: 1px solid var(--border-color); }

/* --- CHAT --- */
#chatSection { display: flex; flex-direction: column; gap: 1rem; }
#chatDisplay { flex: 1; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.chat-message { max-width: 80%; padding: 12px 18px; border-radius: 20px; line-height: 1.5; word-wrap: break-word; }
.chat-message.user { background-color: var(--accent-primary); color: var(--bg-primary); align-self: flex-end; border-bottom-right-radius: 6px; }
body.light-theme .chat-message.user { color: var(--bg-primary); }
.chat-message.gemini { background-color: var(--bg-secondary); align-self: flex-start; border-bottom-left-radius: 6px; }
.chat-input-wrapper { display: flex; gap: .5rem; flex-shrink: 0; }
#chatInput { flex: 1; }
#sendChatButton { background: var(--accent-primary); color: var(--bg-primary); }
body.light-theme #sendChatButton { color: var(--bg-primary); }
#sendChatButton:hover { opacity: 0.85; }

.loading-indicator { text-align: center; padding: 1rem; color: var(--text-secondary); }

/* --- UNIVERSAL STYLES --- */
.section-title { font-size: 2rem; font-weight: 700; margin-bottom: 2rem; letter-spacing: -0.5px; }
.form-container { max-width: 100%; margin-bottom: 2rem; background: var(--bg-secondary); padding: 2rem; border-radius: 12px; border: 1px solid var(--border-color); }
.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }

/* --- STUDENT MANAGEMENT --- */
#studentManagementSection { display: flex; flex-direction: column; gap: 1.5rem; }
.student-card { background-color: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; padding: 1.5rem; position: relative;}
.student-card h3 { font-size: 1.25rem; margin-bottom: 1rem; }
.student-info p { margin-bottom: 0.5rem; color: var(--text-secondary); }
.student-info p strong { color: var(--text-primary); }
.purchase-history { margin-top: 1.5rem; border-top: 1px solid var(--border-color); padding-top: 1.5rem; }
.purchase-item { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border-color); }
.purchase-item:last-child { border-bottom: none; }
.delete-student-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--accent-red);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    border-radius: 50%;
}
.delete-student-btn:hover {
    background-color: rgba(239, 68, 68, 0.1); /* Light red hover */
}


/* --- MATERIAL CARDS (Tutorials, Papers, Exercises) --- */
.material-card { background-color: var(--bg-secondary); border-radius: 12px; overflow: hidden; border: 1px solid var(--border-color); display: flex; flex-direction: column; position:relative; text-decoration: none; color: var(--text-primary); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.material-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.material-card-thumbnail { position: relative; cursor: pointer; }
.material-card-thumbnail img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; }
.material-card-content { padding: 1.5rem; flex-grow: 1; display: flex; flex-direction: column; }
.material-card-content h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }

/* --- TEACHER CONTENT MANAGEMENT --- */
.content-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    background: var(--bg-primary);
    transition: background-color 0.2s ease-in-out;
}
.content-item.drag-over {
    background-color: rgba(245, 245, 245, 0.1);
    border-color: var(--accent-primary);
}
body.light-theme .content-item.drag-over {
    background-color: rgba(10, 10, 10, 0.1);
}

.content-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding: 0.5rem; }
.content-header h3, .content-header h4 { margin: 0; }
.item-actions button { margin-left: 0.5rem; padding: 6px 10px; font-size: 0.8rem; }

.nested-container {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
    border-left: 2px solid var(--border-color);
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    max-height: 0;
}
.nested-container.expanded { max-height: 1000px; } /* Sufficiently large to show content */

.sub-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; border-radius: 6px; cursor: grab; }
.sub-item:hover { background-color: var(--bg-tertiary); }
.sub-item a { color: var(--text-primary); text-decoration: none; }
.sub-item a:hover { text-decoration: underline; }

.collapse-arrow {
    margin-left: 10px; transition: transform 0.3s ease-out; display: inline-block; width: 0; height: 0;
    border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid var(--text-secondary);
}
.content-header[aria-expanded="true"] .collapse-arrow { transform: rotate(90deg); }
.content-header[aria-expanded="false"] .collapse-arrow { transform: rotate(0deg); }

/* --- VIDEO & HERO --- */
.video-embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; background: #000; border-radius: 8px 8px 0 0; }
.video-embed-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.play-button-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 60px; color: rgba(255, 255, 255, 0.8); text-shadow: 0 0 15px rgba(0, 0, 0, 0.5); pointer-events: none; transition: all 0.2s ease; }
.material-card-thumbnail:hover .play-button-overlay { color: #fff; transform: translate(-50%, -50%) scale(1.1); }

.hero { display: flex; align-items: center; justify-content: space-between; padding: 2rem 1.5rem; }
.hero-text { max-width: 50%; opacity: 0; animation: slideInUp 1s ease-out forwards; }
.hero-text h2 { font-size: 3rem; font-weight: 700; letter-spacing: -1px; }
.hero-text span { display: block; font-size: 1.5rem; font-weight: normal; margin-top: 0.5rem; color: var(--text-secondary); }
.hero-image { max-width: 40%; opacity: 0; animation: slideInUp 1s 0.2s ease-out forwards; }
.hero-image img { width: 100%; height: auto; display: block; border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.3); }

.buttons { margin-top: 1.5rem; display: flex; gap: 1rem; }
.buttons a { padding: 0.75rem 1.5rem; border: 1px solid var(--border-color); border-radius: 8px; font-size: 1rem; transition: background 0.2s, color 0.2s; color: var(--text-primary); text-decoration: none; }
.buttons a:hover { background: var(--accent-primary); color: var(--bg-primary); border-color: var(--accent-primary); }
body.light-theme .buttons a:hover { color: var(--bg-primary); }

/* --- E-COMMERCE --- */
.store-layout { display: flex; gap: 24px; width: 100%; }
.product-grid { flex-grow: 1; }
.shopping-cart { width: 320px; flex-shrink: 0; background-color: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; padding: 1.5rem; height: fit-content; }
.shopping-cart h3 { font-size: 1.25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
#cart-items { display: flex; flex-direction: column; gap: 0.75rem; max-height: 300px; overflow-y: auto; margin-bottom: 1rem; }
.cart-item { display: flex; justify-content: space-between; align-items: center; font-size: 0.875rem; }
.remove-from-cart-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 1rem; margin-left: 0.5rem; }
.remove-from-cart-btn:hover { color: var(--accent-red); }
#cart-summary { border-top: 1px solid var(--border-color); padding-top: 1rem; margin-top: 1rem; }
#checkout-btn { width: 100%; margin-top: 1rem; }
.product-card { background-color: var(--bg-secondary); border-radius: 12px; border: 1px solid var(--border-color); padding: 1.5rem; display: flex; flex-direction: column; justify-content: space-between; }
.product-card h4 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.product-price { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin-bottom: 1rem; }
.add-to-cart-btn, .download-btn { width: 100%; }
.download-btn { background-color: var(--bg-secondary); border: 1px solid var(--border-color); color: var(--text-primary); }
.download-btn:hover { background-color: var(--bg-tertiary); }

/* --- MODALS --- */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.8); justify-content: center; align-items: center; animation: fadeIn 0.3s ease-out; }
.modal-content { background-color: var(--bg-secondary); padding: 30px; border-radius: 12px; border: 1px solid var(--border-color); max-width: 500px; width: 90%; box-shadow: 0 5px 15px rgba(0,0,0,0.5); position: relative; animation: slideInUp 0.3s ease-out; }
#modalTitle { margin-bottom: 1rem; font-size: 1.5rem; font-weight: 600; }
.close-button { position: absolute; top: 15px; right: 20px; font-size: 28px; cursor: pointer; color: var(--text-secondary); }
.close-button:hover { color: var(--text-primary); }
#modalButtons { display:flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.5rem; }

#pdfPreviewModal .modal-content { max-width: 90vw; max-height: 90vh; width: auto; height: auto; padding: 15px; display: flex; flex-direction: column; align-items: center; }
#pdfCanvasContainer { width: 100%; flex-grow: 1; display: flex; justify-content: center; align-items: center; overflow: auto; margin-bottom: 10px; }
#pdfCanvas { border: 1px solid var(--border-color); display: block; max-width: 100%; height: auto; }
#pdfControls button { background-color: var(--bg-tertiary); color: var(--text-primary); }
#pdfControls button:hover:not(:disabled) { background-color: #444; }

/* --- FOOTER --- */
footer { position: fixed; bottom: 0; right: 0; text-align: right; padding: 10px 20px; color: var(--text-secondary); font-size: 0.875rem; z-index: 100; pointer-events: none; }
footer a { color: var(--text-secondary); text-decoration: none; pointer-events: all;}
footer a:hover { text-decoration: underline; color: var(--text-primary); }

/* --- FINDER WINDOW --- */
.finder-window-wrapper { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90vw; height: 90vh; max-width: 1200px; max-height: 800px; border: 1px solid var(--finder-border-color); border-radius: 12px; background: var(--finder-bg-primary); overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 4px 20px rgba(0,0,0,0.4); transition: all 0.3s ease; z-index: 100; resize: both; min-width: 300px; min-height: 200px; color: var(--finder-text-primary); }
.finder-window-wrapper.fullscreen { top: 0 !important; left: 0 !important; transform: none !important; width: 100vw !important; height: 100vh !important; border-radius: 0 !important; }
.finder-titlebar { background: var(--finder-titlebar-bg); height: 32px; display: flex; align-items: center; padding: 0 10px; cursor: grab; flex-shrink: 0; border-bottom: 1px solid var(--finder-border-color); justify-content: flex-start; }
.finder-titlebar .buttons { display: flex; gap: 8px; }
.finder-circle { width: 12px; height: 12px; border-radius: 50%; }
.finder-circle.close { background: #ff5f57; }
.finder-circle.min { background: #ffbd2e; }
.finder-circle.max { background: #28c840; cursor: pointer; }
.finder-content { flex: 1; display: flex; overflow: hidden; }
.finder-sidebar { width: 220px; min-width: 150px; border-right: 1px solid var(--finder-border-color); background: var(--finder-bg-secondary); padding: 10px 0; overflow-y: auto; flex-shrink: 0; }
.finder-sidebar-item { padding: 8px 20px; font-size: 14px; color: var(--finder-text-primary); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finder-sidebar-item:hover { background: var(--finder-hover-bg); }
.finder-sidebar-item.active { background: var(--finder-active-bg); color: var(--finder-active-text); font-weight: 600; }
.finder-file-list { flex: 1; display: flex; flex-direction: column; overflow-y: auto; background: var(--finder-bg-primary); }
.finder-file-list .columns, .finder-file-list .row { display: grid; grid-template-columns: 3fr 1fr 1fr 1fr; padding: 10px 15px; border-bottom: 1px solid var(--finder-border-color); align-items: center; }
.finder-file-list .columns { background: var(--finder-bg-secondary); font-size: 12px; color: var(--finder-text-secondary); font-weight: 600; text-transform: uppercase; }
.finder-file-list .row { font-size: 14px; color: var(--finder-text-primary); cursor: pointer; }
.finder-file-list .row:hover { background: var(--finder-hover-bg); }
.finder-file-list .row.folder { font-weight: bold; color: var(--text-primary); }

/* --- RESPONSIVENESS --- */
@media (max-width: 992px) {
    .store-layout { flex-direction: column; }
    .shopping-cart { width: 100%; position: sticky; bottom: 0; border-radius: 8px 8px 0 0; }
}
@media (max-width: 768px) {
    #authWrapper { flex-direction: column; position: static; height: auto; }
    .login-left-panel, .login-right-panel { width: 100%; }
    header { flex-direction: column; height: auto; padding: 1rem; align-items: flex-start; }
    .header-actions { margin-left: 0; margin-top: 1rem; flex-wrap: wrap; }
    main { flex-direction: column; padding: 16px; }
    .hero { flex-direction: column-reverse; text-align: center; }
    .hero-text, .hero-image { max-width: 100%; }
    .buttons { justify-content: center; }
    .finder-window-wrapper { display: none !important; }

    /* Mobile adjustments for Submission Section */
    .submission-main-container {
        flex-direction: column;
        max-width: 100%;
        margin: 0;
    }
    .submission-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 1rem;
    }
    .submission-content {
        width: 100%;
        max-width: 100%;
        padding-left: 0;
        padding-top: 1.5rem;
    }
}

/* Homework Submission Specific Styles */
#submissionSection { /* Override previous flex-direction: column */
    display: flex; /* Ensure flex context for children */
    flex-direction: row; /* Default to row for desktop */
    gap: 2rem;
    max-width: 1200px; /* Increase max-width for better two-column display */
    margin: 0 auto;
    align-items: flex-start; /* Align content to the top */
}

.submission-main-container {
    display: flex;
    flex-direction: row; /* Default to row for desktop */
    width: 100%;
    gap: 2rem;
    align-items: flex-start;
}

.submission-sidebar {
    width: 280px; /* Fixed width for the sidebar */
    flex-shrink: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content; /* Adjust height to content */
    position: sticky; /* Keep sidebar visible when scrolling main content */
    top: 100px; /* Adjust based on header height */
}

.submission-content {
    flex-grow: 1; /* Takes remaining space */
    width: calc(100% - 280px - 2rem); /* Full width minus sidebar and gap */
    max-width: 900px; /* Max width for content readability */
    padding-left: 0; /* No extra padding here as main already has padding */
}

.assignment-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
}
.assignment-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.assignment-card p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.assignment-card .assignment-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
    gap: 0.5rem;
}
.assignment-submission-item {
    display: flex;
    flex-direction: column; /* Stack details and actions vertically */
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    align-items: flex-start; /* Align items to the start */
}
.assignment-submission-item:last-child {
    border-bottom: none;
}
.submission-detail {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.submission-actions button {
    margin-left: 0; /* Reset margin from general rules */
    margin-right: 0.5rem; /* Add margin between action buttons */
    padding: 6px 10px;
    font-size: 0.8rem;
}
.submission-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

#submissionsListContainer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}
.student-submission-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}
.student-submission-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.my-submissions-container {
    margin-top: 2rem;
}

#authWrapper {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  opacity: 1 !important;
  transition: opacity 0.5s ease-in-out;
  z-index: 1001;
}

.login-left-panel,
.login-right-panel {
  width: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.login-left-panel {
  background: var(--bg-primary);
  color: var(--text-primary);
  flex-direction: column;
  text-align: center;
}

.login-left-panel h1 {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.login-left-panel p {
  font-size: 1.25rem;
  color: var(--text-secondary);
}

.login-right-panel {
  background: var(--bg-secondary);
  flex-direction: column;
}


/* Materials scroll fix */
#materialsFinder{display:flex;gap:12px;overflow-x:auto;max-width:100%;padding-bottom:8px}
#materialsFinder .pane{flex:0 0 260px;max-height:400px;overflow-y:auto}
