/* True Pencil - Clean, Minimal CSS */

/* ============================================================================
   CSS Variables
   ============================================================================ */
:root {
    /* Brand colors from logo */
    --primary: #0d5c63;           /* Teal - pencil tip */
    --primary-dark: #094249;      /* Darker teal */
    --primary-light: #1a7a82;     /* Lighter teal */
    --secondary: #4a9d4a;         /* Green - pencil body */
    --accent: #f9bc2c;            /* Golden yellow - sun rays */
    --accent-light: #fcd570;      /* Light gold */

    /* Status colors */
    --success: #4a9d4a;           /* Green - matches logo */
    --warning: #f59e0b;           /* Amber */
    --danger: #dc3545;            /* Red */

    /* Warm neutral palette to complement logo */
    --light: #faf8f5;             /* Warm off-white */
    --dark: #2d3748;              /* Charcoal from logo text */
    --cream: #f5f0e6;             /* Logo background cream */

    /* Gray scale with warm undertones */
    --gray-50: #faf9f7;
    --gray-100: #f5f3f0;
    --gray-200: #e8e4df;
    --gray-300: #d4cfc7;
    --gray-400: #a8a29e;
    --gray-500: #78716c;
    --gray-600: #57534e;
    --gray-700: #44403c;
    --gray-800: #292524;
    --gray-900: #1c1917;

    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* ============================================================================
   Reset & Base
   ============================================================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}
main > .container {
    position: relative;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
    margin: 0 0 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================================================
   Layout
   ============================================================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Full-width pages — only main content stretches; header/footer stay readable */
.page-full-width main > .container {
    max-width: none;
}

.container-sm {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ============================================================================
   Header / Navigation
   ============================================================================ */
.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo:hover {
    text-decoration: none;
}

.logo-img {
    height: 48px;
    width: auto;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark);
    margin-left: 0.5rem;
}

.nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav a {
    color: var(--gray-600);
    font-weight: 500;
}

.nav a:hover,
.nav a.nav-active {
    color: var(--primary);
    text-decoration: none;
}

.nav a.btn-primary,
.nav a.btn-primary:hover {
    color: white;
}

/* ============================================================================
   Buttons
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.5;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

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

.btn-danger:hover {
    background: #c82333;
}

.btn-accent {
    background: var(--accent);
    color: var(--dark);
}

.btn-accent:hover {
    background: var(--accent-light);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

/* ============================================================================
   Cards
   ============================================================================ */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    margin: 0;
    font-size: 1.125rem;
}

/* ============================================================================
   Forms
   ============================================================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--gray-900);
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 92, 99, 0.15);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ============================================================================
   Alerts / Flash Messages
   ============================================================================ */
.flash-toast-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}
.flash-toast-container .flash-alert {
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 0;
    opacity: 0.95;
    text-align: center;
    max-width: 500px;
    width: auto;
    animation: flash-fade-in 0.3s ease;
}
@keyframes flash-fade-in {
    from { opacity: 0; transform: translateY(-0.5rem); }
    to   { opacity: 0.95; transform: translateY(0); }
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error,
.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ============================================================================
   Tables
   ============================================================================ */
.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* ============================================================================
   Badges
   ============================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.badge-accent {
    background: var(--accent);
    color: var(--dark);
}

/* ============================================================================
   AI Score Indicator
   ============================================================================ */
.score-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.score-bar {
    width: 60px;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    transition: width 0.3s ease;
}

/* Authenticity score: higher = better */
.score-good .score-bar-fill {
    background: var(--success);
}

.score-caution .score-bar-fill {
    background: var(--warning);
}

.score-concern .score-bar-fill {
    background: var(--danger);
}

/* Legacy classes (kept for compatibility) */
.score-low .score-bar-fill {
    background: var(--danger);
}

.score-medium .score-bar-fill {
    background: var(--warning);
}

.score-high .score-bar-fill {
    background: var(--success);
}

.score-value {
    font-weight: 600;
    font-size: 0.875rem;
}

/* ============================================================================
   Editor (Google Docs-like)
   ============================================================================ */
.editor-wrapper {
    padding: 0;
}

.editor-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.editor-toolbar {
    background: var(--gray-50);
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding-right: 0.75rem;
    border-right: 1px solid var(--gray-200);
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 0.375rem 0.5rem;
    cursor: pointer;
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    min-width: 32px;
    text-align: center;
    transition: all 0.1s ease;
}

.toolbar-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-200);
}

.toolbar-btn.active {
    background: var(--gray-200);
    border-color: var(--gray-300);
    color: var(--primary);
}

.toolbar-spacer {
    flex: 1;
}

.editor-save-status {
    font-size: 0.8125rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.editor-save-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.editor-save-status.saving .dot {
    background: var(--warning);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.editor-body {
    padding: 56px 64px;
    min-height: 900px;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--gray-900);
    outline: none;
    cursor: text;
    border: none;
    resize: vertical;
    width: 100%;
}

.editor-body::placeholder {
    color: var(--gray-400);
    font-style: italic;
}

.editor-body:focus {
    outline: none;
}

.editor-footer {
    background: var(--gray-50);
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--gray-500);
}

/* ============================================================================
   QR Code
   ============================================================================ */
.qr-container {
    text-align: center;
    padding: 1.5rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.qr-code {
    max-width: 200px;
    margin: 0 auto 1rem;
}

.qr-code img {
    width: 100%;
    height: auto;
}

.share-link {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.share-link input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: var(--gray-50);
}

/* ============================================================================
   Landing Page
   ============================================================================ */
.home-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - 130px);
}

.hero {
    padding: 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--dark);
}

.hero h1 span {
    color: var(--primary);
}

.hero p {
    font-size: 1.25rem;
    color: var(--gray-600);
    max-width: 600px;
    margin: 0 auto 0.75rem;
}

/* Accent highlight for emphasis */
.highlight {
    background: linear-gradient(180deg, transparent 60%, var(--accent-light) 60%);
    padding: 0 4px;
}

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 1.5rem 0;
}

.feature {
    text-align: center;
    padding: 1rem;
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.feature-icon.no-robot {
    position: relative;
    display: inline-block;
}

.feature-icon.no-robot .no-slash {
    position: absolute;
    inset: 0;
}

.feature-icon.no-robot .no-slash::before,
.feature-icon.no-robot .no-slash::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3.5px;
    height: 95%;
    background: var(--danger);
    border-radius: 2px;
}

.feature-icon.no-robot .no-slash::before {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.feature-icon.no-robot .no-slash::after {
    transform: translate(-50%, -50%) rotate(45deg);
}

.feature h3 {
    margin-bottom: 0.5rem;
}

.feature p {
    color: var(--gray-600);
}

/* ============================================================================
   Dashboard
   ============================================================================ */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.75rem 0;
}

.assignment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.assignment-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
    transition: box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
}

.assignment-card:hover {
    box-shadow: var(--shadow-md);
}

.assignment-card h3 {
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.assignment-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.assignment-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-200);
    margin-top: auto;
}

/* ============================================================================
   Submission Detail
   ============================================================================ */
.submission-content {
    background: var(--gray-50);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    font-family: Georgia, serif;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow-x: auto;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.metric-item {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: var(--border-radius);
}

.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
}

.reasons-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.reasons-list li {
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reasons-list li::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--warning);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
}

/* ============================================================================
   Auth Pages
   ============================================================================ */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 130px);
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.auth-card h1 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.auth-card .form-group {
    margin-bottom: 0.875rem;
}

.auth-card .form-label {
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-600);
    font-size: 0.9375rem;
}

/* ============================================================================
   Utilities
   ============================================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ============================================================================
   Responsive
   ============================================================================ */
/* ============================================================================
   Footer
   ============================================================================ */
.footer {
    background: var(--dark);
    color: var(--gray-400);
    padding: 0.5rem 0;
    margin-top: auto;
}

.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-copy {
    font-size: 0.75rem;
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-links a {
    color: var(--gray-400);
    font-size: 0.75rem;
}

.footer-links a:hover {
    color: white;
    text-decoration: none;
}

/* ============================================================================
   Legal Pages (Privacy, Terms)
   ============================================================================ */
.legal-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0 4rem;
}

.legal-page h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.legal-updated {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.legal-page section {
    margin-bottom: 2rem;
}

.legal-page h2 {
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.legal-page h3 {
    font-size: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--gray-700);
}

.legal-page ul {
    margin: 0.5rem 0 1rem;
    padding-left: 1.5rem;
}

.legal-page li {
    margin-bottom: 0.5rem;
}

.legal-page ul ul {
    margin-top: 0.5rem;
}

/* FAQ Items */
.faq-item {
    margin-bottom: 1.5rem;
}

.faq-item h3 {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.faq-item p {
    color: var(--gray-600);
    margin-bottom: 0;
}

/* ============================================================================
   Form Grid
   ============================================================================ */
.form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ============================================================================
   Editor Focus Glow
   ============================================================================ */
.editor-container:focus-within {
    box-shadow: var(--shadow-lg), 0 0 0 2px rgba(13, 92, 99, 0.1);
}

/* ============================================================================
   Word Count Low Hint
   ============================================================================ */
.word-count-low {
    color: var(--warning);
}
.word-count-over {
    color: var(--danger);
    font-weight: 600;
}

/* ============================================================================
   FAQ Accordion
   ============================================================================ */
.faq-item summary {
    font-weight: 600;
    cursor: pointer;
    padding: 0.75rem 0;
    list-style: none;
}
.faq-item summary::-webkit-details-marker {
    display: none;
}
.faq-item summary::before {
    content: "\25B6";
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}
.faq-item[open] summary::before {
    transform: rotate(90deg);
}
.faq-item summary:hover {
    color: var(--primary);
}
.faq-item .faq-answer {
    padding: 0 0 0.75rem 1.25rem;
}

/* ============================================================================
   Assignment Detail Responsive Grid
   ============================================================================ */
.assignment-detail-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
}

/* ============================================================================
   Alternating Insight Rows
   ============================================================================ */
.insight-row:nth-child(even) {
    background: var(--gray-50);
    margin: 0 -1.5rem;
    padding: 0.75rem 1.5rem;
}

/* ============================================================================
   View Toggle (Plots / Table switcher)
   ============================================================================ */
.view-toggle {
    display: flex;
    gap: 0;
    flex-shrink: 0;
}
.toggle-btn {
    padding: 0.4rem 1rem;
    border: 1px solid var(--gray-300);
    background: white;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.15s ease;
    white-space: nowrap;
}
.toggle-btn:first-child {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    border-right: none;
}
.toggle-btn:not(:first-child):not(:last-child) {
    border-radius: 0;
    border-right: none;
}
.toggle-btn:last-child {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}
.toggle-btn:hover {
    background: var(--gray-50);
    color: var(--gray-800);
}
.toggle-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
}

/* ============================================================================
   Comparison / History Tables — Outlier Cell Highlights
   ============================================================================ */
.cell-warning {
    background: #fef3c7 !important;
}
.cell-outlier {
    background: #fee2e2 !important;
}

/* Summary cards row */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.summary-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    text-align: center;
}
.summary-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}
.summary-card-label {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Comparison table with frozen first column */
.compare-table-wrapper {
    overflow: auto;
    position: relative;
    border-radius: var(--border-radius);
}
.compare-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.compare-table th,
.compare-table td {
    padding: 0.625rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
    font-size: 0.875rem;
}
.compare-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 2;
}
.compare-table th:hover {
    background: var(--gray-200);
}
.compare-table th .sort-arrow {
    margin-left: 0.25rem;
    font-size: 0.625rem;
    opacity: 0.4;
}
.compare-table th .sort-arrow.active {
    opacity: 1;
}
.compare-table tbody tr:hover {
    background: var(--gray-50);
}
.compare-table tbody tr {
    cursor: pointer;
}
/* Frozen first column */
.compare-table th:first-child,
.compare-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    background: white;
    border-right: 2px solid var(--gray-200);
    min-width: 160px;
    text-align: left;
}
.compare-table th:first-child {
    background: var(--gray-50);
    z-index: 4;
}
.compare-table tbody tr:hover td:first-child {
    background: var(--gray-50);
}

/* Bar chart container */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 1.5rem;
}

/* Clickable bar chart link styling */
.compare-bar-link {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
}
.compare-bar-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ============================================================================
   Password Toggle
   ============================================================================ */
.password-wrapper {
    position: relative;
}
.password-wrapper .form-input {
    padding-right: 3.5rem;
}
.password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
}
.password-toggle:hover {
    color: var(--primary);
}

/* ============================================================================
   Password Strength
   ============================================================================ */
.password-strength {
    height: 3px;
    border-radius: 2px;
    margin-top: 0.375rem;
    background: var(--gray-200);
    overflow: hidden;
    transition: opacity 0.2s;
}
.password-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s, background-color 0.3s;
}

/* ============================================================================
   Submit Page — Full-Viewport Writing Layout
   ============================================================================ */
.submit-page {
    overflow: hidden;
    height: 100vh;
}
.submit-page .footer {
    display: none;
}
.submit-page main {
    overflow: hidden;
}
.submit-page main > .container {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.submit-page-content {
    padding-top: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.submit-page #editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.submit-page #editor-section > form {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.editor-fill {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.editor-fill .editor-container {
    flex: 1;
    min-height: 0;
}
.submit-page .editor-body {
    flex: 1;
    min-height: 0 !important;
    overflow-y: auto;
    resize: none;
}
.submit-page .editor-footer {
    flex-shrink: 0;
}
/* Instructions — scrollable when long */
.submit-instructions[open] p {
    max-height: 8rem;
    overflow-y: auto;
}

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 768px) {
    .assignment-detail-grid {
        grid-template-columns: 1fr;
    }
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }

    .footer-row {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .form-grid-2col {
        grid-template-columns: 1fr;
    }
    .editor-body {
        padding: 24px;
        min-height: 500px;
    }
    .submit-page .editor-body {
        min-height: 0 !important;
        padding: 24px;
    }
    .editor-wrapper {
        padding: 0;
    }
    .editor-footer {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
        font-size: 0.75rem;
    }
}
