/* Font Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Kobivo Palette */
    --primary-color: #00B8D9;
    /* Turkuaz - Tech/Innovation */
    --primary-hover: #008DA6;
    --navy-blue: #1B2A49;
    /* Lacivert - Corporate */
    --secondary-color: #64748B;

    /* Action Colors */
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #3B82F6;

    /* Backgrounds */
    --bg-body: #F8FAFC;
    /* Softer Blue-Gray */
    --bg-card: #FFFFFF;
    --bg-input: #F1F5F9;

    /* Text */
    --text-main: #1E293B;
    --text-muted: #64748B;
    --text-navy: #1B2A49;

    /* UI Elements */
    --border-color: #E2E8F0;
    --border-radius: 16px;
    /* Modern roundness */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    padding-bottom: 100px;
    padding-top: 0;
    /* No top padding on desktop (sidebar layout) */
}

/* Container padding adjustment for fixed header */
.container {
    padding-top: 20px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    body {
        padding-top: 60px;
        padding-bottom: 80px;
        /* Only for bottom nav */
    }

    .container {
        padding-top: 10px;
    }

    /* Prevent iOS zoom on focus */
    .form-control,
    .form-select {
        font-size: 16px !important;
    }
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: var(--text-navy);
    letter-spacing: -0.025em;
    margin-top: 0;
}

/* Links */
a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* Modern Cards */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    font-weight: 700;
    color: var(--text-navy);
}

.card-body {
    padding: 1.5rem;
}

/* Forms */
.form-control {
    background-color: var(--bg-input);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0.85rem 1.2rem;
    font-size: 0.95rem;
    color: var(--text-navy);
    transition: var(--transition);
}

.form-control:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 184, 217, 0.1);
}

.form-label,
label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-navy);
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    transition: var(--transition);
    letter-spacing: 0.01em;
    touch-action: manipulation;
    /* Disable double-tap zoom */
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 184, 217, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-navy {
    background-color: var(--navy-blue);
    color: #fff;
}

.btn-navy:hover {
    background-color: #2D3E63;
    color: #fff;
}

/* Sidebar (Desktop) */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--navy-blue);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.95rem;
}

.sidebar-link i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-link.active {
    background: var(--primary-color);
    color: white;
    border-right: 3px solid white;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    padding: 0.75rem 0.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.sidebar-user i {
    font-size: 1.5rem;
    margin-right: 10px;
}

/* Main Content with Sidebar */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    padding: 2rem 0;
}

/* Mobile: Hide Sidebar, Show Top Navbar */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding-top: 10px;
    }
}

/* Mobile Top Navbar (App Experience) */
.navbar-mobile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1050;
    height: 60px;
    padding: 0;
}

.navbar-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
}

.mobile-back-btn {
    color: var(--primary-color);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px;
    font-size: 0.95rem;
}

.mobile-back-btn:hover {
    color: var(--primary-hover);
}

.mobile-profile-btn {
    padding: 10px;
    color: var(--text-muted);
}

/* Mobile Drawer Styles */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: -280px;
    /* Hidden start */
    width: 280px;
    height: 100vh;
    background: #fff;
    z-index: 2000;
    transition: transform 0.3s ease-in-out;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.mobile-drawer.open {
    transform: translateX(280px);
}

.mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 1999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-drawer-overlay.show {
    display: block;
    opacity: 1;
}

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

.drawer-nav {
    flex: 1;
    overflow-y: auto;
}

.drawer-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-navy);
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 4px;
    font-weight: 500;
    transition: var(--transition);
}

.drawer-link i {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 12px;
}

.drawer-link:active,
.drawer-link.active {
    background: var(--primary-color);
    color: #fff;
}

.drawer-link.text-danger:active {
    background: var(--danger-color);
    color: #fff;
}

/* Navbar (Top) - REMOVED, using sidebar now */
.navbar {
    background-color: #fff !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
}

.navbar-brand {
    font-weight: 800;
    color: var(--navy-blue) !important;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
}

.navbar-brand span {
    color: var(--primary-color);
}

/* Bottom Nav (Mobile) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    /* Fixed height to keep it consistent */
    background: #FFFFFF;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 1000;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.05);
    overflow: visible;
    /* Allow button to overflow */
}

.bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    gap: 4px;
    text-decoration: none;
    transition: var(--transition);
    touch-action: manipulation;
}

.bottom-nav .nav-item i {
    font-size: 1.25rem;
}

.bottom-nav .nav-item.active {
    color: var(--primary-color);
}

.nav-item-center {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
    top: -15px;
    /* Stand out effect */
}

.add-btn-main {
    width: 62px;
    height: 62px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-radius: 22px;
    /* Premium Squircle */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff !important;
    font-size: 1.8rem;
    box-shadow: 0 10px 25px rgba(0, 184, 217, 0.4);
    transition: var(--transition);
    border: none;
}

.add-btn-main:active {
    transform: scale(0.9);
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #F8FAFC;
    color: var(--navy-blue);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.table td {
    vertical-align: middle;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0.5rem;
}

/* Badges */
.badge {
    font-weight: 600;
    padding: 0.5em 0.85em;
    border-radius: 8px;
    letter-spacing: 0.02em;
}

/* Dashboard Metrics */
.card-metric-title {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.card-metric-value {
    color: var(--navy-blue);
    font-size: 2rem;
    font-weight: 800;
    margin-top: 0.5rem;
    letter-spacing: -0.03em;
}

.card-metric-icon {
    opacity: 0.15;
    color: var(--navy-blue);
}

/* Login Split Layout */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    padding-top: 0 !important;
    /* Override body padding for login */
    margin-top: -70px;
    /* Compensate for body padding */
}

.login-sidebar {
    background-color: var(--navy-blue);
    color: white;
    width: 45%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem;
    position: relative;
    overflow: hidden;
}

.login-sidebar::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 184, 217, 0.1) 0%, rgba(27, 42, 73, 0) 70%);
    top: -50%;
    left: -50%;
}

.login-form-area {
    width: 55%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 2rem;
}

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

.brand-logo-large {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 1rem;
    z-index: 1;
}

.brand-tagline {
    font-size: 1.5rem;
    font-weight: 300;
    opacity: 0.9;
    z-index: 1;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: var(--bg-input);
}

.selected-item {
    position: relative;
}

/* Modal Selector Styles */
.modal-lg {
    max-width: 800px;
}

.modal-body .table-responsive {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.modal-body .table thead {
    background: var(--bg-input);
}

.modal-body .table tbody tr {
    cursor: pointer;
    transition: var(--transition);
}

.modal-body .table tbody tr:hover {
    background-color: var(--bg-input);
}

/* Order Card Mobile (Image Inspired) */
.order-card-mobile {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.03);
    position: relative;
    transition: var(--transition);
}

.order-card-mobile:active {
    transform: scale(0.98);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.order-card-no {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-navy);
    margin: 0;
}

.order-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.order-card-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.order-card-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-navy);
    text-align: right;
    max-width: 60%;
}

.order-card-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-card-avatar {
    width: 24px;
    height: 24px;
    background: var(--bg-input);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--primary-color);
}

.order-card-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-card-total .value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-color);
}

.sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Mobile Login Adjustment */
@media (max-width: 768px) {
    .login-sidebar {
        display: none;
    }

    .login-form-area {
        width: 100%;
    }
}

/* Cari Card Mobile */
.cari-card-mobile {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
}

.cari-card-mobile:active {
    transform: scale(0.98);
}

.cari-card-icon {
    width: 50px;
    height: 50px;
    background: var(--bg-input);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.cari-card-info {
    flex: 1;
    min-width: 0;
}

.cari-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-navy);
    display: block;
    margin-bottom: 2px;
}

.cari-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cari-card-action {
    color: var(--border-color);
}


/* Mobile Order Flow Improvements */
.cart-item-mobile {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 15px;
    display: block;
}

.cart-item-info {
    min-width: 0;
}

.cart-item-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-navy);
    display: block;
}

.cart-item-price {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.quantity-control {
    display: inline-flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 25px;
    padding: 2px;
}

.quantity-control button {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
}

.quantity-control input {
    width: 30px;
    border: none;
    background: transparent;
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0;
}

.order-add-container {
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .order-add-container {
        padding-bottom: 20px;
    }

    .main-content {
        overflow-x: hidden;
    }

    .card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }

    /* Full Screen App Modals for Mobile */
    .modal-mobile-full .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-mobile-full .modal-content {
        height: 100%;
        border-radius: 0;
        border: none;
    }

    .container,
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }

    .row {
        margin-left: -10px;
        margin-right: -10px;
    }

    .row>* {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Mobile Checkout Navigation */
    .mobile-step-card {
        background: #fff;
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 12px;
        border: 1px solid var(--border-color);
    }

    .mobile-action-btn {
        width: 100%;
        text-align: left;
        padding: 15px;
        background: #fff;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-weight: 600;
        color: var(--text-navy);
        margin-bottom: 15px;
    }

    .mobile-action-btn i {
        color: var(--primary-color);
    }

    /* Product Card Mobile */
    .product-card-mobile {
        background: #fff;
        border-radius: 20px;
        padding: 18px;
        margin-bottom: 12px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        border: 1px solid rgba(0, 0, 0, 0.03);
        display: flex;
        flex-direction: column;
        gap: 12px;
        transition: var(--transition);
    }

    .product-card-mobile:active {
        transform: scale(0.98);
    }

    .product-card-top {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }

    .product-card-name {
        font-size: 1rem;
        font-weight: 700;
        color: var(--text-navy);
        flex: 1;
        line-height: 1.3;
    }

    .product-card-price {
        font-size: 1.1rem;
        font-weight: 800;
        color: var(--primary-color);
        margin-left: 10px;
        white-space: nowrap;
    }

    .product-card-bottom {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 10px;
        border-top: 1px solid var(--border-color);
    }

    .product-card-stock {
        font-size: 0.85rem;
        font-weight: 700;
    }

    .product-card-code {
        font-size: 0.75rem;
        color: var(--text-muted);
    }
}

.overflow-x-hidden {
    overflow-x: hidden;
}

.add-btn-main:active {
    transform: scale(0.9);
}

.order-card-mobile {
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.order-card-mobile:active {
    background: #f8f9fa !important;
}

.order-card-mobile .badge {
    letter-spacing: 0.02em;
}

.dashboard-wrapper h3,
.dashboard-wrapper h5 {
    letter-spacing: -0.02em;
}

.text-navy {
    color: var(--navy-blue) !important;
}

/* Modern Search Bar Fix */
.search-container {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.search-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 184, 217, 0.1) !important;
}

.search-container .input-group-text {
    color: var(--text-muted);
}

.search-container .form-control {
    background-color: transparent !important;
    border: none !important;
    padding-left: 0.5rem !important;
    font-weight: 500;
}

.search-container .form-control:focus {
    box-shadow: none !important;
}

/* Date Section Header (WhatsApp Style) */
.date-section-header {
    text-align: center;
    position: relative;
    margin: 25px 0 15px;
    z-index: 1;
}

.date-section-header span {
    background: #E8EDF2;
    padding: 5px 18px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--secondary-color);
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: inline-block;
}

.date-section-header::after {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    top: 50%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.05), transparent);
    z-index: -1;
}

.table-date-header {
    background-color: #f8f9fa !important;
    text-align: center;
    font-weight: 800;
    font-size: 0.7rem;
    color: var(--secondary-color);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: none !important;
}

/* Quick Action Button Styles */
.quick-action-btn {
    transition: var(--transition);
}

.quick-action-btn:active {
    transform: scale(0.95);
}

.icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fix modal backdrop on mobile */
.modal-backdrop {
    backdrop-filter: blur(5px);
    background-color: rgba(27, 42, 73, 0.4) !important;
}

.btn-close-custom {
    width: 50px;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border-radius: 50% !important;
}

/* Delivery Item Modal Styles */
.delivery-item {
    transition: background-color 0.2s ease;
}

.delivery-item:hover {
    background-color: #f8f9fa;
}

.delivery-item:active {
    background-color: #f1f5f9;
}