/* ===================================================================
   Route Wiki — Main Stylesheet
   Theme: Utilitarian / USPS-inspired with modern touch
   =================================================================== */

:root {
    --primary:      #1a4480;
    --primary-dark:  #0f2d52;
    --primary-light: #4a7fc1;
    --accent:       #d83933;
    --accent-light: #f5c6c4;
    --bg:           #f5f6f7;
    --sidebar-bg:   #eef0f2;
    --card-bg:      #ffffff;
    --text:         #1b1b1b;
    --text-light:   #ffffff;
    --muted:        #6b7280;
    --border:       #d1d5db;
    --hover-bg:     #e8eaed;
    --active-bg:    #dde3ea;
    --success:      #16a34a;
    --danger:       #dc2626;
    --warning:      #f59e0b;
    --radius:       8px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.06);
    --shadow:       0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg:    0 8px 30px rgba(0,0,0,0.12);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--primary); }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }

/* ---- Navigation ---- */
.main-nav {
    background: var(--primary-dark);
    color: white;
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-inner {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}
.nav-brand {
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 2rem;
}
.brand-icon { font-size: 1.3rem; }
.nav-links {
    display: flex;
    gap: 0.25rem;
}
.nav-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.nav-link:hover {
    background: rgba(255,255,255,0.12);
    color: white;
}
.nav-icon { font-size: 1rem; }
.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.user-badge {
    background: rgba(255,255,255,0.15);
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    color: white;
}
.logout-link {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6) !important;
}
.logout-link:hover { color: white !important; }

/* ---- Flash messages ---- */
.flash-container {
    position: fixed;
    top: 64px;
    right: 1rem;
    z-index: 600;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
}
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
.flash-success { background: #dcfce7; color: #166534; border-left: 4px solid #16a34a; }
.flash-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid #dc2626; }
.flash-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #2563eb; }
.flash-close {
    background: none; border: none; font-size: 1.2rem; cursor: pointer;
    color: inherit; opacity: 0.5; margin-left: 0.75rem;
}
.flash-close:hover { opacity: 1; }

/* ---- Main Content ---- */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
}

/* ---- Auth Pages ---- */
.auth-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}
.auth-hero {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary) 60%, var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}
.hero-content { max-width: 420px; }
.hero-icon { font-size: 3.5rem; display: block; margin-bottom: 1rem; }
.hero-content h1 { font-size: 2.2rem; margin: 0 0 0.5rem; }
.hero-sub {
    font-size: 1.15rem;
    opacity: 0.9;
    margin: 0 0 1.5rem;
    font-weight: 300;
}
.hero-desc {
    font-size: 0.95rem;
    opacity: 0.75;
    line-height: 1.6;
}
.auth-form-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg);
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.auth-card-wide { max-width: 500px; }
.auth-card h2 { margin: 0 0 1.5rem; }
.auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.88rem;
    color: var(--muted);
}

@media (max-width: 768px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-hero { padding: 2rem; min-height: auto; }
    .hero-desc { display: none; }
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.92rem;
    font-family: inherit;
    background: white;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,68,128,0.12);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-row-3 {
    grid-template-columns: 2fr 1fr 1fr;
}
.form-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.form-page {
    display: flex;
    justify-content: center;
    padding: 2rem;
}
.form-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 560px;
}
.form-card h2 { margin: 0 0 0.25rem; }
.form-sub { color: var(--muted); font-size: 0.9rem; margin: 0 0 1.5rem; }

/* Office toggle radio cards */
.office-toggle {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.radio-card {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.88rem;
}
.radio-card:has(input:checked) {
    border-color: var(--primary);
    background: rgba(26,68,128,0.04);
}
.radio-card input[type="radio"] { margin: 0; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    line-height: 1.4;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--hover-bg); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.btn-full { width: 100%; justify-content: center; }

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.5rem 2rem 0;
}
.page-header h1 { margin: 0; }
.subtitle { color: var(--muted); font-size: 0.92rem; margin: 0.25rem 0 0; }

/* ---- Breadcrumb ---- */
.breadcrumb {
    padding: 1rem 2rem 0;
    font-size: 0.82rem;
    color: var(--muted);
}
.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.bc-sep { margin: 0 0.35rem; }

/* ---- Office Grid ---- */
.office-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    padding: 1.5rem 2rem;
}
.office-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    display: block;
}
.office-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}
.office-card-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26,68,128,0.15);
}
.office-card-icon { font-size: 1.8rem; margin-bottom: 0.5rem; }
.office-card h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.office-location { font-size: 0.85rem; color: var(--muted); margin: 0 0 0.75rem; }
.office-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.route-count {
    font-size: 0.82rem;
    color: var(--muted);
}
.badge {
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}
.badge-active {
    background: rgba(26,68,128,0.1);
    color: var(--primary);
}

/* ---- Route List ---- */
.route-list {
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.route-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s;
}
.route-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow);
}
.route-card-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.route-icon { font-size: 1.3rem; }
.route-card h3 { margin: 0; font-size: 1rem; }
.route-desc { margin: 0.15rem 0 0; font-size: 0.82rem; color: var(--muted); }
.route-card-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.route-creator { font-size: 0.78rem; color: var(--muted); }
.route-arrow { font-size: 1.2rem; color: var(--muted); }

/* ---- Empty States ---- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}
.empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state h2 { margin: 0 0 0.25rem; }
.empty-state p { color: var(--muted); margin: 0 0 1.5rem; }

/* ---- Utilities ---- */
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.88rem; }
