
/* =====================================================
   DELIVERY PLATFORM — SHARED DESIGN SYSTEM
===================================================== */

:root {
    --navy: #142b4a;
    --navy-dark: #0d1b30;
    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --blue-light: #eff6ff;
    --background: #f4f7fb;
    --surface: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --success: #15803d;
    --danger: #dc2626;
    --radius: 12px;
    --shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

/* RESET */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    max-width: 100%;
}

/* HEADINGS AND TEXT */

h1,
h2,
h3,
h4 {
    color: var(--navy);
    line-height: 1.3;
}

h1 {
    font-size: 30px;
    margin-bottom: 10px;
}

h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

h3 {
    font-size: 19px;
    margin-bottom: 8px;
}

p {
    color: var(--muted);
}

/* SHARED HEADER */

.top-header {
    background: var(--navy);
    color: white;
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.12);
}

.top-header h1 {
    color: white;
    font-size: 25px;
    margin: 0;
}

.top-header p {
    color: #cbd5e1;
    font-size: 14px;
}

/* Global page search (Phase 1 — pages/features only) */

.header-search {
    position: relative;
    flex: 1 1 180px;
    min-width: 140px;
    max-width: 280px;
}

.header-search-input {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    font-size: 14px;
}

.header-search-input::placeholder {
    color: #94a3b8;
}

.header-search-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.18);
}

.header-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 40;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-height: 280px;
    overflow-y: auto;
}

.header-search-results li {
    padding: 10px 14px;
    cursor: pointer;
    color: var(--text);
    font-size: 14px;
}

.header-search-results li:hover,
.header-search-results li.is-active {
    background: var(--blue-light);
}

.header-search-title {
    font-weight: 600;
    color: var(--navy);
}

.header-search-empty {
    cursor: default;
    color: var(--muted);
    font-size: 13px;
}

.header-search-empty:hover {
    background: transparent;
}

/* MAIN CONTENT */

.dashboard-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
}

.page-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px;
}

.welcome-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
}

.welcome-section h2 {
    margin-bottom: 8px;
}

.dashboard-section {
    margin-bottom: 36px;
}

.dashboard-section h2 {
    margin-bottom: 6px;
}

.section-description {
    margin-bottom: 20px;
    font-size: 14px;
}

.dashboard-section.is-secondary > h2 {
    font-size: 18px;
    color: var(--text);
}

.dashboard-section.is-secondary > .section-description {
    color: var(--muted);
    font-size: 13px;
}

/* LIST PAGINATION */

.list-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

.list-pager[hidden] {
    display: none !important;
}

.list-pager-label {
    font-size: 14px;
    color: var(--muted);
    min-width: 140px;
    text-align: center;
}

/* DASHBOARD GRID */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    min-height: 200px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.dashboard-card h3 {
    margin-bottom: 10px;
}

.dashboard-card p {
    font-size: 14px;
    margin-bottom: 16px;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 9px 24px rgba(15, 23, 42, 0.09);
}

.card-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.dashboard-card.coming-soon {
    cursor: default;
    opacity: 0.8;
}

.dashboard-card.coming-soon:hover {
    transform: none;
    box-shadow: var(--shadow);
}

.coming-soon-badge {
    display: inline-block;
    background: #f1f5f9;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
}

/* BUTTONS */

button,
.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 18px;
    background: var(--blue);
    color: white;
    border: 1px solid var(--blue);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: background 0.2s, border-color 0.2s;
}

button:hover,
.button:hover {
    background: var(--blue-hover);
    border-color: var(--blue-hover);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

.card-button {
    margin-top: auto;
}

a.card-button,
a.card-button:link,
a.card-button:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 42px;
    padding: 10px 18px;
    background: var(--blue);
    color: #ffffff;
    border: 1px solid var(--blue);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

a.card-button:hover {
    background: var(--blue-hover);
    border-color: var(--blue-hover);
    color: #ffffff;
}

.logout-button {
    background: var(--danger);
    border-color: var(--danger);
}

.logout-button:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.secondary-button {
    background: white;
    color: var(--blue);
    border-color: var(--blue);
}

.secondary-button:hover {
    background: var(--blue-light);
    color: var(--blue-hover);
    border-color: var(--blue-hover);
}

/* INFORMATION BOX */

.information-box {
    background: white;
    border: 1px solid var(--border);
    border-left: 4px solid var(--blue);
    border-radius: var(--radius);
    padding: 22px;
    margin: 20px 0;
}

.information-box h3 {
    margin-bottom: 10px;
}

.information-box p {
    font-size: 14px;
    margin-bottom: 8px;
}

/* FORMS */

form {
    width: 100%;
}

label {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    color: var(--text);
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    outline: 2px solid #dbeafe;
}

form button {
    margin-top: 14px;
}

/* TABLES */

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th,
td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

th {
    background: #f8fafc;
    color: var(--navy);
    font-size: 13px;
    font-weight: 700;
}

td {
    font-size: 14px;
}

tr:last-child td {
    border-bottom: none;
}

/* STATUS LABELS */

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* FOOTER */

.dashboard-footer {
    background: var(--navy-dark);
    color: #cbd5e1;
    text-align: center;
    padding: 24px;
    margin-top: 32px;
}

.dashboard-footer p:first-child {
    color: white;
    font-weight: 600;
    margin-bottom: 4px;
}

.dashboard-footer p:last-child {
    font-size: 13px;
}

/* LOGIN PAGE — PRESERVE CENTRED LAYOUT */

body.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

body.login-page h1 {
    text-align: center;
}

body.login-page form {
    width: 100%;
    max-width: 380px;
}

body.login-page input {
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

body.login-page button {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    border: none;
    border-radius: 8px;
    background: var(--navy);
    color: white;
    cursor: pointer;
}

/* RESPONSIVE LAYOUT */

@media (max-width: 768px) {
    .top-header {
        padding: 18px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .top-header h1 {
        font-size: 23px;
    }

    .dashboard-container,
    .page-container {
        padding: 22px 16px;
    }

    .welcome-section {
        padding: 20px;
    }

    .welcome-section h2 {
        font-size: 21px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-card {
        min-height: auto;
    }

    .logout-button {
        width: 100%;
    }

    .header-search {
        flex: 1 1 100%;
        max-width: none;
        width: 100%;
        order: 2;
    }

    .top-header > div:last-child {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
    }

    /* Keep wide tables usable on small screens */
    table {
        min-width: 600px;
    }

    .table-container {
        width: 100%;
        overflow-x: auto;
    }

    /* Touch-friendly controls for drivers on phones */
    button,
    .button,
    .card-button,
    .logout-button,
    select,
    input,
    textarea,
    .actions button {
        min-height: 44px;
    }

    .form-grid,
    .type-grid,
    .cat-grid,
    .run-grid,
    .emergency-grid {
        grid-template-columns: 1fr !important;
    }

    .pack-bar,
    .perm-row,
    .doc-modal-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 26px;
    }

    h2 {
        font-size: 21px;
    }

    .dashboard-container,
    .page-container {
        padding: 18px 12px;
    }

    .welcome-section {
        padding: 18px;
    }

    button,
    .button {
        min-height: 44px;
    }
}
