/* Digital Blue Book - RCNR Branded CSS */

/* ========== RCNR PALETTE ========== */
:root {
    /* Core RCNR Palette - Kraken/Deep Sea inspired */
    --deep-sea: #001628;
    --midnight: #000C17;
    --navy: #001f3f;

    /* Ice/Cyan Accent Colors */
    --ice: #99D9D9;
    --ice-muted: #68A2B9;
    --ice-glow: rgba(153, 217, 217, 0.15);
    --ice-subtle: rgba(153, 217, 217, 0.08);
    --ice-border: rgba(153, 217, 217, 0.25);

    /* Neutrals */
    --white: #FAFAFA;
    --white-pure: #FFFFFF;
    --gray-100: #E8EAED;
    --gray-200: #D2D5D9;
    --gray-400: #9AA0A6;
    --gray-600: #5F6368;
    --gray-800: #3C4043;

    /* Status Colors */
    --success: #2ed573;
    --success-bg: rgba(46, 213, 115, 0.15);
    --error: #ff6b6b;
    --error-bg: rgba(255, 107, 107, 0.15);
    --warning: #ffc107;
    --warning-bg: rgba(255, 193, 7, 0.15);

    /* Legacy color mappings for compatibility */
    --blue-primary: var(--ice-muted);
    --blue-light: var(--ice);
    --blue-dark: var(--deep-sea);
    --gray-light: var(--deep-sea);
    --gray-medium: var(--ice-border);
    --gray-dark: var(--gray-400);
    --red: var(--error);
    --green: var(--success);
    --yellow: var(--warning);
}

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

body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--midnight) 0%, var(--deep-sea) 50%, var(--navy) 100%);
    color: var(--white);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== RCNR NAVIGATION ========== */
.rcnr-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0.75rem 1.5rem;
    background: var(--midnight);
    border-bottom: 1px solid var(--ice-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rcnr-nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--white);
}

.rcnr-nav-logo img,
.rcnr-nav-logo svg {
    height: 32px;
    width: auto;
}

.rcnr-nav-logo-text {
    font-weight: 600;
    font-size: 1rem;
    color: var(--ice);
    letter-spacing: 0.05em;
}

.rcnr-nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rcnr-nav-link {
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.rcnr-nav-link:hover {
    color: var(--white);
    background: var(--ice-subtle);
}

/* ========== RCNR FOOTER ========== */
.rcnr-footer {
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--ice-border);
    background: var(--midnight);
    margin-top: auto;
}

.rcnr-footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--gray-400);
    font-size: 0.85rem;
}

.rcnr-footer-logo {
    height: 20px;
    width: auto;
    opacity: 0.7;
}

.rcnr-footer a {
    color: var(--ice-muted);
    text-decoration: none;
    transition: color 0.3s;
}

.rcnr-footer a:hover {
    color: var(--ice);
}

/* Layout */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 5rem; /* Account for fixed nav */
}

.container-wide {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 5rem;
}

/* Cards */
.card {
    background: var(--ice-subtle);
    border: 1px solid var(--ice-border);
    border-radius: 0.75rem;
    padding: 2rem;
    backdrop-filter: blur(10px);
}

.card:hover {
    border-color: var(--ice-muted);
}

/* Headers */
.header {
    background: var(--deep-sea);
    color: var(--white);
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--ice-border);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ice);
}

/* Typography */
h1, h2, h3 {
    margin-bottom: 1rem;
    color: var(--white);
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
    color: var(--ice);
}

p {
    margin-bottom: 1rem;
    color: var(--gray-400);
}

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

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

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

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

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--midnight);
    border: 1px solid var(--ice-border);
    border-radius: 0.5rem;
    font-size: 1rem;
    color: var(--white);
    transition: all 0.3s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--ice);
    box-shadow: 0 0 0 3px var(--ice-glow);
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-600);
}

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

/* Checkbox styling */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-top: 0.25rem;
    cursor: pointer;
    accent-color: var(--ice);
}

.checkbox-label span {
    font-weight: 500;
    color: var(--gray-400);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
}

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

.btn-primary {
    background: var(--ice);
    color: var(--deep-sea);
}

.btn-primary:hover {
    background: var(--white);
    box-shadow: 0 8px 20px rgba(153, 217, 217, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--ice);
    border: 1px solid var(--ice-border);
}

.btn-secondary:hover {
    background: var(--ice-subtle);
    border-color: var(--ice);
}

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

.btn-danger:hover {
    background: #ff5252;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.3);
}

.btn-success {
    background: var(--success);
    color: var(--deep-sea);
}

.btn-success:hover {
    background: #58e892;
    box-shadow: 0 8px 20px rgba(46, 213, 115, 0.3);
}

.btn-downloaded {
    background: var(--ice-muted);
    color: var(--deep-sea);
}

.btn-downloaded:hover {
    background: var(--ice);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.25rem;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(46, 213, 115, 0.3);
}

.alert-info {
    background: var(--ice-glow);
    color: var(--ice);
    border: 1px solid var(--ice-border);
}

/* Privacy notice */
.privacy-notice {
    font-size: 0.8rem;
    color: var(--gray-400);
    text-align: center;
    margin: 1rem 0;
    padding: 0.5rem;
}

.privacy-notice strong {
    color: var(--ice-muted);
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Center content */
.center {
    text-align: center;
}

/* Logo/Brand */
.brand {
    text-align: center;
    margin-bottom: 2rem;
}

.brand-logo {
    width: 80px;
    height: auto;
    margin-bottom: 1rem;
}

.brand h1 {
    color: var(--ice);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
}

.brand p {
    color: var(--gray-400);
    font-size: 1rem;
}

/* Code display */
.code-display {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    background: var(--midnight);
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
    letter-spacing: 2px;
    font-weight: 600;
    color: var(--ice);
    border: 1px solid var(--ice-border);
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-waiting {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-lobby {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-writing {
    background: var(--ice-glow);
    color: var(--ice);
}

.badge-submitted {
    background: var(--success-bg);
    color: var(--success);
}

.badge-extra-time {
    background: var(--ice-glow);
    color: var(--ice);
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

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

th {
    background: var(--ice-subtle);
    font-weight: 600;
    color: var(--ice);
}

tr:hover {
    background: var(--ice-subtle);
}

/* Student list */
.student-list {
    list-style: none;
}

.student-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--ice-border);
}

.student-item:last-child {
    border-bottom: none;
}

.student-info {
    flex-grow: 1;
}

.student-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--white);
}

.student-meta {
    font-size: 0.875rem;
    color: var(--gray-400);
}

/* Assignment cards */
.assignment-card {
    background: var(--ice-subtle);
    border: 1px solid var(--ice-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s;
}

.assignment-card:hover {
    border-color: var(--ice-muted);
    background: var(--ice-glow);
}

.assignment-card h3 {
    margin-bottom: 0.5rem;
    color: var(--white);
}

.assignment-card p {
    color: var(--gray-400);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.assignment-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Timer */
.timer {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--ice);
    font-family: 'Courier New', monospace;
    background: var(--ice-subtle);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--ice-border);
}

.timer.warning {
    color: var(--warning);
    background: var(--warning-bg);
    border-color: var(--warning);
    animation: pulse 1s ease-in-out infinite;
}

.timer.danger {
    color: var(--error);
    background: var(--error-bg);
    border-color: var(--error);
    animation: pulse 0.5s ease-in-out infinite;
}

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

/* Fullscreen entry overlay */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--midnight);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.fullscreen-prompt {
    background: var(--deep-sea);
    border: 1px solid var(--ice-border);
    border-radius: 0.75rem;
    padding: 3rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.fullscreen-prompt h2 {
    color: var(--ice);
    margin-bottom: 1rem;
}

.fullscreen-prompt p {
    color: var(--gray-400);
    margin-bottom: 1.5rem;
}

.fullscreen-prompt .warning-text {
    color: var(--warning);
    font-size: 0.9rem;
    background: var(--warning-bg);
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Fullscreen editor specific */
.editor-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--midnight);
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--deep-sea);
    color: var(--white);
    border-bottom: 1px solid var(--ice-border);
}

.editor-header h2 {
    color: var(--ice);
    margin: 0;
    font-size: 1.25rem;
}

.editor-prompt {
    padding: 1rem 2rem;
    background: var(--ice-subtle);
    border-bottom: 1px solid var(--ice-border);
}

.editor-prompt p {
    margin: 0;
    line-height: 1.6;
    color: var(--white);
}

.editor-prompt .prompt-text {
    margin: 0;
    line-height: 1.6;
    color: var(--white);
    white-space: pre-wrap;  /* Preserves newlines and spaces from the prompt */
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: #e0e0e0;
    border-color: #999;
}

.toolbar-btn:active {
    background: #d0d0d0;
}

.toolbar-select {
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
}

.toolbar-color {
    width: 32px;
    height: 32px;
    padding: 2px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #ccc;
    margin: 0 0.5rem;
}

.editor-main {
    flex-grow: 1;
    padding: 0;
    overflow: auto;
    background: var(--white-pure);
}

.editor-content {
    width: 100%;
    min-height: 100%;
    padding: 2rem;
    font-size: 1.125rem;
    line-height: 1.8;
    font-family: Georgia, 'Times New Roman', serif;
    outline: none;
    background: transparent;
    color: #333;
    box-sizing: border-box;
}

.editor-content:empty:before {
    content: attr(data-placeholder);
    color: #999;
    pointer-events: none;
}

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

/* Keep old textarea styles for backwards compatibility */
.editor-textarea {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    font-size: 1.125rem;
    line-height: 1.8;
    font-family: Georgia, 'Times New Roman', serif;
    outline: none;
    background: transparent;
    color: #333;
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--deep-sea);
    border-top: 1px solid var(--ice-border);
}

.word-count {
    color: var(--gray-400);
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.3s;
}

.word-count.target-close {
    background: var(--warning-bg);
    color: var(--warning);
}

.word-count.target-reached {
    background: var(--success-bg);
    color: var(--success);
}

/* Sync status indicator */
.sync-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    color: var(--gray-400);
    transition: all 0.3s;
}

.sync-status.syncing {
    color: var(--ice);
}

.sync-status.synced {
    color: var(--success);
}

.sync-status.error {
    color: var(--error);
    background: var(--error-bg);
    animation: pulse 1s ease-in-out infinite;
}

/* Modal/Dialog */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 12, 23, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--deep-sea);
    border: 1px solid var(--ice-border);
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal h3 {
    margin-bottom: 1rem;
    color: var(--white);
}

.modal p {
    margin-bottom: 1.5rem;
    color: var(--gray-400);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Large modal for essay viewer */
.modal-large {
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    text-align: left;
}

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

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--white);
}

.essay-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--gray-400);
}

.essay-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.essay-viewer {
    flex: 1;
    overflow-y: auto;
    background: var(--white-pure);
    color: #333;
    padding: 1.5rem;
    border-radius: 0.5rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1rem;
    line-height: 1.8;
    min-height: 300px;
    max-height: 50vh;
    margin-bottom: 1rem;
}

.essay-viewer.purged {
    color: var(--gray-400);
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Help sections in modals */
.help-section {
    margin-bottom: 1.5rem;
    text-align: left;
}

.help-section h4 {
    color: var(--ice);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.help-section ol {
    color: var(--gray-400);
    padding-left: 1.5rem;
    margin: 0;
}

.help-section li {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-400);
}

.empty-state h3 {
    color: var(--gray-400);
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--gray-400);
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--ice-border);
    border-top-color: var(--ice);
    border-radius: 50%;
    animation: spin 0.8s ease infinite;
}

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

/* Utility */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Submitted screen */
.submitted-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    padding: 2rem;
}

.submitted-screen .checkmark {
    width: 80px;
    height: 80px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(46, 213, 115, 0.3);
}

.submitted-screen .checkmark::after {
    content: '✓';
    color: var(--deep-sea);
    font-size: 3rem;
}

/* Link styling */
a {
    color: var(--ice);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--white);
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
        padding-top: 4.5rem;
    }

    .card {
        padding: 1.5rem;
    }

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

    .btn-large {
        padding: 0.875rem 1.5rem;
        font-size: 1.125rem;
    }

    .editor-header {
        padding: 0.75rem 1rem;
    }

    .editor-prompt {
        padding: 0.75rem 1rem;
    }

    .editor-main {
        padding: 1rem;
    }

    .editor-footer {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .rcnr-nav {
        padding: 0.5rem 1rem;
    }

    .rcnr-nav-logo-text {
        display: none;
    }
}
