/* =====================================================================
   Parcel Tracking System - custom styles
   Bootstrap 5 is used for the base; this file only adds the layout,
   public tracker and timeline specifics.
   ===================================================================== */

:root {
    --brand:        #1e5ea8;
    --brand-dark:   #164a87;
    --sidebar-w:    250px;
    --topbar-h:     62px;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f6fa;
}

/* ============================ Public site ============================ */

.public-body {
    background: #eef2f8;
}

.public-header {
    background: #fff;
    border-bottom: 1px solid #e6eaf0;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
}

.brand-logo {
    border-radius: 12px;
}

.tracker-hero {
    background: linear-gradient(135deg, var(--brand) 0%, #2f7fd4 55%, #38a3e5 100%);
    padding: 48px 0 88px;
}

.tracker-card {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(16, 24, 40, .18);
}

.tracker-card .form-control,
.tracker-card .input-group-text {
    border-radius: 10px;
}

#trackResult,
#trackMessage {
    margin-top: -56px;
    position: relative;
    z-index: 2;
}

.result-card {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(16, 24, 40, .14);
}

.result-header {
    background: linear-gradient(135deg, var(--brand) 0%, #2f7fd4 100%);
    color: #fff;
    border-radius: 16px 16px 0 0;
}

.result-icon {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, .18);
    font-size: 1.6rem;
    flex: 0 0 auto;
}

.meta-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6c757d;
    font-weight: 600;
}

.meta-value {
    font-weight: 600;
    font-size: .98rem;
}

/* Public timeline */
.timeline {
    list-style: none;
    margin: 0;
    padding: 0 0 0 8px;
    position: relative;
}

.timeline-item {
    position: relative;
    padding: 0 0 22px 34px;
    border-left: 2px solid #e3e8f0;
}

.timeline-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -13px;
    top: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #cdd6e3;
    color: #fff;
    font-size: .72rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-item:first-child .timeline-marker {
    background: #198754;
    border-color: #198754;
    font-weight: 700;
}

.timeline-content {
    font-size: .94rem;
}

.timeline-remark {
    background: #f6f8fb;
    border-left: 3px solid #cdd6e3;
    padding: 8px 10px;
    border-radius: 0 8px 8px 0;
    color: #495057;
    font-size: .88rem;
}

/* ============================ Admin layout =========================== */

.admin-body {
    overflow-x: hidden;
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: #16233a;
    color: #cfd8e6;
    display: flex;
    flex-direction: column;
    z-index: 1045;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    min-height: var(--topbar-h);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-brand strong {
    display: block;
    color: #fff;
    font-size: .98rem;
    line-height: 1.15;
}

.sidebar-brand small {
    color: #8fa0b8;
    font-size: .74rem;
}

.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 10px 10px 20px;
}

.nav-group {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #7c8ba3;
    padding: 16px 12px 6px;
    font-weight: 700;
}

.admin-sidebar .nav-link {
    color: #cfd8e6;
    border-radius: 9px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .9rem;
}

.admin-sidebar .nav-link i {
    font-size: 1.02rem;
    width: 20px;
    text-align: center;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link:focus {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.admin-sidebar .nav-link.active {
    background: var(--brand);
    color: #fff;
}

.admin-sidebar .nav-link.text-danger:hover {
    background: rgba(220, 53, 69, .18);
    color: #ffb3ba;
}

.sidebar-footer {
    padding: 12px 18px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: .78rem;
    color: #7c8ba3;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 1040;
}

.admin-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    background: #fff;
    border-bottom: 1px solid #e6eaf0;
    min-height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-title h1 {
    font-weight: 700;
}

.admin-content {
    flex: 1 1 auto;
    padding: 20px;
}

/* Cards, tables */
.card {
    border: 1px solid #e6eaf0;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.card-header {
    background: #fff;
    font-weight: 600;
    border-bottom: 1px solid #eef1f6;
    border-radius: 12px 12px 0 0 !important;
    padding: 12px 16px;
}

.table > :not(caption) > * > * {
    padding: .6rem .75rem;
    vertical-align: middle;
}

.table thead th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
    font-weight: 700;
    white-space: nowrap;
}

.table-sort {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.table-sort:hover {
    color: var(--brand);
}

.detail-table th {
    width: 38%;
    color: #6c757d;
    font-weight: 600;
    background: #fafbfd;
}

.detail-table td {
    word-break: break-word;
}

/* Dashboard stat cards */
.stat-card {
    transition: transform .15s ease, box-shadow .15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(16, 24, 40, .1);
}

.stat-label {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6c757d;
    font-weight: 700;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
}

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #1e5ea8 0%, #2f7fd4 55%, #38a3e5 100%);
}

.login-card {
    max-width: 440px;
    width: 100%;
    border: 0;
    border-radius: 18px;
}

.public-footer {
    background: #fff;
    border-top: 1px solid #e6eaf0;
    color: #495057;
    margin-top: 24px;
}

/* ============================ Responsive ============================= */

@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.is-open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-backdrop.show {
        display: block;
    }

    #trackResult,
    #trackMessage {
        margin-top: -40px;
    }
}

@media (max-width: 575.98px) {
    .admin-content {
        padding: 14px;
    }

    .tracker-hero {
        padding: 32px 0 70px;
    }

    .stat-value {
        font-size: 1.4rem;
    }
}

@media print {
    .admin-sidebar,
    .admin-topbar,
    .public-header,
    .public-footer,
    .no-print {
        display: none !important;
    }

    .admin-main {
        margin-left: 0;
    }

    body {
        background: #fff;
    }
}