/*
 * Agency portal styles. Clean, spacious, mobile-first.
 * Brand colour is one variable so it can become a per-provider setting later.
 */
:root {
    --ap-primary: #1f5aa6;
    --ap-primary-dark: #17467f;
    --ap-bg: #f3f5f8;
    --ap-surface: #ffffff;
    --ap-border: #dfe4ea;
    --ap-text: #1f2933;
    --ap-muted: #5f6b7a;
    --ap-success: #1e7e4f;
    --ap-radius: 14px;
    --bs-primary: var(--ap-primary);
    --bs-primary-rgb: 31, 90, 166;
}

body {
    background: var(--ap-bg);
    color: var(--ap-text);
    font-size: 1.0625rem;
    line-height: 1.55;
}

.btn-primary { --bs-btn-bg: var(--ap-primary); --bs-btn-border-color: var(--ap-primary); --bs-btn-hover-bg: var(--ap-primary-dark); --bs-btn-hover-border-color: var(--ap-primary-dark); --bs-btn-active-bg: var(--ap-primary-dark); }
.btn-outline-primary { --bs-btn-color: var(--ap-primary); --bs-btn-border-color: var(--ap-primary); --bs-btn-hover-bg: var(--ap-primary); --bs-btn-hover-border-color: var(--ap-primary); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--ap-primary); box-shadow: 0 0 0 .2rem rgba(31, 90, 166, .18); }
.form-check-input:checked { background-color: var(--ap-primary); border-color: var(--ap-primary); }

.ap-container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.ap-main { padding-top: 1.5rem; padding-bottom: 3rem; }

/* ---------- top bar ---------- */
.ap-topbar { background: var(--ap-surface); border-bottom: 1px solid var(--ap-border); }
.ap-topbar-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding-top: .75rem; padding-bottom: .75rem; }
.ap-brand { display: flex; align-items: center; gap: .75rem; color: var(--ap-text); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.ap-logo { height: 44px; width: auto; }
.ap-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; }
.ap-nav a { color: var(--ap-text); text-decoration: none; padding: .5rem .85rem; border-radius: 10px; font-weight: 500; }
.ap-nav a:hover { background: var(--ap-bg); }
.ap-nav a.active { background: rgba(31, 90, 166, .1); color: var(--ap-primary); }
.ap-agency-name { color: var(--ap-muted); padding: .5rem .5rem; font-size: .95rem; }
.ap-nav a.ap-logout { border: 1px solid var(--ap-border); }

/* ---------- cards ---------- */
.ap-card { background: var(--ap-surface); border: 1px solid var(--ap-border); border-radius: var(--ap-radius); padding: 1.5rem; margin-bottom: 1.5rem; }
@media (min-width: 768px) { .ap-card { padding: 2rem 2.25rem; } }
.ap-page-title { font-size: 1.75rem; font-weight: 700; margin-bottom: .25rem; }
.ap-subtitle { color: var(--ap-muted); margin-bottom: 1.5rem; }

/* ---------- login ---------- */
.ap-login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.25rem; }
.ap-login-card { background: var(--ap-surface); border: 1px solid var(--ap-border); border-radius: 18px; width: 100%; max-width: 460px; overflow: hidden; }
.ap-login-header { text-align: center; padding: 2rem 2rem 1rem; }
.ap-login-logo { max-height: 72px; max-width: 220px; margin-bottom: 1rem; }
.ap-login-header h1 { font-size: 1.6rem; font-weight: 700; margin: 0; }
.ap-login-header p { color: var(--ap-muted); margin: .35rem 0 0; }
.ap-login-form { padding: 1rem 2rem 1.5rem; }
.ap-login-admin { text-align: center; margin-top: 1.25rem; }
.ap-login-admin a { color: var(--ap-primary); font-size: .95rem; }
.ap-login-help { background: var(--ap-bg); border-top: 1px solid var(--ap-border); padding: 1.25rem 2rem; }
.ap-login-help h2 { font-size: 1rem; font-weight: 700; margin-bottom: .35rem; }
.ap-login-help p { color: var(--ap-muted); font-size: .95rem; margin: 0; }

/* ---------- dashboard ---------- */
.ap-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.ap-stat { background: var(--ap-surface); border: 1px solid var(--ap-border); border-radius: var(--ap-radius); padding: 1.25rem; text-align: center; }
.ap-stat-number { font-size: 2.5rem; font-weight: 700; color: var(--ap-primary); line-height: 1.1; }
.ap-stat-label { color: var(--ap-muted); }
.ap-actionbar { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.ap-actionbar input { flex: 1 1 260px; max-width: 460px; }
.ap-table th { color: var(--ap-muted); font-weight: 600; font-size: .9rem; background: #f8f9fb; white-space: nowrap; }
.ap-table td, .ap-table th { padding: .9rem 1rem; vertical-align: middle; }
.ap-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; color: var(--ap-primary); background: rgba(31, 90, 166, .08); padding: .15rem .45rem; border-radius: 6px; }
.ap-ticket { display: inline-block; margin-left: .4rem; color: var(--ap-success); font-weight: 600; font-size: .85rem; }
.ap-pickup { display: block; color: var(--ap-success); font-weight: 600; font-size: .85rem; margin-top: .2rem; }
.ap-badge { display: inline-block; min-width: 2rem; text-align: center; background: var(--ap-primary); color: #fff; border-radius: 999px; padding: .1rem .55rem; font-weight: 600; font-size: .85rem; }
.ap-empty { text-align: center; padding: 3.5rem 1rem; color: var(--ap-muted); }
.ap-empty-icon { font-size: 3rem; opacity: .4; }
.ap-empty h2 { font-size: 1.3rem; color: var(--ap-text); }

/* ---------- form ---------- */
.ap-section { border-top: 1px solid var(--ap-border); padding-top: 1.5rem; margin-top: 1.5rem; }
.ap-section:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.ap-section-title { font-size: 1.25rem; font-weight: 700; margin-bottom: .25rem; }
.ap-section-note { color: var(--ap-muted); margin-bottom: 1rem; }
.ap-section-title + .row, .ap-section-title + #childrenContainer { margin-top: 1rem; }
.form-label { font-weight: 600; margin-bottom: .35rem; }
.ap-check { padding: .85rem 1rem .85rem 2.6rem; background: var(--ap-bg); border-radius: 10px; }
.ap-check .form-check-input { width: 1.3rem; height: 1.3rem; margin-top: .15rem; }
.ap-field-warning { color: #b42318; font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.ap-tip { display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1.25rem; margin-left: .35rem; border-radius: 50%; background: rgba(31, 90, 166, .12); color: var(--ap-primary); font-size: .75rem; font-weight: 700; cursor: help; vertical-align: middle; }
.ap-child-card { border: 1px solid var(--ap-border); border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem; background: #fbfcfd; }
.ap-child-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.ap-child-title { font-size: 1.1rem; font-weight: 700; margin: 0; }
.ap-date-age { display: flex; gap: .75rem; align-items: stretch; }
.ap-date-age input { flex: 1; }
.ap-age { display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 4.25rem; border: 1px solid var(--ap-border); border-radius: 8px; background: var(--ap-surface); }
.ap-age-label { font-size: .75rem; color: var(--ap-muted); }
.ap-age-value { font-weight: 700; font-size: 1.15rem; }
.ap-age-error { color: #b42318; font-size: .9rem; margin-top: .35rem; }
.ap-form-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .75rem; border-top: 1px solid var(--ap-border); padding-top: 1.5rem; margin-top: 2rem; }

/* ---------- confirmation / view ---------- */
.ap-success-banner { background: var(--ap-success); color: #fff; border-radius: var(--ap-radius); padding: 2rem 1.5rem; text-align: center; margin-bottom: 1.5rem; }
.ap-success-banner h1 { font-size: 1.9rem; font-weight: 700; }
.ap-success-code { display: inline-block; background: rgba(255, 255, 255, .18); border-radius: 10px; padding: .6rem 1.4rem; font-size: 2rem; font-weight: 700; letter-spacing: .12em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ap-code-banner { background: var(--ap-primary); color: #fff; border-radius: var(--ap-radius); padding: 1.25rem; text-align: center; margin-bottom: 1rem; }
.ap-code-large { font-size: 2rem; font-weight: 700; letter-spacing: .12em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ap-ticketed { background: #e8f5ee; border: 2px solid var(--ap-success); color: #134e33; border-radius: var(--ap-radius); padding: 1.25rem; text-align: center; margin-bottom: 1rem; }
.ap-ticketed h2 { font-size: 1.3rem; font-weight: 700; }
.ap-ticketed p { margin: .35rem 0 0; }
.ap-ticketed-note { font-style: italic; font-size: .95rem; }
.ap-back { display: inline-block; margin-bottom: 1rem; color: var(--ap-primary); text-decoration: none; font-weight: 500; }
.ap-details-section { margin-bottom: 1.75rem; }
.ap-details-section h2 { font-size: 1.15rem; font-weight: 700; color: var(--ap-primary); border-bottom: 2px solid var(--ap-border); padding-bottom: .5rem; margin-bottom: .75rem; }
.ap-detail { display: grid; grid-template-columns: 1fr; gap: .1rem; padding: .45rem 0; }
@media (min-width: 640px) { .ap-detail { grid-template-columns: 220px 1fr; gap: 1rem; } }
.ap-detail-label { font-weight: 600; color: var(--ap-muted); }
.ap-child-detail { background: var(--ap-bg); border-radius: 10px; padding: .9rem 1.1rem; margin-bottom: .75rem; }
.ap-child-detail h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: .35rem; }
.ap-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.ap-actions form { margin: 0; }
.ap-closed { padding: 3rem 1.5rem; }
.ap-closed-icon { font-size: 3rem; }

@media print {
    .ap-topbar, .no-print, .alert { display: none !important; }
    body { background: #fff; font-size: 11pt; }
    .ap-card { border: 1px solid #ccc; padding: 10px; }
    .ap-success-banner, .ap-code-banner { background: #fff !important; color: #000 !important; border: 1px solid #000; padding: 8px; }
    .ap-success-code, .ap-code-large { background: none; font-size: 18pt; }
    .ap-detail { grid-template-columns: 160px 1fr; padding: 2px 0; }
    .ap-details-section { break-inside: avoid; margin-bottom: 10px; }
    .ap-child-detail { break-inside: avoid; background: none; border-bottom: 1px solid #ddd; border-radius: 0; padding: 4px 0; }
}
