/*
 * VSL Tracker - shared design system.
 * Design tokens + component overrides on top of Bootstrap 5, used by both
 * the public/auth layout (layouts/main.php) and the Admin shell
 * (layouts/admin.php) for a consistent look.
 */

:root {
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --brand-light: #eef2ff;
    --surface: #ffffff;
    --app-bg: #f4f5fa;
    --sidebar-bg: #111827;
    --sidebar-bg-hover: rgba(255, 255, 255, 0.06);
    --text-main: #1f2330;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --radius-lg: 1rem;
    --radius: 0.7rem;
    --radius-sm: 0.5rem;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--app-bg);
    color: var(--text-main);
}

a {
    color: var(--brand);
}

a:hover {
    color: var(--brand-dark);
}

/* Buttons */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.btn-primary {
    background-color: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--brand-dark);
    border-color: var(--brand-dark);
}

.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border-color);
}

.btn-outline-secondary:hover {
    background-color: #f3f4f6;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Cards */
.app-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.app-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.app-page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.app-page-header p {
    color: var(--text-muted);
    margin-bottom: 0;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.4em 0.75em;
}

/* Avatars */
.avatar-circle {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--brand-light);
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.avatar-circle.avatar-sm {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.7rem;
}

/* Tables */
.table-modern {
    --bs-table-bg: transparent;
}

.table-modern thead th {
    background-color: #f9fafb;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.825rem;
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.table-modern tbody td {
    border-color: var(--border-color);
    vertical-align: middle;
    padding: 0.85rem 1rem;
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

.table-modern tbody tr:hover {
    background-color: #fafafd;
}

/* Reusable vertical scroll for a table that can grow tall (e.g. the
   Dashboard's Hourly Collection Status matrix - one row per time slot).
   Combine with .table-responsive, which already handles horizontal
   overflow for many columns (e.g. many floors). The header needs the
   .table-modern thead th solid background above for the sticky row to
   look right while scrolling. */
.table-scroll-y {
    max-height: 360px;
    overflow-y: auto;
}

.table-scroll-y thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Card that wraps a table edge-to-edge (p-0): clip the header's background
   band to the card's own rounded corners instead of squaring them off. */
.app-card-table {
    overflow: hidden;
}

/* Forms */
.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-color);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 0.2rem var(--brand-light);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

/* Pagination */
.pagination .page-link {
    border: none;
    color: var(--text-main);
    border-radius: var(--radius-sm);
    margin: 0 0.15rem;
}

.pagination .page-item.active .page-link {
    background-color: var(--brand);
    color: #fff;
}

.pagination .page-link:hover {
    background-color: var(--brand-light);
}

/* Search box */
.search-box .input-group-text {
    background: var(--surface);
    border-right: none;
    color: var(--text-muted);
}

.search-box .form-control {
    border-left: none;
}

.search-box .form-control:focus {
    box-shadow: none;
    border-color: var(--border-color);
}

/* Auth (login) shell */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--brand-light) 0%, var(--app-bg) 55%);
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2.25rem 2rem;
}

.auth-logo {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius);
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto 1rem;
}
