/* ============================================================
   ColdChain Platform — Custom Styles
   Bootstrap 5 augmentation (no Node.js dependencies)
   ============================================================ */

/* ---------- Layout ---------- */
:root {
    --navbar-h: 60px;
    --sidebar-w: 250px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f4f6f9;
    padding-top: var(--navbar-h);
}

#main-content {
    min-height: calc(100vh - var(--navbar-h) - 60px); /* navbar + footer */
    margin-left: var(--sidebar-w);
    transition: margin-left 0.3s ease;
}

@media (max-width: 991.98px) {
    #main-content {
        margin-left: 0;
    }
}

/* ---------- Navbar ---------- */
.navbar {
    height: var(--navbar-h);
    z-index: 1050;
}

.navbar .container-fluid {
    flex-wrap: nowrap;
}

.navbar-brand {
    font-size: 1.1rem;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: var(--navbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    padding-top: 0.5rem;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar .nav-link {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border-radius: 0;
    transition: background-color 0.15s ease;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    font-weight: 600;
}

.sidebar .nav-header {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

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

/* ---------- Cards ---------- */
.card {
    border: none;
    border-radius: 0.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.75rem 1rem;
}

/* ---------- Tables ---------- */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
}

.table td {
    vertical-align: middle;
}

/* ---------- KPI Cards ---------- */
.border-start.border-4 {
    border-left-width: 4px !important;
}

/* ---------- Badges ---------- */
.badge {
    font-weight: 500;
    font-size: 0.78rem;
    padding: 0.35em 0.65em;
}

/* ---------- Status colors ---------- */
.status-ok { color: #198754; }
.status-alert { color: #ffc107; }
.status-critical { color: #dc3545; }
.status-oos { color: #6c757d; }

/* ---------- Auth pages ---------- */
.min-vh-100 .card {
    border-radius: 0.75rem;
}

/* ---------- Footer ---------- */
.footer {
    margin-left: var(--sidebar-w);
    transition: margin-left 0.3s ease;
}

@media (max-width: 991.98px) {
    .footer {
        margin-left: 0;
    }
}

/* ---------- Notifications ---------- */
.notification-unread {
    background-color: #e8f4fd;
    border-left: 3px solid #0d6efd;
}

.notification-badge {
    font-size: 0.65rem;
}

/* ---------- Map ---------- */
#map, #fullmap {
    border-radius: 0 0 0.5rem 0.5rem;
}

/* ---------- Print ---------- */
@media print {
    .sidebar, .navbar, .footer, .btn, .breadcrumb {
        display: none !important;
    }
    #main-content {
        margin-left: 0 !important;
    }
    body {
        padding-top: 0;
    }
}

/* ---------- RTL Support ---------- */
[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
}

[dir="rtl"] #main-content {
    margin-left: 0;
    margin-right: var(--sidebar-w);
}

[dir="rtl"] .footer {
    margin-left: 0;
    margin-right: var(--sidebar-w);
}

@media (max-width: 991.98px) {
    [dir="rtl"] #main-content,
    [dir="rtl"] .footer {
        margin-right: 0;
    }
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }
    [dir="rtl"] .sidebar.show {
        transform: translateX(0);
    }
}

/* ---------- Scrollbar ---------- */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* ---------- Transitions ---------- */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Form improvements ---------- */
.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}

/* ---------- Misc ---------- */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}
