/* PBAT-KOH Accreditation — Professional Dark Blue Theme */
:root {
    --primary: #0a2540;
    --primary-light: #1a3a5c;
    --primary-accent: #1e5aa8;
    --success: #0d7a4f;
    --danger: #c0392b;
    --bg: #f0f4f8;
    --card: #ffffff;
    --border: #d0d7de;
    --text: #1a1a1a;
    --text-muted: #5a6a7a;
    --header-bg: #0a2540;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
}

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

/* Sidebar Layout */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 260px;
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: transform 0.25s;
}
.sidebar-brand {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo { height: 48px !important; width: auto !important; max-width: 180px !important; object-fit: contain; display: block; }
.topbar-logo { height: 36px !important; width: auto !important; max-width: 140px !important; object-fit: contain; }
.brand-text strong { display: block; font-size: 1rem; }
.brand-text small { opacity: 0.75; font-size: 0.75rem; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
    transition: all 0.15s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.12);
    color: white;
    text-decoration: none;
}
.sidebar-nav a i { width: 20px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-mini { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 0.85rem; }
.user-mini i { font-size: 1.6rem; }
.user-mini small { display: block; opacity: 0.7; }
.logout-link { color: rgba(255,255,255,0.8); font-size: 0.85rem; }
.logout-link:hover { color: white; text-decoration: none; }

.main-content { margin-left: 260px; flex: 1; min-height: 100vh; background: var(--bg); }
.topbar {
    background: white;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar .page-title { font-size: 1.25rem; color: var(--primary); margin: 0; flex: 1; }
.topbar-logo { height: 36px; }
.menu-toggle { display: none; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--primary); }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
}
.logo { font-weight: 700; font-size: 1.15rem; color: white; letter-spacing: 0.3px; }
.header-right { display: flex; align-items: center; gap: 14px; font-size: 0.9rem; }
.btn-small {
    background: rgba(255,255,255,0.15);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.25);
}
.btn-small:hover { background: rgba(255,255,255,0.25); text-decoration: none; }

/* Navigation */
.main-nav {
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    overflow-x: auto;
    position: sticky;
    top: 56px;
    z-index: 99;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.main-nav a {
    padding: 14px 18px;
    white-space: nowrap;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all 0.15s;
}
.main-nav a.active,
.main-nav a:hover {
    color: var(--primary);
    border-bottom-color: var(--primary-accent);
    text-decoration: none;
}

.container { max-width: 1140px; margin: 0 auto; padding: 20px 16px; }

.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.7rem; color: var(--primary); font-weight: 700; }
.subtitle { color: var(--text-muted); font-size: 0.95rem; margin-top: 4px; }

/* Buttons */
.btn-primary, .btn-success, .btn-secondary, .btn-danger {
    display: inline-block;
    padding: 12px 22px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(1.1); }
.btn-secondary { background: #5a6a7a; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; }

/* Cards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 18px 14px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(10,37,64,0.06);
    border-top: 3px solid transparent;
}
.stat-card.highlight { border-top-color: var(--primary-accent); }
.stat-number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }

.card, .result-card, .success-box {
    background: white;
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 2px 10px rgba(10,37,64,0.06);
}
.card h3 { color: var(--primary); margin-bottom: 14px; font-size: 1.15rem; }

/* Forms */
.search-form { display: flex; gap: 10px; margin-bottom: 20px; }
.search-form input, .form-group input, .form-group select {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
}
.search-form input { flex: 1; }
.search-form input:focus, .form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(30,90,168,0.12);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; }
.form-group label { font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: var(--primary); }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* Professional Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.data-table thead th {
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 14px 12px;
    text-align: left;
    border: none;
}
.data-table tbody td {
    padding: 12px;
    border-bottom: 1px solid #eef2f6;
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f7fafc; }
.data-table code {
    background: #eef4fa;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.82em;
    color: var(--primary);
}
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Status badges */
.status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #e9ecef;
}
.status-accredited, .status-checkedin { background: #d4edda; color: #155724; }
.status-registered { background: #fff3cd; color: #856404; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }
.alert-info { background: #d1ecf1; color: #0c5460; }

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(160deg, #0a2540 0%, #1a3a5c 50%, #0d3b66 100%);
    padding: 20px;
}
.login-wrapper { width: 100%; max-width: 420px; }
.login-brand { text-align: center; color: white; margin-bottom: 28px; }
.login-brand .logo-large { font-size: 3.2rem; }
.login-brand h1 { margin: 6px 0; font-size: 1.9rem; font-weight: 700; }
.login-brand .tagline { opacity: 0.85; font-size: 0.95rem; }
.login-box {
    background: white;
    padding: 32px 28px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.login-box h2 { margin-bottom: 4px; color: var(--primary); }
.login-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 22px; }
.login-box .form-group { margin-bottom: 16px; }
.demo-creds {
    margin-top: 22px;
    font-size: 0.8rem;
    color: #555;
    background: #f7f9fb;
    padding: 14px;
    border-radius: 8px;
}
.demo-creds table { width: 100%; margin-top: 8px; font-size: 0.78rem; }
.demo-creds td { padding: 3px 4px; }

/* Dashboard extras */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.qa-card {
    background: white;
    padding: 16px 12px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(10,37,64,0.06);
    color: var(--primary);
    border: 1px solid transparent;
    transition: all 0.15s;
}
.qa-card:hover { border-color: var(--primary-accent); text-decoration: none; transform: translateY(-1px); }

.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 800px) { .dashboard-grid { grid-template-columns: 1.4fr 1fr; } }
.three-col { grid-template-columns: 1fr; }
@media (min-width: 900px) { .three-col { grid-template-columns: 1fr 1fr 1fr; } }

.metric-bars { display: flex; flex-direction: column; gap: 10px; }
.metric-row { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.metric-row span:first-child { min-width: 90px; font-weight: 500; }
.metric-row span:last-child { min-width: 60px; text-align: right; font-size: 0.85rem; color: #555; }
.bar { flex: 1; height: 10px; background: #e9ecef; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary-accent); border-radius: 5px; }
.bar-fill.female { background: #c2185b; }

.top-list { list-style: decimal; padding-left: 20px; margin: 0; }
.top-list li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #f0f0f0; }
.top-list li:last-child { border-bottom: none; }

/* Accreditation Desk */
.desk-controls { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; align-items: flex-start; }
.search-box-live { position: relative; flex: 1; min-width: 280px; }
.search-box-live input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
}
.search-box-live input:focus { border-color: var(--primary-accent); outline: none; }
.search-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; background: white;
    border: 1px solid var(--border); border-radius: 8px; max-height: 300px; overflow-y: auto;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12); z-index: 200;
}
.dd-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #f0f0f0; }
.dd-item:hover { background: #f0f5fa; }

.qr-reader {
    max-width: 420px;
    margin: 16px auto;
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Modal */
.modal {
    position: fixed; inset: 0; background: rgba(10,37,64,0.65); z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal.hidden { display: none; }
.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 540px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.modal-close {
    position: absolute; top: 12px; right: 16px; font-size: 28px; cursor: pointer; color: #888;
}
.modal-body { display: flex; gap: 18px; margin-bottom: 18px; }
.modal-photo img { width: 110px; height: 140px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.no-photo {
    width: 110px; height: 140px; background: #f0f4f8; display: flex; align-items: center;
    justify-content: center; font-size: 42px; border-radius: 10px;
}
.modal-details h2 { margin-bottom: 8px; color: var(--primary); }
.modal-details p { margin: 5px 0; font-size: 0.95rem; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-actions button { flex: 1; min-width: 130px; }
@media (max-width: 500px) { .modal-body { flex-direction: column; align-items: center; text-align: center; } }

/* Pagination */
.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pagination a { padding: 6px 12px; background: white; border: 1px solid var(--border); border-radius: 6px; }
.pagination a.active { background: var(--primary); color: white; border-color: var(--primary); }

footer { text-align: center; padding: 24px; color: var(--text-muted); font-size: 0.85rem; }
code { background: #f0f4f8; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; color: var(--primary); }
.empty { color: var(--text-muted); padding: 12px 0; }
.hidden { display: none !important; }
