/* Common styles shared across all pages */

/* CSS Variables - unified palette */
:root {
    --bg: #f5f1eb;
    --paper: #fff;
    --ink: #3d2e24;
    --muted: #8b7355;
    --accent: #3d2e24;
    --border: #e0d8cf;
    --shadow: rgba(61, 46, 36, 0.08);
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

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

/* Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}

/* Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .container {
        padding: 0.25rem;
    }
}

/* Navigation */
.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    margin-bottom: 0.25rem;
}

.nav-left {
    display: flex;
    gap: 1.5rem;
    padding-left: 0.5rem;
}

.nav-link,
.nav-text-link {
    font-size: 0.9rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-text-link:hover {
    color: var(--ink);
}

.nav-link.active,
.nav-text-link.active,
.nav-current {
    font-size: 0.9rem;
    color: var(--ink);
    font-weight: 600;
}

/* Buttons - unified style based on read.css */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px var(--shadow);
}

.action-btn:hover:not(:disabled) {
    background: #faf8f5;
    color: var(--ink);
    border-color: var(--accent);
    box-shadow: 0 2px 4px rgba(61, 46, 36, 0.12);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.action-btn svg {
    flex-shrink: 0;
}

/* Secondary button - same style */
.secondary-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px var(--shadow);
}

.secondary-btn:hover:not(:disabled) {
    background: #faf8f5;
    color: var(--ink);
    border-color: var(--accent);
    box-shadow: 0 2px 4px rgba(61, 46, 36, 0.12);
}

.secondary-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

/* Icon button */
.icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: #faf8f5;
    border-color: var(--accent);
}

/* Logout button */
.logout-text-btn,
.logout-link {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.5rem 0;
    margin-top: 1rem;
    text-align: left;
}

.logout-text-btn:hover,
.logout-link:hover {
    color: var(--ink);
}

/* Form elements */
.control-select {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: inherit;
    background: var(--paper);
    cursor: pointer;
    box-shadow: 0 1px 2px var(--shadow);
    transition: all 0.2s;
}

.control-select:hover {
    background: #faf8f5;
    box-shadow: 0 2px 4px rgba(61, 46, 36, 0.1);
}

.control-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Sections */
.input-section {
    border: 1px solid var(--border);
    padding: 0.5rem;
    margin-bottom: 1rem;
    background: var(--paper);
    box-shadow: 0 1px 2px var(--shadow);
    border-radius: 4px;
}

.results-section {
    border: 1px solid var(--border);
    padding: 1rem;
    background: var(--paper);
    box-shadow: 0 2px 4px var(--shadow);
    border-radius: 4px;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1rem;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.85rem;
    border-radius: 4px;
    max-width: 300px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(61, 46, 36, 0.2);
}

.toast.success {
    background: #2d5a27;
}

.toast.error {
    background: #8b2020;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Login overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('core.jpg') center center / cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-box {
    background: white;
    padding: 32px;
    text-align: center;
}

.login-logo,
.login-box h2,
.login-box p {
    display: none;
}

.login-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: white;
    border: none;
    color: #333;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
    background: #f8f8f8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-close {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
