/* ============================================================================
   SCP — Saskatchewan College of Psychologists
   Brand: #1e73be (blue), Ubuntu font, white on blue headers/footers
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap');

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --brand-blue: #1e73be;
    --brand-blue-dark: #1a5fa0;
    --brand-blue-light: #e8f1fa;
    --link-blue: #0066bf;
    --success: #27ae60;
    --success-light: #d4edda;
    --warning: #dd8500;
    --warning-light: #fff3cd;
    --danger: #dd3333;
    --danger-light: #f8d7da;
    --info: #3ec9c4;
    --gray-50: #f9fafb;
    --gray-100: #f0f2f5;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --radius: 6px;
    --radius-lg: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --transition: 150ms ease;
}

html { font-size: 16.5px; }
body {
    font-family: 'Ubuntu', Helvetica, Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--link-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ─── Layout ───────────────────────────────────────────────────────────────── */
.site-header {
    background: var(--brand-blue);
    color: var(--white);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.site-logo {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.site-logo:hover { text-decoration: none; opacity: 0.9; }
.site-logo span { font-weight: 400; opacity: 0.7; font-size: 0.85em; }

.header-nav { display: flex; align-items: center; gap: 4px; }
.header-nav a {
    color: rgba(255,255,255,0.75);
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.95em;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}
.header-nav a:hover, .header-nav a.active {
    color: var(--white);
    background: rgba(255,255,255,0.12);
    text-decoration: none;
}
.header-nav .user-badge {
    background: rgba(255,255,255,0.15);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.93em;
    color: var(--white);
    margin-left: 8px;
}

.site-footer {
    background: var(--brand-blue);
    color: rgba(255,255,255,0.8);
    padding: 20px 24px;
    text-align: center;
    font-size: 0.88em;
    margin-top: auto;
}
.site-footer a { color: var(--white); }

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
    width: 100%;
    flex: 1;
}

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}
.card-header h2 {
    font-size: 1.25em;
    font-weight: 600;
    color: var(--gray-800);
}
.card-body { }
.card-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand-blue); color: var(--white); }
.btn-primary:hover { background: var(--brand-blue-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #219a52; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #c0392b; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
}
.btn-outline:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
.btn-sm { padding: 6px 14px; font-size: 0.88em; }
.btn-lg { padding: 13px 30px; font-size: 1.08em; }

/* ─── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 0.95em;
    color: var(--gray-600);
}
.form-group label .required { color: var(--danger); }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1em;
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
    color: var(--gray-800);
}
.form-control:focus {
    border-color: var(--brand-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30,115,190,0.12);
}
.form-control:disabled, .form-control[readonly] {
    background: var(--gray-50);
    color: var(--gray-500);
}
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-help { font-size: 0.87em; color: var(--gray-400); margin-top: 3px; }
.form-row { display: flex; gap: 16px; }
.form-row > .form-group { flex: 1; }

.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] { margin: 0; }
.form-check label { margin: 0; font-weight: 400; font-size: 0.96em; color: var(--gray-700); }

.form-inline { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }

/* ─── Tables ───────────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.96em;
}
.data-table th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
    font-size: 0.88em;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
.data-table tbody tr:hover { background: var(--brand-blue-light); }
.data-table .actions { white-space: nowrap; }
.data-table .actions a { margin-right: 8px; }

/* ─── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.96em;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-light); color: #155724; border-color: #c3e6cb; }
.alert-warning { background: var(--warning-light); color: #856404; border-color: #ffc107; }
.alert-danger { background: var(--danger-light); color: #721c24; border-color: #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border-color: #bee5eb; }

/* ─── Tabs ─────────────────────────────────────────────────────────────────── */
/* Wraps rather than scrolls. A horizontally scrolling strip forces overflow-y to
   compute to auto, which combined with the -2px underline overlap produced a
   stray vertical scrollbar. */
.tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--gray-200);
}
.tab-nav a {
    padding: 10px 18px;
    font-size: 0.97em;
    font-weight: 500;
    text-decoration: none;
    color: var(--gray-500);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color var(--transition), border-color var(--transition);
}
.tab-nav a:hover { color: var(--brand-blue); text-decoration: none; }
.tab-nav a.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); }

/* ─── Badges & Status ──────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 14px;
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1.5;
}
/* The status badge beside a registrant's name reads as a heading, not a chip */
.status-badge-lg {
    font-size: 1.05em;
    padding: 6px 18px;
    border-radius: 18px;
}
.badge-active { background: #d4edda; color: #155724; }
.badge-provisional { background: #fff3cd; color: #856404; }
.badge-inactive { background: var(--gray-200); color: var(--gray-600); }
.badge-removed { background: #f8d7da; color: #721c24; }

/* ─── Dashboard Stats ──────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-card .stat-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--brand-blue);
    line-height: 1.2;
}
.stat-card .stat-label {
    font-size: 0.92em;
    color: var(--gray-500);
    margin-top: 4px;
    font-weight: 500;
}

/* ─── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.92em;
    color: var(--gray-600);
    text-decoration: none;
}
.pagination a:hover { background: var(--brand-blue-light); border-color: var(--brand-blue); color: var(--brand-blue); }
.pagination .active { background: var(--brand-blue); color: var(--white); border-color: var(--brand-blue); }

/* ─── Search Bar ───────────────────────────────────────────────────────────── */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.search-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1em;
}
.search-bar input:focus {
    border-color: var(--brand-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30,115,190,0.12);
}

/* ─── Login Page ───────────────────────────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
}
.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    margin: 20px;
}
.login-card h1 {
    text-align: center;
    color: var(--brand-blue);
    font-size: 1.5em;
    margin-bottom: 6px;
}
.login-card .login-subtitle {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.93em;
    margin-bottom: 28px;
}
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 1em; }
.login-card .login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.92em;
    color: var(--gray-400);
}
.login-card .login-footer a { color: var(--brand-blue); }

/* ─── Admin Sidebar Layout ─────────────────────────────────────────────────── */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 60px);
}
.admin-sidebar {
    width: 240px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    padding: 20px 0;
    flex-shrink: 0;
}
.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    color: var(--gray-600);
    font-size: 0.97em;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
}
.admin-sidebar a:hover { background: var(--brand-blue-light); color: var(--brand-blue); }
.admin-sidebar a.active { background: var(--brand-blue-light); color: var(--brand-blue); border-right: 3px solid var(--brand-blue); }
.admin-sidebar .sidebar-section {
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-400);
    padding: 16px 24px 6px;
}
.admin-main {
    flex: 1;
    padding: 28px;
    overflow-x: hidden;
}

/* ─── Utility ──────────────────────────────────────────────────────────────── */
.text-muted { color: var(--gray-400); }
.text-small { font-size: 0.9em; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none; }

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .header-inner { padding: 0 16px; }
    .header-nav a { padding: 6px 8px; font-size: 0.9em; }
    .main-content { padding: 16px; }
    .form-row { flex-direction: column; gap: 0; }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--gray-200); padding: 10px 0; }
    .admin-sidebar a { padding: 8px 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
