﻿/* ============ ROOT VARIABLES ============ */
:root {
    --orange: #f26522;
    --blue: #2b3990;
    --green: #39b54a;
    --purple: #92278f;
    --bg: #f4f7f6;
    --dark: #2c3e50;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg);
    color: #333;
}

/* ============ HEADER ============ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: linear-gradient(90deg, var(--orange), var(--blue));
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.header-left {
    display: flex;
    align-items: center;
}

.brand-name {
    font-size: 20px;
    font-weight: 700;
    margin-left: 15px;
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}

.firm-info {
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
}

.logout-btn {
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 6px;
}

    .logout-btn:hover {
        background: rgba(255, 255, 255, 0.35);
    }

/* ============ SIDEBAR (Base) ============ */
.sidebar {
    position: fixed;
    top: 65px;
    left: 0;
    bottom: 0;
    width: 260px;
    background: #fff;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.25s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    padding: 10px 8px;
}

    .sidebar.collapsed {
        width: 0;
        overflow: hidden;
        padding: 0;
    }

    /* Custom scrollbar for sidebar */
    .sidebar::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 3px;
    }

        .sidebar::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
        }

/* ============ MAIN CONTENT ============ */
.main-content {
    margin-left: 260px;
    margin-top: 65px;
    padding: 25px;
    transition: margin-left 0.25s ease;
    min-height: calc(100vh - 65px);
}

    .main-content.expanded {
        margin-left: 0;
    }

/* ============ CARDS ============ */
.card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
    border-top: 3px solid var(--blue);
}

    .card h3 {
        margin-top: 0;
        color: var(--blue);
        font-size: 17px;
    }

/* ============ PAGE HEADER ============ */
.page-header h2 {
    color: var(--blue);
    font-size: 22px;
    margin: 0 0 20px 0;
    border-left: 5px solid var(--orange);
    padding-left: 12px;
}

/* ============ FORMS ============ */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

    .form-group label {
        font-size: 13px;
        color: #555;
        margin-bottom: 5px;
        font-weight: 600;
    }

.form-control {
    padding: 9px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: 0.2s;
}

    .form-control:focus {
        border-color: var(--blue);
        box-shadow: 0 0 0 3px rgba(43, 57, 144, 0.1);
    }

.col-1 {
    width: 8%;
}

.col-2 {
    width: 16%;
}

.col-3 {
    width: 24%;
}

.col-4 {
    width: 32%;
}

.col-6 {
    width: 48%;
}

/* ============ BUTTONS ============ */
.btn-primary {
    background: linear-gradient(90deg, var(--orange), var(--blue));
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: 0.2s;
}

    .btn-primary:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 10px rgba(242, 101, 34, 0.3);
    }

    .btn-primary.full-width {
        width: 100%;
    }

.btn-sm {
    font-size: 12px;
    padding: 4px 8px;
    background: #eef2f7;
    border-radius: 4px;
    color: var(--blue);
    text-decoration: none;
    margin-right: 4px;
}

/* ============ GRID ============ */
.grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

    .grid th {
        background: linear-gradient(90deg, var(--blue), var(--purple));
        color: #fff;
        padding: 11px;
        text-align: left;
        font-weight: 600;
    }

    .grid td {
        padding: 10px 11px;
        border-bottom: 1px solid #eef2f7;
    }

    .grid tr:hover td {
        background: #f9fbfd;
    }

/* ============ BADGES ============ */
.badge-active {
    background: #d4f7dc;
    color: #1d7a35;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-inactive {
    background: #fde2e2;
    color: #b91c1c;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-booked {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-transit {
    background: #fef3c7;
    color: #d97706;
}

.badge-delivered {
    background: #d1fae5;
    color: #059669;
}

.badge-cancelled {
    background: #fee2e2;
    color: #dc2626;
}

.badge-topay {
    background: #e0e9ff;
    color: #2563eb;
}

.badge-paid {
    background: #d1fae5;
    color: #059669;
}

/* ============ LOGIN ============ */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--orange), var(--blue), var(--purple));
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    height: 80px;
    margin-bottom: 10px;
}

.login-box h2 {
    color: var(--blue);
    margin: 10px 0 5px;
    font-size: 20px;
}

.subtitle {
    color: #888;
    font-size: 13px;
    margin-bottom: 25px;
}

.login-box .form-group {
    margin-bottom: 15px;
    text-align: left;
}

.login-footer {
    margin-top: 20px;
    font-size: 13px;
}

    .login-footer a {
        color: var(--blue);
        text-decoration: none;
    }

.error-msg {
    color: #d32f2f;
    font-size: 13px;
    display: block;
    margin-top: 10px;
}

.success-msg {
    color: #2e7d32;
    font-size: 13px;
    display: block;
    margin-top: 10px;
    font-weight: 600;
}

/* ============ DASHBOARD STATS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 25px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.06);
    border-left: 5px solid var(--blue);
}

    .stat-card.orange {
        border-left-color: var(--orange);
    }

    .stat-card.green {
        border-left-color: var(--green);
    }

    .stat-card.purple {
        border-left-color: var(--purple);
    }

    .stat-card i {
        font-size: 32px;
        color: var(--blue);
    }

    .stat-card.orange i {
        color: var(--orange);
    }

    .stat-card.green i {
        color: var(--green);
    }

    .stat-card.purple i {
        color: var(--purple);
    }

    .stat-card h3 {
        margin: 0;
        font-size: 24px;
        color: var(--dark);
    }

    .stat-card p {
        margin: 3px 0 0;
        font-size: 13px;
        color: #888;
    }

/* =====================================================
   ============ NEW MENU STYLES (CATEGORY-BASED) =======
   ===================================================== */

/* Single link (Dashboard) */
.menu-single {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #334155;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 4px;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

    .menu-single:hover {
        background: #eff6ff;
        color: #2563eb;
        border-left-color: #2563eb;
        transform: translateX(2px);
    }

    .menu-single i {
        font-size: 15px;
        width: 20px;
        text-align: center;
        color: #2563eb;
    }

    .menu-single.active {
        background: linear-gradient(90deg, #eff6ff, #dbeafe);
        color: #2563eb;
        font-weight: 700;
        border-left-color: #2563eb;
    }

/* ============ CATEGORY CONTAINER ============ */
.menu-category {
    margin-bottom: 3px;
}

/* ============ CATEGORY HEADER ============ */
.menu-cat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 700;
    color: #334155;
    transition: all 0.15s ease;
    user-select: none;
    border-left: 3px solid transparent;
}

    .menu-cat-head:hover {
        background: #eff6ff;
        color: #2563eb;
        border-left-color: #2563eb;
    }

    .menu-cat-head > i:first-child {
        font-size: 15px;
        width: 20px;
        text-align: center;
        color: #2563eb;
        flex-shrink: 0;
    }

    .menu-cat-head > span:first-of-type {
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

/* Count badge */
.cat-count {
    background: #e0e7ff;
    color: #4338ca;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 800;
    flex-shrink: 0;
}

/* Arrow */
.cat-arrow {
    font-size: 11px !important;
    color: #94a3b8 !important;
    transition: transform 0.25s ease;
    flex-shrink: 0;
    width: auto !important;
}

/* Rotate arrow when open */
.menu-category.open .cat-arrow {
    transform: rotate(180deg);
    color: #2563eb !important;
}

.menu-category.open .menu-cat-head {
    background: #f8fafc;
    color: #2563eb;
    border-left-color: #2563eb;
}

/* ============ SUB ITEMS CONTAINER ============ */
.menu-sub-items {
    padding: 4px 0 4px 14px;
    margin: 2px 0 6px 22px;
    border-left: 2px solid #e0e7ff;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ SUB MENU ITEMS ============ */
.menu-sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12.5px;
    color: #475569;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
    margin-bottom: 1px;
    border-left: 3px solid transparent;
}

    .menu-sub-item:hover {
        background: #f0f7ff;
        color: #2563eb;
        padding-left: 16px;
        border-left-color: #93c5fd;
    }

    .menu-sub-item i {
        font-size: 10px;
        color: #94a3b8;
        transition: 0.15s;
    }

    .menu-sub-item:hover i {
        color: #2563eb;
    }

    /* Active state */
    .menu-sub-item.active {
        background: linear-gradient(90deg, #eff6ff, #dbeafe);
        color: #2563eb;
        font-weight: 700;
        border-left-color: #2563eb;
    }

        .menu-sub-item.active i {
            color: #2563eb;
        }

/* ============ MOBILE RESPONSIVE ============ */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
    }

        .sidebar:not(.collapsed) {
            transform: translateX(0);
        }

    .main-content {
        margin-left: 0;
    }

    .brand-name {
        font-size: 16px;
    }

    .header-right {
        gap: 10px;
        font-size: 12px;
    }

    .firm-info {
        display: none;
    }
}
/* ============================================================
   ============ MOBILE RESPONSIVE ENHANCEMENTS ===============
   ============================================================ */

/* Responsive table wrapper - use <div class="table-responsive"> around tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
}

/* Mobile-first touch targets */
@media (max-width: 768px) {
    /* Buttons - full width & easy tap */
    .btn-primary, .btn-sm, .btn-apply, .btn-print, .btn-excel {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Inputs - larger for touch */
    .form-control, input[type="text"], input[type="date"], select, textarea {
        min-height: 42px;
        font-size: 15px; /* Prevent zoom on iOS */
    }

    /* Prevent iOS zoom on input focus */
    input, select, textarea {
        font-size: 16px !important;
    }

    /* Cards on mobile */
    .card {
        border-radius: 8px;
    }

    /* Page header */
    .page-header {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
        justify-content: space-between;
    }

        .page-header h2 {
            flex: 1;
            min-width: 150px;
        }

    /* Badges smaller */
    .badge {
        font-size: 9px;
        padding: 3px 8px;
    }
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-content {
        padding: 18px;
    }

    .card {
        padding: 18px;
    }
}

/* Print styles - hide sidebar/header when printing */
@media print {
    .header, .sidebar, .sidebar-overlay, .hamburger-btn, .sidebar-close-btn {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}