/* ==========================================================================
   OrbitX Textile Stock ERP - Design System
   Matches OrbitX Brand Palette: Indigo, Violet, Electric Blue & Obsidian Navy
   100% Mobile Responsive for Phones, Tablets, Laptops & Desktops
   ========================================================================== */

:root {
    --orbit-primary: #4f46e5;          /* Electric Indigo */
    --orbit-primary-dark: #3730a3;     /* Deep Indigo */
    --orbit-primary-light: #6366f1;    /* Vibrant Indigo */
    --orbit-blue: #3b82f6;             /* Orbit Cyan-Blue */
    --orbit-violet: #7c3aed;           /* Purple Accent */
    --orbit-dark: #0b0f19;             /* Obsidian Navbar */
    --orbit-dark-surface: #111827;
    --orbit-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #3b82f6 100%);
    --orbit-gradient-header: linear-gradient(135deg, #0b0f19 0%, #171e2e 100%);
    
    --success: #059669;
    --success-light: #10b981;
    --warning: #d97706;
    --danger: #dc2626;
    --surface: #ffffff;
    --background: #f1f5f9;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bottom-nav-height: 62px;
}

* {
    box-sizing: border-box;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    background-color: var(--background);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    -webkit-font-smoothing: antialiased;
}

/* Touch responsiveness */
button, input, select, textarea, .btn {
    touch-action: manipulation;
}

/* Top Navbar with OrbitX Branding */
.top-navbar {
    background: #0b0f19;
    background: linear-gradient(180deg, #111728 0%, #0b0f19 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.35);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    z-index: 1030;
}

.brand-logo-pill {
    background: #ffffff;
    padding: 4px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease;
    max-height: 36px;
    max-width: 180px;
    overflow: hidden;
}

.brand-logo-pill:hover {
    transform: scale(1.02);
}

.brand-logo-img {
    height: 26px !important;
    max-height: 26px !important;
    width: auto !important;
    max-width: 160px !important;
    display: block;
    object-fit: contain;
}

.navbar-brand img {
    max-height: 26px !important;
    width: auto !important;
    max-width: 160px !important;
    object-fit: contain;
}

.brand-text-block {
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    padding-left: 8px;
    margin-left: 4px;
    line-height: 1.15;
}

.brand-app-title {
    display: block;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #ffffff;
}

.brand-app-sub {
    display: block;
    font-size: 0.65rem;
    color: #94a3b8;
    letter-spacing: 0.3px;
}

.top-navbar .nav-link {
    font-weight: 500;
    color: #cbd5e1 !important;
    transition: all 0.15s ease-in-out;
    border-radius: 8px;
    padding: 0.42rem 0.65rem !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.86rem;
    white-space: nowrap;
}

.top-navbar .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.08);
}

.top-navbar .nav-link.active {
    background: #4f46e5 !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.45);
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .top-navbar .nav-link {
        padding: 0.35rem 0.5rem !important;
        font-size: 0.82rem !important;
        gap: 4px !important;
    }
}

.top-navbar .dropdown-menu {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    padding: 0.5rem;
    min-width: 270px;
}

.top-navbar .dropdown-item {
    color: #e2e8f0;
    border-radius: 8px;
    padding: 0.45rem 0.65rem;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.top-navbar .dropdown-item:hover, .top-navbar .dropdown-item:focus {
    background: rgba(99, 102, 241, 0.2);
    color: #ffffff;
}

.top-navbar .dropdown-divider {
    border-top-color: rgba(255, 255, 255, 0.08);
}

.nav-dropdown-title {
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-dropdown-desc {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-left: 24px;
    margin-top: 1px;
}

.user-profile-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 24px;
    padding: 3px 10px 3px 4px !important;
    transition: all 0.15s ease;
}

.user-profile-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(99, 102, 241, 0.5) !important;
}

.user-avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--orbit-gradient);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

/* Mobile Offcanvas Drawer */
.mobile-offcanvas {
    background: #0b0f19 !important;
    color: #ffffff;
    border-right: 1px solid rgba(99, 102, 241, 0.3) !important;
    max-width: 320px;
    width: 85vw;
}

.mobile-offcanvas .offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.85rem 1rem;
}

.mobile-offcanvas .offcanvas-body {
    padding: 1rem;
}

.mobile-nav-group-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    color: #64748b;
    margin-top: 1rem;
    margin-bottom: 0.4rem;
    padding-left: 0.5rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    margin-bottom: 3px;
}

.mobile-nav-link:hover, .mobile-nav-link.active {
    background: rgba(99, 102, 241, 0.2);
    color: #ffffff;
}

.mobile-nav-link.active {
    background: #4f46e5;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.mobile-nav-link i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

/* Shortcut badge in UI */
.shortcut-badge {
    font-family: monospace;
    font-size: 0.65rem;
    padding: 1px 5px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    color: #f8fafc;
    margin-left: 4px;
    text-transform: uppercase;
}

.shortcut-badge-dark {
    font-family: monospace;
    font-size: 0.7rem;
    padding: 2px 5px;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #334155;
    font-weight: 600;
}

/* Buttons */
.btn-primary {
    background: var(--orbit-gradient) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4) !important;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

/* Cards & Containers */
.card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    background-color: var(--surface);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
    font-weight: 700;
}

/* Big Stat Cards for Operator Ease */
.stat-card {
    border-radius: 12px;
    padding: 1.1rem;
    display: flex;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--orbit-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.stat-card.inward {
    border-left-color: #059669;
}

.stat-card.outward {
    border-left-color: #3b82f6;
}

.stat-card.stock {
    border-left-color: #7c3aed;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    flex-shrink: 0;
}

.stat-icon.inward {
    background: #d1fae5;
    color: #059669;
}

.stat-icon.outward {
    background: #dbeafe;
    color: #2563eb;
}

.stat-icon.stock {
    background: #ede9fe;
    color: #7c3aed;
}

.stat-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.15;
}

.stat-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Quick Action Cards on Dashboard */
.action-card {
    border-radius: 12px;
    padding: 1rem 1.2rem;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #ffffff !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.action-card.btn-inward {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

.action-card.btn-outward {
    background: var(--orbit-gradient);
}

.action-card.btn-stock {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
}

/* Status Badges */
.badge-available, .badge-stock-available {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    border: 1px solid #a7f3d0 !important;
    font-weight: 600;
}

.badge-reserved, .badge-stock-reserved {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fde68a !important;
    font-weight: 600;
}

.badge-dispatched, .badge-stock-dispatched {
    background-color: #e0e7ff !important;
    color: #3730a3 !important;
    border: 1px solid #c7d2fe !important;
    font-weight: 600;
}

/* Barcode pill */
.barcode-badge {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    letter-spacing: 0.8px;
    background: #0f172a;
    color: #38bdf8;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    display: inline-block;
}

/* Barcode Scanner Input Box */
.scanner-box {
    background: #ffffff;
    border: 2px solid #4f46e5;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.12);
}

.scanner-input {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    font-family: monospace;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 14px;
}

.scanner-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
}

/* Roll Chaining List (Inward & Outward) */
.taka-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 3px;
}

.taka-chip-remove {
    cursor: pointer;
    color: #ef4444;
    font-weight: bold;
    padding: 0 2px;
}

.taka-chip-remove:hover {
    color: #b91c1c;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    z-index: 1040;
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.08);
}

.mobile-bottom-nav .nav-item {
    flex: 1;
    text-align: center;
}

.mobile-bottom-nav .nav-link-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-decoration: none;
    padding: 3px 2px;
    transition: color 0.15s ease;
}

.mobile-bottom-nav .nav-link-mobile i {
    font-size: 1.35rem;
    margin-bottom: 2px;
}

.mobile-bottom-nav .nav-link-mobile.active {
    color: var(--orbit-primary);
}

/* Footer */
footer {
    margin-top: auto;
    background-color: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Tablets & Mobile Smartphones < 768px)
   ========================================================================== */
@media (max-width: 768px) {
    body {
        padding-bottom: calc(var(--bottom-nav-height) + 16px) !important;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    .shortcut-badge, .shortcut-badge-dark {
        display: none !important;
    }

    /* Larger touch-friendly buttons */
    .btn {
        padding: 0.55rem 0.95rem;
        font-size: 0.95rem;
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn-sm {
        padding: 0.4rem 0.7rem;
        font-size: 0.85rem;
        min-height: 36px;
    }

    /* Forms & Inputs */
    .form-control, .form-select {
        font-size: 16px !important; /* Prevents auto-zoom on iOS */
        padding: 0.6rem 0.8rem;
        border-radius: 8px;
    }

    /* Stat Cards */
    .stat-card {
        padding: 0.85rem 1rem;
    }

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

    /* Tables touch horizontal scroll */
    .table-responsive {
        border-radius: 8px;
        border: 1px solid var(--border-color);
        -webkit-overflow-scrolling: touch;
    }

    .table th, .table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.82rem;
        white-space: nowrap;
    }
}

/* Challan Presentation & Print Styling */
.challan-title-badge {
    background: #0f172a;
    color: #ffffff;
    padding: 5px 14px;
    border-radius: 4px;
    font-weight: 800;
    letter-spacing: 1px;
    font-size: 0.95rem;
    display: inline-block;
}

.table-purple {
    background-color: #f5f3ff !important;
}

.text-purple {
    color: #4338ca !important;
    font-weight: 700;
}

/* Vivid & High Contrast Outward Lot Badges */
.bg-purple {
    background-color: #4338ca !important;
    color: #ffffff !important;
}

.bg-purple-subtle {
    background-color: #ede9fe !important;
    color: #4338ca !important;
    border-color: #c7d2fe !important;
}

.badge.bg-purple {
    background-color: #4338ca !important;
    color: #ffffff !important;
    padding: 0.35em 0.65em !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 2px rgba(67, 56, 202, 0.25);
}

.badge.bg-purple-subtle {
    background-color: #ede9fe !important;
    color: #4338ca !important;
    border: 1px solid #c7d2fe !important;
    padding: 0.35em 0.65em !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px;
}

/* ==========================================================================
   PRINT MEDIA RULES (Official Commercial Delivery Challan)
   ========================================================================== */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm 10mm 10mm 10mm;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 9.5pt !important;
        padding-bottom: 0 !important;
    }

    .no-print, header, nav, footer, .mobile-bottom-nav, .btn, .alert, .modal, .breadcrumb {
        display: none !important;
    }

    .challan-sheet {
        border: 1px solid #000000 !important;
        box-shadow: none !important;
        padding: 10px !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .challan-table {
        border: 1px solid #000000 !important;
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .challan-table th, .challan-table td {
        border: 1px solid #000000 !important;
        padding: 4px 6px !important;
        font-size: 8.5pt !important;
        color: #000000 !important;
    }

    .challan-table thead th {
        background-color: #e2e8f0 !important;
        color: #000000 !important;
        font-weight: 700 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .challan-title-badge {
        background: #000000 !important;
        color: #ffffff !important;
        border: 1px solid #000000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .table-purple {
        background-color: transparent !important;
    }
}

/* ==========================================================================
   OrbitX Floating Toast Notification Engine (Bottom-Right)
   Replaces ugly native browser popups with sleek, reactive alert cards
   ========================================================================== */
.orbit-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10900;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    width: calc(100vw - 32px);
    pointer-events: none;
}

.orbit-toast {
    pointer-events: auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.25), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
    border: 1px solid rgba(226, 232, 240, 0.9);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.orbit-toast.fade-out {
    opacity: 0;
    transform: translateX(30px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: -12px;
}

.orbit-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15rem;
}

.orbit-toast-content {
    flex-grow: 1;
    min-width: 0;
}

.orbit-toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #0f172a;
    line-height: 1.25;
    margin-bottom: 3px;
}

.orbit-toast-desc {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.4;
    word-break: break-word;
}

.orbit-toast-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    font-size: 1.1rem;
    line-height: 1;
    transition: color 0.15s ease;
}
.orbit-toast-close:hover {
    color: #0f172a;
}

/* Toast Varieties */
.orbit-toast-success {
    border-left: 5px solid #10b981;
}
.orbit-toast-success .orbit-toast-icon {
    background: #ecfdf5;
    color: #059669;
}

.orbit-toast-warning {
    border-left: 5px solid #f59e0b;
}
.orbit-toast-warning .orbit-toast-icon {
    background: #fffbeb;
    color: #d97706;
}

.orbit-toast-danger, .orbit-toast-error {
    border-left: 5px solid #ef4444;
}
.orbit-toast-danger .orbit-toast-icon, .orbit-toast-error .orbit-toast-icon {
    background: #fef2f2;
    color: #dc2626;
}

.orbit-toast-info {
    border-left: 5px solid #3b82f6;
}
.orbit-toast-info .orbit-toast-icon {
    background: #eff6ff;
    color: #2563eb;
}

/* Modal Stacking & Layering Fix */
#addLotStockModal {
    z-index: 1070 !important;
}
.modal-backdrop.show:nth-of-type(even) {
    z-index: 1065 !important;
}
