/* ===== TruckerPro Border — Custom Styles ===== */

:root {
    --brand-primary: #0d6efd;
    --brand-accent: #6610f2;
    --sidebar-bg: #1a1d21;
    --sidebar-hover: #2c3036;
    --sidebar-active: #0d6efd;
    --sidebar-text: #adb5bd;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 260px;
    --topbar-height: 56px;
}

/* ===== Layout ===== */

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: #f5f7fa;
}

.main-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
}

.content-area {
    padding: 1.5rem;
}

/* ===== Sidebar ===== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1040;
    overflow-y: auto;
    transition: transform 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: #495057 transparent;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    height: var(--topbar-height);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand img {
    height: 32px;
    width: auto;
}

.sidebar-brand .brand-text {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    margin-left: 0.75rem;
    white-space: nowrap;
}

.sidebar-nav {
    padding: 0.5rem 0;
}

.sidebar-nav .nav-section {
    padding: 0.75rem 1.25rem 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.55rem 1.25rem;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

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

.sidebar-nav .nav-link.active {
    background: rgba(13, 110, 253, 0.12);
    color: var(--sidebar-text-active);
    border-left-color: var(--sidebar-active);
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 0.75rem;
    font-size: 0.9rem;
}

.sidebar-nav .nav-sub {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav .nav-sub .nav-link {
    padding-left: 3.25rem;
    font-size: 0.82rem;
}

.sidebar-nav .nav-toggle {
    cursor: pointer;
}

.sidebar-nav .nav-toggle::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.65rem;
    margin-left: auto;
    transition: transform 0.2s;
}

.sidebar-nav .nav-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* ===== Top Bar ===== */

.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1030;
}

.topbar .company-name {
    font-weight: 600;
    color: #495057;
    font-size: 0.95rem;
}

.topbar .topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ===== Status Badges ===== */

.badge.status-draft { background-color: #6c757d !important; }
.badge.status-submitted { background-color: #0d6efd !important; }
.badge.status-accepted { background-color: #198754 !important; }
.badge.status-rejected { background-color: #dc3545 !important; }
.badge.status-hold { background-color: #ffc107 !important; color: #000 !important; }
.badge.status-cleared { background-color: #0dcaf0 !important; color: #000 !important; }
.badge.status-cancelled { background-color: #212529 !important; }
.badge.status-failed_to_submit { background-color: #dc3545 !important; }
.badge.status-amended { background-color: #0d6efd !important; }
.badge.status-pending_review { background-color: #0dcaf0 !important; color: #000 !important; }

/* ===== Countdown Timer Colors ===== */

.countdown-green {
    color: #198754;
}

.countdown-amber {
    color: #fd7e14;
}

.countdown-red {
    color: #dc3545;
}

.countdown-flash {
    animation: countdown-blink 0.5s infinite alternate;
}

@keyframes countdown-blink {
    from { opacity: 1; }
    to { opacity: 0.3; }
}

/* ===== Stat Cards ===== */

.stat-card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

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

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===== Tables ===== */

.table-border {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.table-border .table {
    margin-bottom: 0;
}

.table-border .table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table-border .table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    font-size: 0.875rem;
}

.table-border .table tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}

.table-border .table tbody tr:hover {
    background: #f8f9fa;
}

/* ===== Filter Bar ===== */

.filter-bar {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.filter-bar .form-select,
.filter-bar .form-control {
    font-size: 0.875rem;
}

/* ===== Alerts Panel ===== */

.alerts-panel {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.alerts-panel .alert-item {
    display: flex;
    align-items: start;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.875rem;
}

.alerts-panel .alert-item:last-child {
    border-bottom: none;
}

.alerts-panel .alert-icon {
    margin-right: 0.75rem;
    margin-top: 0.15rem;
}

/* ===== Quick Actions ===== */

.quick-actions .btn {
    border-radius: 0.5rem;
    font-size: 0.875rem;
    padding: 0.5rem 1.25rem;
}

/* ===== Auth Pages ===== */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    border: none;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.auth-card .card-body {
    padding: 2.5rem;
}

.auth-card .auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-card .auth-logo img {
    height: 40px;
}

.auth-card .auth-title {
    text-align: center;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.auth-card .auth-subtitle {
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* ===== Toast Container ===== */

#toast-container {
    position: fixed;
    top: calc(var(--topbar-height) + 0.75rem);
    right: 1rem;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 380px;
}

/* ===== Brand Custom Properties ===== */

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

.bg-brand-primary {
    background-color: var(--brand-primary) !important;
}

.brand-accent {
    color: var(--brand-accent);
}

.bg-brand-accent {
    background-color: var(--brand-accent) !important;
}

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

.btn-brand:hover {
    background-color: color-mix(in srgb, var(--brand-primary) 85%, #000);
    border-color: color-mix(in srgb, var(--brand-primary) 85%, #000);
    color: #fff;
}

/* ===== Theme Toggle ===== */

.theme-toggle {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    color: #495057;
    font-size: 1rem;
}

.theme-toggle:hover {
    background: #f8f9fa;
}

/* ===== Pagination ===== */

.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* ===== Empty State ===== */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.95rem;
}

/* ===== Loading Spinner ===== */

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

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

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

    .sidebar.show {
        transform: translateX(0);
    }

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

    .topbar {
        left: 0;
    }
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #495057;
    cursor: pointer;
    padding: 0.25rem;
}

@media (max-width: 991.98px) {
    .sidebar-toggle {
        display: inline-block;
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

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

/* ===== Dark Mode Overrides ===== */

[data-bs-theme="dark"] body {
    background-color: #1a1d21;
}

[data-bs-theme="dark"] .topbar {
    background: #212529;
    border-bottom-color: #373b3e;
}

[data-bs-theme="dark"] .topbar .company-name {
    color: #dee2e6;
}

[data-bs-theme="dark"] .table-border {
    background: #212529;
}

[data-bs-theme="dark"] .filter-bar {
    background: #212529;
}

[data-bs-theme="dark"] .alerts-panel {
    background: #212529;
}

[data-bs-theme="dark"] .theme-toggle {
    border-color: #495057;
    color: #dee2e6;
}

[data-bs-theme="dark"] .theme-toggle:hover {
    background: #2c3036;
}

[data-bs-theme="dark"] .btn-brand:hover {
    background-color: var(--brand-primary);
    filter: brightness(0.85);
}
