/* ==========================================================================
   Macroscope Integrated Tracking System (MITS) - Modern UI Design System
   Branding: #5d0001 (Deep Maroon), #d4af37 (Gold Accent), Font: Montserrat
   Clean, Modern, Mobile-First, Highly Responsive
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,600&display=swap');

:root {
    --maroon: #5d0001;
    --maroon-dark: #3e0001;
    --maroon-light: #800e10;
    --maroon-subtle: #fcf1f1;
    --maroon-glow: rgba(93, 0, 1, 0.15);
    
    --gold: #d4af37;
    --gold-dark: #b89326;
    --gold-light: #fff8e6;
    
    --bg-body: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --border: #e2e8f0;
    --border-subtle: #f1f5f9;
    
    --success: #10b981;
    --success-subtle: #ecfdf5;
    --warning: #f59e0b;
    --warning-subtle: #fffbeb;
    --danger: #ef4444;
    --danger-subtle: #fef2f2;
    --info: #0284c7;
    --info-subtle: #f0f9ff;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --shadow-maroon: 0 10px 25px -5px rgba(93, 0, 1, 0.25);
    
    --sidebar-width: 270px;
    --sidebar-collapsed-width: 80px;
    --navbar-height: 70px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.95rem;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

a {
    color: var(--maroon);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--maroon-light);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Utilities & Colors */
.text-maroon { color: var(--maroon) !important; }
.bg-maroon { background-color: var(--maroon) !important; color: #ffffff !important; }
.text-gold { color: var(--gold) !important; }
.bg-gold { background-color: var(--gold) !important; color: #ffffff !important; }

.bg-maroon-subtle { background-color: var(--maroon-subtle) !important; color: var(--maroon) !important; }
.bg-gold-subtle { background-color: var(--gold-light) !important; color: var(--gold-dark) !important; }

/* Custom Buttons */
.btn {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-maroon {
    background: var(--maroon);
    color: #ffffff;
    border: 1px solid var(--maroon);
    box-shadow: 0 2px 4px rgba(93, 0, 1, 0.2);
}
.btn-maroon:hover, .btn-maroon:focus {
    background: var(--maroon-dark);
    color: #ffffff;
    border-color: var(--maroon-dark);
    box-shadow: var(--shadow-maroon);
    transform: translateY(-1px);
}
.btn-maroon:active {
    transform: translateY(0);
}

.btn-outline-maroon {
    background: transparent;
    color: var(--maroon);
    border: 1.5px solid var(--maroon);
}
.btn-outline-maroon:hover {
    background: var(--maroon);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-gold {
    background: var(--gold);
    color: #ffffff;
    border: 1px solid var(--gold);
}
.btn-gold:hover {
    background: var(--gold-dark);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-pill {
    border-radius: var(--radius-full);
}

/* App Wrapper Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

/* Sidebar (Collapsible Desktop & Mobile Hamburger) */
.app-sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--maroon);
    overflow: hidden;
    white-space: nowrap;
}

.brand-badge {
    width: 38px;
    height: 38px;
    background: var(--maroon);
    color: #ffffff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(93, 0, 1, 0.3);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    transition: opacity 0.2s;
}

.brand-text .title {
    font-weight: 800;
    letter-spacing: -0.01em;
}

.brand-text .subtitle {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-toggle-btn {
    border: none;
    background: var(--surface-hover);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.sidebar-toggle-btn:hover {
    background: var(--maroon-subtle);
    color: var(--maroon);
}

.sidebar-menu-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 18px 12px;
}

.nav-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 10px 14px 6px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav-item .nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    transition: var(--transition);
    position: relative;
}

.sidebar-nav-item .nav-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    color: var(--text-muted);
    transition: var(--transition);
    flex-shrink: 0;
}

.sidebar-nav-item .nav-link:hover {
    background: var(--surface-hover);
    color: var(--maroon);
}
.sidebar-nav-item .nav-link:hover i {
    color: var(--maroon);
}

.sidebar-nav-item .nav-link.active {
    background: var(--maroon);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(93, 0, 1, 0.25);
}
.sidebar-nav-item .nav-link.active i {
    color: #ffffff;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Collapsed Sidebar on Desktop */
.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}
.sidebar-collapsed .app-sidebar .brand-text,
.sidebar-collapsed .app-sidebar .nav-section-title,
.sidebar-collapsed .app-sidebar .link-label,
.sidebar-collapsed .app-sidebar .sidebar-footer .user-info {
    display: none !important;
}
.sidebar-collapsed .app-sidebar .sidebar-nav-item .nav-link {
    justify-content: center;
    padding: 12px;
}
.sidebar-collapsed .app-sidebar .sidebar-nav-item .nav-link i {
    margin: 0;
    font-size: 1.25rem;
}
.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed-width);
}

/* Main Content Area */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-body);
}

/* Top Navbar */
.app-navbar {
    height: var(--navbar-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    backdrop-filter: blur(10px);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.quick-search {
    position: relative;
    width: 280px;
}
.quick-search input {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 8px 16px 8px 38px;
    font-size: 0.85rem;
    width: 100%;
    transition: var(--transition);
}
.quick-search input:focus {
    background: #ffffff;
    border-color: var(--maroon);
    outline: none;
    box-shadow: 0 0 0 3px var(--maroon-glow);
}
.quick-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.85rem;
}

/* User Profile Badge */
.user-dropdown-btn {
    border: 1px solid var(--border);
    background: #ffffff;
    border-radius: var(--radius-full);
    padding: 5px 14px 5px 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition);
}
.user-dropdown-btn:hover {
    background: var(--surface-hover);
    border-color: var(--maroon);
}
.avatar-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--maroon);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

/* App Content Area */
.app-content {
    flex: 1;
    padding: 24px;
}

/* Modern Card Design */
.card-mits {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    position: relative;
}
.card-mits:hover {
    box-shadow: var(--shadow-md);
}

.card-header-mits {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
}

.card-body-mits {
    padding: 20px;
}

/* Modern Stat Cards */
.stat-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--maroon);
}
.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-val {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}
.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Modern Badges */
.badge-status {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.02em;
}
.badge-status-work_order { background: var(--info-subtle); color: var(--info); border: 1px solid rgba(2, 132, 199, 0.2); }
.badge-status-shopping_list { background: var(--warning-subtle); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-status-in_production { background: var(--maroon-subtle); color: var(--maroon); border: 1px solid rgba(93, 0, 1, 0.2); }
.badge-status-completed { background: var(--success-subtle); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-status-cancelled { background: var(--danger-subtle); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }

/* Delivery Badges */
.badge-malang {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    font-weight: 700;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}
.badge-luar-kota {
    background: var(--maroon-subtle);
    color: var(--maroon);
    border: 1px solid rgba(93, 0, 1, 0.2);
    font-weight: 700;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

/* Table Design */
.table-mits {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.table-mits thead th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.table-mits tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.table-mits tbody tr:hover {
    background-color: rgba(93, 0, 1, 0.02);
}

/* Modern Form Controls */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-control, .form-select {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 10px 14px;
    color: var(--text-primary);
    background-color: #ffffff;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--maroon);
    box-shadow: 0 0 0 3px var(--maroon-glow);
    outline: none;
}

/* Filter Bar */
.filter-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 2px;
}
.filter-tab {
    padding: 10px 18px;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-muted);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}
.filter-tab:hover {
    color: var(--maroon);
}
.filter-tab.active {
    color: var(--maroon);
    border-bottom-color: var(--maroon);
}

/* Visual Production Timeline (Tracking UI) */
.tracking-timeline {
    position: relative;
    padding: 20px 0;
}
.timeline-item {
    display: flex;
    position: relative;
    padding-bottom: 30px;
}
.timeline-item:last-child {
    padding-bottom: 0;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 40px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.timeline-item.completed::before {
    background: var(--maroon);
}
.timeline-marker {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-light);
    flex-shrink: 0;
    z-index: 2;
    transition: var(--transition);
}
.timeline-item.completed .timeline-marker {
    background: var(--maroon);
    border-color: var(--maroon);
    color: #ffffff;
    box-shadow: 0 0 0 4px var(--maroon-glow);
}
.timeline-item.active .timeline-marker {
    background: #ffffff;
    border-color: var(--gold);
    color: var(--gold-dark);
    box-shadow: 0 0 0 5px rgba(212, 175, 55, 0.25);
    animation: pulse-ring 2s infinite;
}
.timeline-content {
    margin-left: 18px;
    padding-top: 6px;
    flex: 1;
}
.timeline-title {
    font-weight: 700;
    font-size: 0.98rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}
.timeline-time {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}
.timeline-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(212, 175, 55, 0); }
    100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); }
}

/* Public Hero Tracking */
.public-hero {
    background: linear-gradient(135deg, #5d0001 0%, #3e0001 100%);
    color: #ffffff;
    padding: 70px 20px 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.public-hero::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    height: 100px;
    background: var(--bg-body);
    border-radius: 50% 50% 0 0;
}
.tracking-search-box {
    max-width: 650px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}
.tracking-input-group {
    display: flex;
    background: #ffffff;
    border-radius: var(--radius-full);
    padding: 6px;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.4);
}
.tracking-input-group input {
    border: none;
    padding: 14px 24px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    border-radius: var(--radius-full);
    font-family: 'Montserrat', sans-serif;
}
.tracking-input-group input:focus {
    outline: none;
}
.tracking-input-group button {
    border-radius: var(--radius-full);
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 700;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 991px) {
    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 25px rgba(0,0,0,0.15);
    }
    .app-sidebar.show-mobile {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0 !important;
    }
    .quick-search {
        display: none;
    }
    .public-hero {
        padding: 50px 15px 60px;
    }
    .tracking-input-group {
        flex-direction: column;
        border-radius: var(--radius-md);
        padding: 10px;
    }
    .tracking-input-group input {
        border-radius: var(--radius-sm);
        margin-bottom: 8px;
        padding: 12px;
    }
    .tracking-input-group button {
        border-radius: var(--radius-sm);
        width: 100%;
    }
}

/* Backdrop for Mobile Sidebar */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1039;
}
.sidebar-backdrop.show {
    display: block;
}
