/* Pathfinder Club Inventory - Color Palette from flag */
:root {
    --blue:       #1B5299;
    --blue-dark:  #103570;
    --blue-light: #2E6FC4;
    --red:        #C0272D;
    --gold:       #F5A623;
    --gold-light: #FFC85A;
    --white:      #FFFFFF;
    --gray-light: #F4F6F9;
    --gray:       #DEE2E8;
    --gray-dark:  #6B7280;
    --text:       #1A1A2E;
    --good:       #27AE60;
    --fair:       #F39C12;
    --repair:     #E74C3C;
    --missing:    #8E44AD;
}

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

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--gray-light);
    color: var(--text);
    font-size: 14px;
}

/* ── Header ── */
.site-header {
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, var(--blue-light) 100%);
    color: var(--white);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.site-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .5px;
}
.site-header .logo-emblem {
    width: 40px; height: 40px;
    background: var(--gold);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    box-shadow: 0 0 0 3px var(--gold-light);
}
.site-header nav { display: flex; gap: 8px; align-items: center; }
.site-header nav a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    transition: background .2s;
}
.site-header nav a:hover { background: rgba(255,255,255,.15); color: var(--white); }
.site-header nav a.active { background: var(--gold); color: var(--blue-dark); font-weight: 600; }
.site-header nav .btn-logout {
    background: var(--red);
    color: var(--white);
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    transition: background .2s;
}
.site-header nav .btn-logout:hover { background: #a01f24; }

/* ── Main layout ── */
.container { max-width: 1300px; margin: 0 auto; padding: 24px 20px; }

/* ── Login page ── */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(160deg, var(--blue-dark) 0%, var(--blue) 50%, var(--blue-light) 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    text-align: center;
}
.login-card .emblem {
    width: 80px; height: 80px;
    background: var(--blue);
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px;
    box-shadow: 0 0 0 6px var(--gold);
}
.login-card h1 { color: var(--blue-dark); font-size: 22px; margin-bottom: 4px; }
.login-card .subtitle { color: var(--gray-dark); font-size: 13px; margin-bottom: 32px; }
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--blue-dark); font-size: 13px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color .2s;
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
}
.form-group textarea { resize: vertical; min-height: 70px; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: all .2s;
    white-space: nowrap;
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-gold { background: var(--gold); color: var(--blue-dark); }
.btn-gold:hover { background: var(--gold-light); }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover { background: #a01f24; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-outline {
    background: transparent;
    border: 2px solid var(--blue);
    color: var(--blue);
}
.btn-outline:hover { background: var(--blue); color: var(--white); }

/* ── Alert ── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
}
.alert-error { background: #FDECEC; color: var(--red); border-left: 4px solid var(--red); }
.alert-success { background: #EAFAF1; color: #1E8449; border-left: 4px solid var(--good); }
.alert-info { background: #EBF5FB; color: var(--blue); border-left: 4px solid var(--blue); }

/* ── Dashboard year cards ── */
.year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 24px;
}
.year-card {
    background: var(--white);
    border-radius: 12px;
    padding: 28px 24px;
    border: 2px solid var(--gray);
    text-align: center;
    transition: border-color .2s, box-shadow .2s;
}
.year-card:hover { border-color: var(--blue); box-shadow: 0 4px 16px rgba(27,82,153,.15); }
.year-card .year-number { font-size: 42px; font-weight: 800; color: var(--blue); line-height: 1; }
.year-card .year-meta { color: var(--gray-dark); font-size: 12px; margin: 8px 0 20px; }
.year-card .btn { width: 100%; justify-content: center; }
.new-year-card {
    border-style: dashed;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    cursor: pointer; min-height: 160px;
    color: var(--gray-dark);
    transition: all .2s;
    text-decoration: none;
}
.new-year-card:hover { border-color: var(--gold); color: var(--blue); background: #fffbf0; }
.new-year-card .plus { font-size: 36px; margin-bottom: 8px; }

/* ── Page toolbar ── */
.page-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-toolbar h2 { font-size: 20px; color: var(--blue-dark); }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Inventory table ── */
.inventory-section { margin-bottom: 32px; }
.category-header {
    background: linear-gradient(90deg, var(--blue-dark), var(--blue));
    color: var(--white);
    padding: 10px 16px;
    border-radius: 8px 8px 0 0;
    font-size: 15px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: space-between;
}
.category-header .cat-icon { margin-right: 8px; }

table.inventory {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}
table.inventory thead th {
    background: var(--blue-light);
    color: var(--white);
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}
table.inventory tbody tr { border-bottom: 1px solid var(--gray); }
table.inventory tbody tr:last-child { border-bottom: none; }
table.inventory tbody tr:hover { background: #F0F5FF; }
table.inventory tbody td { padding: 10px 14px; vertical-align: middle; }
table.inventory .col-name { font-weight: 600; }
table.inventory .col-qty { text-align: center; font-weight: 700; font-size: 15px; color: var(--blue); }
table.inventory .col-actions { text-align: right; white-space: nowrap; }
table.inventory .no-items td {
    text-align: center; color: var(--gray-dark);
    padding: 20px; font-style: italic;
}

/* ── Condition badges ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.badge-good    { background: #EAFAF1; color: var(--good); }
.badge-fair    { background: #FEF9E7; color: #B7770D; }
.badge-repair  { background: #FDECEC; color: var(--red); }
.badge-missing { background: #F5EEF8; color: var(--missing); }

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--white);
    border-radius: 16px;
    padding: 32px;
    width: 100%; max-width: 500px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    position: relative;
}
.modal h3 {
    color: var(--blue-dark);
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gold);
}
.modal-close {
    position: absolute; top: 16px; right: 16px;
    background: none; border: none; font-size: 22px;
    cursor: pointer; color: var(--gray-dark);
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: background .2s;
}
.modal-close:hover { background: var(--gray-light); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── Users table ── */
table.users-table {
    width: 100%; border-collapse: collapse;
    background: var(--white);
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
table.users-table th {
    background: var(--blue);
    color: var(--white);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
table.users-table td { padding: 12px 16px; border-bottom: 1px solid var(--gray); }
table.users-table tr:last-child td { border-bottom: none; }
.role-badge { }
.role-admin { color: var(--red); font-weight: 700; }
.role-leader { color: var(--blue); font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .site-header { flex-direction: column; height: auto; padding: 12px; gap: 8px; }
    .site-header nav { flex-wrap: wrap; justify-content: center; }
    table.inventory thead th:nth-child(4),
    table.inventory tbody td:nth-child(4) { display: none; }
    .login-card { padding: 32px 24px; }
}

/* ── Print view ── */
@media print {
    .site-header, .page-toolbar .toolbar-actions, .btn, .modal-overlay { display: none !important; }
    body { background: white; }
    .category-header { background: #1B5299 !important; -webkit-print-color-adjust: exact; }
}

/* ── Footer ── */
.site-footer {
    text-align: center;
    padding: 20px;
    color: var(--gray-dark);
    font-size: 12px;
    margin-top: 40px;
    border-top: 1px solid var(--gray);
}
