/* ============================================================
   AMC Tracker — app.css
   EbizIndia Consulting Pvt. Ltd.
   Bootstrap 5 override + custom layout
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --amc-sidebar-width:    240px;
    --amc-topbar-height:    56px;
    --amc-sidebar-bg:       #1a1f36;
    --amc-sidebar-hover:    #252b45;
    --amc-sidebar-active:   #3d52d5;
    --amc-sidebar-text:     #c8cfe8;
    --amc-sidebar-muted:    #6b7499;
    --amc-sidebar-border:   rgba(255,255,255,0.07);
    --amc-topbar-bg:        #ffffff;
    --amc-topbar-border:    #e9ecef;
    --amc-body-bg:          #f4f6fb;
    --amc-card-radius:      0.6rem;
    --amc-primary:          #3d52d5;
    --amc-font:             'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--amc-font);
    background: var(--amc-body-bg);
    color: #212529;
    font-size: 0.925rem;
}

/* ── Layout Wrapper ────────────────────────────────────────── */
.amc-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.amc-sidebar {
    width: var(--amc-sidebar-width);
    min-width: var(--amc-sidebar-width);
    background: var(--amc-sidebar-bg);
    color: var(--amc-sidebar-text);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.25s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Mobile: sidebar hidden off-screen */
@media (max-width: 991.98px) {
    .amc-sidebar {
        transform: translateX(-100%);
    }
    .amc-sidebar.show {
        transform: translateX(0);
    }
    .amc-main {
        margin-left: 0 !important;
    }
}

.amc-main {
    margin-left: var(--amc-sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Sidebar Header ─────────────────────────────────────────── */
.sidebar-header {
    border-bottom: 1px solid var(--amc-sidebar-border);
    min-height: var(--amc-topbar-height);
}

.sidebar-brand {
    color: #ffffff !important;
    font-size: 1rem;
}

.sidebar-close {
    color: var(--amc-sidebar-muted) !important;
    padding: 0.25rem;
}

/* ── Sidebar Nav ────────────────────────────────────────────── */
.sidebar-nav {
    padding-top: 0.5rem;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--amc-sidebar-muted);
    padding: 1rem 1rem 0.25rem;
}

.sidebar-nav .nav-link {
    color: var(--amc-sidebar-text);
    border-radius: 0.4rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
}

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

.sidebar-nav .nav-link.active {
    background: var(--amc-sidebar-active);
    color: #ffffff;
    font-weight: 600;
}

.sidebar-nav .nav-link i {
    width: 1.2rem;
    text-align: center;
    flex-shrink: 0;
}

/* ── Sidebar Footer ─────────────────────────────────────────── */
.sidebar-footer {
    border-top: 1px solid var(--amc-sidebar-border);
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--amc-sidebar-active);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-footer .fw-semibold { color: #ffffff; }
.sidebar-footer .text-muted  { color: var(--amc-sidebar-muted) !important; }

/* ── Sidebar Overlay (mobile) ───────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1039;
}
.sidebar-overlay.show { display: block; }

/* ── Top Bar ────────────────────────────────────────────────── */
.amc-topbar {
    height: var(--amc-topbar-height);
    background: var(--amc-topbar-bg);
    border-bottom: 1px solid var(--amc-topbar-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    color: #343a40;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Content Area ───────────────────────────────────────────── */
.amc-content {
    flex: 1;
}

/* ── Footer ─────────────────────────────────────────────────── */
.amc-footer {
    border-top: 1px solid var(--amc-topbar-border);
    background: var(--amc-topbar-bg);
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    border-radius: var(--amc-card-radius);
}

/* ── Summary Cards ──────────────────────────────────────────── */
.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.summary-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    color: #1a1a2e;
}

.summary-label {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
}

.summary-card-link {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.summary-card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.10) !important;
}
.summary-card-link:hover .summary-value {
    color: var(--amc-primary);
}

/* ── Zone Cards ─────────────────────────────────────────────── */
.zone-header {
    font-size: 0.875rem;
    border-radius: var(--amc-card-radius) var(--amc-card-radius) 0 0;
}

.zone-header--danger  { background: #fff5f5; color: #842029; border-left: 4px solid #dc3545; }
.zone-header--warning { background: #fffdf0; color: #664d03; border-left: 4px solid #ffc107; }
.zone-header--info    { background: #f0f8ff; color: #055160; border-left: 4px solid #0dcaf0; }
.zone-header--primary { background: #f0f4ff; color: #084298; border-left: 4px solid #0d6efd; }

.zone-card--overdue  .table-hover > tbody > tr:hover { background: #fff8f8; }
.zone-card--critical .table-hover > tbody > tr:hover { background: #fffdf5; }

/* ── Table Utilities ────────────────────────────────────────── */
.btn-xs {
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1.4;
    border-radius: 0.3rem;
}

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

/* ── Login Page ──────────────────────────────────────────────── */
.amc-login-body {
    background: linear-gradient(135deg, #1a1f36 0%, #2d3561 50%, #1a1f36 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.amc-login-container {
    width: 100%;
    max-width: 420px;
}

.amc-login-card {
    border-radius: 1rem;
}

.login-icon {
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    background: var(--amc-primary);
    color: #fff;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.amc-login-container > p {
    color: rgba(255,255,255,0.5) !important;
}

/* ── Form Styles ─────────────────────────────────────────────── */
.form-label { font-size: 0.85rem; font-weight: 600; }

/* ── Badge Overrides ─────────────────────────────────────────── */
.badge.rounded-pill { font-size: 0.7rem; }

/* ── Responsive Tables ───────────────────────────────────────── */
@media (max-width: 575.98px) {
    .summary-value { font-size: 1.2rem; }
    .summary-icon  { width: 36px; height: 36px; font-size: 1rem; }
    .amc-content   { padding: 0.75rem !important; }
    /* 5 cards: 2 per row on xs, last one full width */
    .row > .col-6.col-lg { flex: 0 0 50%; max-width: 50%; }
    .row > .col-6.col-lg:last-child { flex: 0 0 100%; max-width: 100%; }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
    .amc-sidebar,
    .amc-topbar,
    .amc-footer,
    .btn,
    .no-print { display: none !important; }
    .amc-main { margin-left: 0 !important; }
    .amc-content { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
}

/* ── Scrollbar (sidebar) ─────────────────────────────────────── */
.amc-sidebar::-webkit-scrollbar { width: 4px; }
.amc-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* ── 30-Day Timeline Strip ───────────────────────────────────────────────── */
.timeline-strip {
    scrollbar-width: thin;
}
.timeline-strip::-webkit-scrollbar { height: 4px; }
.timeline-strip::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 2px; }

.timeline-day {
    border-right: 1px solid #f0f0f0;
    padding: 0 4px 4px;
}
.timeline-day:last-child { border-right: none; }

.timeline-day--today .timeline-day-label {
    background: var(--amc-primary);
    color: #fff !important;
    border-radius: 0.4rem;
    padding: 2px 4px;
}

.timeline-day-label { line-height: 1.2; font-size: 0.7rem; margin-bottom: 4px; }

.timeline-empty-dot {
    width: 6px; height: 6px;
    background: #dee2e6;
    border-radius: 50%;
    margin: 8px auto 0;
}

.timeline-item-chip {
    font-size: 0.68rem;
    line-height: 1.3;
    transition: opacity 0.15s;
}
.timeline-item-chip:hover { opacity: 0.8; }

/* ── Bulk Toolbar ─────────────────────────────────────────────────────────── */
.bulk-toolbar {
    background: #f8f9ff;
    border: 1px solid #d0d7ff;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    animation: slideDown 0.15s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
