/**
 * NurseryLive Delivery — Custom CSS Overrides
 * AdminLTE 3.x customizations for NurseryLive Delivery branding
 */

/* =============================================
   1. BRAND & COLOR OVERRIDES
   ============================================= */

:root {
    --nl-green:       #2d6a4f;
    --nl-green-light: #40916c;
    --nl-green-dark:  #1b4332;
    --nl-accent:      #52b788;
    --nl-leaf:        #95d5b2;
    --nl-bg-light:    #f4f6f9;
}

/* Sidebar brand link */
.brand-link {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.8rem 0.5rem;
}

.brand-link .brand-text {
    font-size: 1.1rem;
}

/* Sidebar active item */
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active {
    background-color: var(--nl-green);
    color: #fff;
}

.sidebar-dark-primary .nav-sidebar .nav-treeview > .nav-item > .nav-link.active {
    background-color: rgba(45, 106, 79, 0.3);
    color: #fff;
}

/* Sidebar header labels */
.nav-header {
    font-size: 0.7rem;
    letter-spacing: 1px;
    padding: 0.75rem 1rem 0.25rem;
    color: rgba(255, 255, 255, 0.4) !important;
    font-weight: 600;
}


/* =============================================
   2. CONTENT & LAYOUT
   ============================================= */

/* Content header page title */
.content-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #343a40;
}

/* Main content background */
.content-wrapper {
    background-color: var(--nl-bg-light);
}

/* Card styling */
.card {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.25rem;
    transition: box-shadow 0.2s ease-in-out;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.card-outline .card-header {
    background-color: transparent;
}

.card .card-title {
    font-weight: 600;
    font-size: 0.95rem;
}


/* =============================================
   3. SMALL BOX (DASHBOARD STATS)
   ============================================= */

.small-box {
    border-radius: 8px;
    transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.small-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.small-box .inner h3 {
    font-size: 2rem;
    font-weight: 700;
}

.small-box .inner p {
    font-size: 0.9rem;
}

.small-box .icon {
    top: 10px;
    right: 15px;
    font-size: 60px;
    opacity: 0.2;
    transition: opacity 0.15s;
}

.small-box:hover .icon {
    opacity: 0.35;
}

.small-box-footer {
    border-radius: 0 0 8px 8px;
}


/* =============================================
   4. DELIVERY STATUS BADGES
   ============================================= */

.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.6em;
    letter-spacing: 0.3px;
}

/* Delivery-specific status colors */
.badge-status-delivered    { background-color: #28a745; color: #fff; }
.badge-status-pending      { background-color: #ffc107; color: #212529; }
.badge-status-cancelled    { background-color: #dc3545; color: #fff; }
.badge-status-in-transit   { background-color: #17a2b8; color: #fff; }
.badge-status-out-for-delivery { background-color: #007bff; color: #fff; }
.badge-status-picked-up    { background-color: #6f42c1; color: #fff; }
.badge-status-booked       { background-color: #6610f2; color: #fff; }
.badge-status-assigned     { background-color: #20c997; color: #fff; }
.badge-status-failed       { background-color: #dc3545; color: #fff; }
.badge-status-rto          { background-color: #e83e8c; color: #fff; }
.badge-status-returned     { background-color: #fd7e14; color: #fff; }
.badge-status-ndr          { background-color: #795548; color: #fff; }
.badge-status-processing   { background-color: #007bff; color: #fff; }

/* Provider status */
.badge-provider-active   { background-color: #28a745; color: #fff; }
.badge-provider-inactive { background-color: #6c757d; color: #fff; }
.badge-provider-paused   { background-color: #ffc107; color: #212529; }


/* =============================================
   5. TABLES
   ============================================= */

.table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-top: none;
    font-weight: 600;
    white-space: nowrap;
}

.table-sm td,
.table-sm th {
    padding: 0.5rem 0.75rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.04);
}


/* =============================================
   6. FORMS & BUTTONS
   ============================================= */

.form-control:focus {
    border-color: var(--nl-accent);
    box-shadow: 0 0 0 0.2rem rgba(82, 183, 136, 0.25);
}

.btn-primary {
    background-color: var(--nl-green);
    border-color: var(--nl-green);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--nl-green-dark);
    border-color: var(--nl-green-dark);
}

.btn-outline-primary {
    color: var(--nl-green);
    border-color: var(--nl-green);
}

.btn-outline-primary:hover {
    background-color: var(--nl-green);
    border-color: var(--nl-green);
    color: #fff;
}


/* =============================================
   7. FLASH MESSAGES
   ============================================= */

.flash-message {
    border-radius: 6px;
    border-left: 4px solid;
    animation: flashSlideIn 0.3s ease-out;
}

.flash-message.alert-success { border-left-color: #28a745; }
.flash-message.alert-danger  { border-left-color: #dc3545; }
.flash-message.alert-warning { border-left-color: #ffc107; }
.flash-message.alert-info    { border-left-color: #17a2b8; }

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


/* =============================================
   8. LOGIN PAGE
   ============================================= */

.login-box {
    width: 400px;
    max-width: 95vw;
}

.login-box .card {
    border: none;
}

.login-logo {
    margin-bottom: 20px;
}

.icheck-primary input[type="checkbox"] {
    margin-right: 6px;
}


/* =============================================
   9. ERROR PAGES
   ============================================= */

.error-page {
    padding: 40px 0;
}

.error-page .headline {
    font-size: 6rem;
    font-weight: 300;
    float: left;
    margin-right: 30px;
}

.error-page .error-content {
    margin-left: 160px;
}

@media (max-width: 576px) {
    .error-page .headline {
        float: none;
        font-size: 4rem;
        text-align: center;
    }
    .error-page .error-content {
        margin-left: 0;
        text-align: center;
    }
}


/* =============================================
   10. DELIVERY-SPECIFIC COMPONENTS
   ============================================= */

/* Tracking timeline */
.tracking-timeline {
    position: relative;
    padding-left: 30px;
}

.tracking-timeline::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
}

.tracking-timeline .timeline-step {
    position: relative;
    margin-bottom: 1.5rem;
    padding-left: 15px;
}

.tracking-timeline .timeline-step::before {
    content: '';
    position: absolute;
    left: -23px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #dee2e6;
    border: 3px solid #fff;
    z-index: 1;
}

.tracking-timeline .timeline-step.active::before {
    background: var(--nl-green);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.2);
}

.tracking-timeline .timeline-step.completed::before {
    background: #28a745;
}

.tracking-timeline .timeline-step .step-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #343a40;
}

.tracking-timeline .timeline-step .step-time {
    font-size: 0.8rem;
    color: #6c757d;
}

.tracking-timeline .timeline-step .step-detail {
    font-size: 0.85rem;
    color: #495057;
    margin-top: 0.25rem;
}

/* Provider logo display */
.provider-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    padding: 4px;
    background: #fff;
}

.provider-logo-sm {
    width: 24px;
    height: 24px;
}

.provider-logo-lg {
    width: 60px;
    height: 60px;
}

/* Delivery summary card */
.delivery-summary-card {
    border-left: 4px solid var(--nl-green);
}

.delivery-summary-card .delivery-id {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85rem;
    color: #6c757d;
}

/* Map container */
.map-container {
    width: 100%;
    height: 70vh;
    min-height: 400px;
    border-radius: 4px;
}

/* Live map rider marker */
.rider-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--nl-green);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}


/* =============================================
   11. RESPONSIVE TWEAKS
   ============================================= */

@media (max-width: 768px) {
    .small-box .inner h3 {
        font-size: 1.5rem;
    }

    .content-header h1 {
        font-size: 1.25rem;
    }

    .breadcrumb {
        display: none;
    }
}

/* Ensure tables don't overflow cards */
.card-body.table-responsive {
    padding: 0;
}

.card-body.table-responsive .table {
    margin-bottom: 0;
}

/* Navbar items — compact spacing */
.navbar-nav .nav-link {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
}
.navbar-nav.ml-auto .nav-link {
    padding-left: 0.3rem;
    padding-right: 0.3rem;
    font-size: 0.9rem;
}
@media (max-width: 575.98px) {
    .navbar-nav.ml-auto .nav-link {
        padding-left: 0.2rem;
        padding-right: 0.2rem;
    }
    .navbar-nav .nav-link {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
}

/* Footer */
.main-footer {
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #dee2e6;
}


/* =============================================
   12. UTILITY CLASSES
   ============================================= */

.text-rupee::before {
    content: '\20B9';
    font-family: inherit;
}

.cursor-pointer {
    cursor: pointer;
}

.no-wrap {
    white-space: nowrap;
}

.text-monospace-sm {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.82rem;
}

.text-nl-green { color: var(--nl-green) !important; }
.text-nl-accent { color: var(--nl-accent) !important; }
.bg-nl-green { background-color: var(--nl-green) !important; }
.bg-nl-accent { background-color: var(--nl-accent) !important; }
.border-nl-green { border-color: var(--nl-green) !important; }

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading spinner overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--nl-green);
}

/* Callout (AdminLTE extension) */
.callout {
    border-radius: 6px;
}

/* Weight / dimension display */
.weight-display {
    font-weight: 600;
    font-size: 0.9rem;
}

.weight-display .unit {
    font-weight: 400;
    color: #6c757d;
    font-size: 0.8rem;
}

/* AWB number styling */
.awb-number {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: var(--nl-green);
    font-weight: 600;
}

/* Cost breakdown */
.cost-breakdown dt {
    font-weight: 500;
    color: #6c757d;
}

.cost-breakdown dd {
    font-weight: 600;
    text-align: right;
}

.cost-breakdown .total-row {
    border-top: 2px solid #343a40;
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}


/* =============================================
   13. MOBILE FILTERS
   ============================================= */

/* The floating filter button - only visible on mobile */
.mobile-filter-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1040;
    border-radius: 50px;
    padding: 10px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: none !important; /* Hidden by default, JS shows it */
}

/* On mobile: hide the desktop filter card */
@media (max-width: 767.98px) {
    .filter-card {
        display: none !important;
    }
    .mobile-filter-btn.has-filters {
        display: inline-block !important;
    }
}

/* Active filter indicator badge on mobile button */
.mobile-filter-btn .filter-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    line-height: 20px;
    text-align: center;
}

/* Make modal filter form fields stack vertically */
#mobileFilterBody .row {
    flex-direction: column;
}
#mobileFilterBody .row > [class*="col-"] {
    max-width: 100%;
    flex: 0 0 100%;
}
#mobileFilterBody .form-group {
    margin-bottom: 1rem;
}


/* =============================================
   14. ANALYTICS & CHARTS
   ============================================= */

/* Chart container sizing */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 300px;
}

.chart-container canvas {
    max-width: 100%;
}

/* SLA indicator */
.sla-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.sla-indicator .sla-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.sla-indicator.sla-good .sla-dot { background-color: #28a745; }
.sla-indicator.sla-warning .sla-dot { background-color: #ffc107; }
.sla-indicator.sla-critical .sla-dot { background-color: #dc3545; }

/* Comparison table highlight */
.comparison-best {
    background-color: rgba(40, 167, 69, 0.08) !important;
    font-weight: 600;
}

.comparison-worst {
    background-color: rgba(220, 53, 69, 0.06) !important;
}
