/* assets/css/style.css */
:root {
    --primary: #1a3c6e;
    --primary-light: #2563ab;
    --secondary: #e8f0fe;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1e293b;
    --gray: #64748b;
    --light: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: #f0f4f8; color: var(--dark); font-size: 14px; }
a { text-decoration: none; color: var(--primary-light); }
a:hover { color: var(--primary); }

/* ===== TOPBAR ===== */
.topbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 0;
    position: sticky; top: 0; z-index: 1030;
    box-shadow: var(--shadow-lg);
}
.topbar-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 38px; height: 38px; background: rgba(255,255,255,0.2); border-radius: 8px;
    display: flex; align-items: center; justify-content: center; font-size: 20px; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
.brand-tag { font-size: 11px; opacity: 0.75; }
.topbar-nav { display: flex; align-items: center; gap: 5px; }
.topbar-nav a {
    color: rgba(255,255,255,0.85); padding: 6px 14px; border-radius: 6px;
    font-size: 13px; font-weight: 500; transition: all 0.2s;
}
.topbar-nav a:hover, .topbar-nav a.active { background: rgba(255,255,255,0.2); color: white; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-badge {
    background: rgba(255,255,255,0.15); border-radius: 20px;
    padding: 5px 14px 5px 8px; display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 500;
}
.user-avatar {
    width: 30px; height: 30px; background: var(--accent); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: white;
}
.btn-logout {
    background: rgba(255,255,255,0.15); color: white; border: none;
    padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ===== SIDEBAR ===== */
.sidebar {
    width: 240px; min-height: calc(100vh - 60px);
    background: var(--white); box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    position: fixed; left: 0; top: 60px; overflow-y: auto; z-index: 100;
    transition: transform 0.3s;
}
.sidebar-section { padding: 20px 0 8px; }
.sidebar-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--gray); padding: 0 20px 8px;
}
.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; color: var(--dark); font-size: 13.5px; font-weight: 500;
    transition: all 0.2s; border-left: 3px solid transparent;
}
.sidebar-link i { width: 20px; color: var(--gray); font-size: 15px; }
.sidebar-link:hover { background: var(--secondary); color: var(--primary); border-left-color: var(--primary-light); }
.sidebar-link:hover i { color: var(--primary); }
.sidebar-link.active { background: var(--secondary); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.sidebar-link.active i { color: var(--primary); }
.sidebar-badge { margin-left: auto; background: var(--danger); color: white; border-radius: 10px; padding: 1px 7px; font-size: 11px; }

/* ===== MAIN LAYOUT ===== */
.main-wrap { margin-left: 240px; padding: 24px; min-height: calc(100vh - 60px); }
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--border);
}
.page-title { font-size: 22px; font-weight: 700; color: var(--dark); }
.page-title span { color: var(--primary-light); }
.breadcrumb-bar { font-size: 12px; color: var(--gray); margin-top: 2px; }

/* ===== STAT CARDS ===== */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--white); border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px;
    border-top: 4px solid var(--primary);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.green { border-top-color: var(--success); }
.stat-card.orange { border-top-color: var(--accent); }
.stat-card.red { border-top-color: var(--danger); }
.stat-card.blue { border-top-color: var(--info); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
    background: var(--secondary); color: var(--primary);
}
.stat-card.green .stat-icon { background: #d1fae5; color: var(--success); }
.stat-card.orange .stat-icon { background: #fef3c7; color: var(--accent); }
.stat-card.red .stat-icon { background: #fee2e2; color: var(--danger); }
.stat-card.blue .stat-icon { background: #dbeafe; color: var(--info); }
.stat-value { font-size: 26px; font-weight: 800; color: var(--dark); line-height: 1; }
.stat-label { font-size: 12px; color: var(--gray); font-weight: 500; margin-top: 4px; }

/* ===== CARDS ===== */
.card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden;
}
.card-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(90deg, #f8fafc, var(--white));
}
.card-title { font-size: 15px; font-weight: 700; color: var(--dark); display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--primary-light); }
.card-body { padding: 20px; }

/* ===== FORMS ===== */
.form-label { font-weight: 600; color: var(--dark); font-size: 13px; margin-bottom: 5px; }
.form-control, .form-select {
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    padding: 9px 12px; font-size: 13.5px; transition: all 0.2s;
    background: var(--white); color: var(--dark); width: 100%;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,171,0.15); outline: none;
}
.form-control.is-invalid { border-color: var(--danger); }
.input-group-text { background: var(--secondary); border: 1.5px solid var(--border); color: var(--gray); }

/* ===== BUTTONS ===== */
.btn { border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; padding: 8px 18px; transition: all 0.2s; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: var(--primary-light); color: white; }
.btn-primary:hover { background: var(--primary); color: white; transform: translateY(-1px); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-info { background: var(--info); color: white; }
.btn-secondary { background: var(--gray); color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--dark); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-icon { padding: 7px 10px; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead tr { background: linear-gradient(90deg, var(--primary), var(--primary-light)); color: white; }
.table thead th { padding: 12px 14px; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
.table tbody tr:hover { background: var(--secondary); }
.table tbody td { padding: 12px 14px; vertical-align: middle; }
.table tbody tr:last-child { border-bottom: none; }

/* ===== BADGES / STATUS ===== */
.badge-status { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-partial { background: #dbeafe; color: #1e40af; }
.badge-dispatched { background: #d1fae5; color: #065f46; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

/* ===== PRODUCT GRID ===== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.product-card {
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; cursor: pointer;
    border: 2px solid transparent;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.product-card.selected { border-color: var(--primary); background: var(--secondary); }
.product-img { width: 100%; height: 160px; object-fit: cover; background: #f1f5f9; }
.product-img-placeholder { width: 100%; height: 160px; background: linear-gradient(135deg,#e2e8f0,#cbd5e1); display: flex; align-items: center; justify-content: center; font-size: 48px; color: #94a3b8; }
.product-info { padding: 14px; }
.product-code { font-size: 11px; color: var(--gray); font-weight: 600; background: var(--secondary); padding: 2px 8px; border-radius: 10px; display: inline-block; margin-bottom: 6px; }
.product-name { font-weight: 700; font-size: 14px; color: var(--dark); margin-bottom: 4px; }
.product-desc { font-size: 12px; color: var(--gray); margin-bottom: 10px; line-height: 1.5; }
.product-price { font-size: 18px; font-weight: 800; color: var(--primary); }
.product-unit { font-size: 11px; color: var(--gray); }
.qty-input-wrap { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.qty-btn { width: 30px; height: 30px; border-radius: 6px; border: none; background: var(--primary-light); color: white; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qty-input { width: 60px; text-align: center; border: 1.5px solid var(--border); border-radius: 6px; padding: 5px; font-weight: 700; }

/* ===== CART SIDEBAR ===== */
.cart-sidebar {
    position: fixed; right: 0; top: 60px; bottom: 0;
    width: 340px; background: var(--white); box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    z-index: 200; display: flex; flex-direction: column; transform: translateX(100%);
    transition: transform 0.3s;
}
.cart-sidebar.open { transform: translateX(0); }
.cart-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.cart-items { flex: 1; overflow-y: auto; padding: 16px; }
.cart-item { background: var(--light); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; border: 1px solid var(--border); }
.cart-footer { padding: 16px; border-top: 2px solid var(--border); background: var(--light); }
.cart-total { font-size: 18px; font-weight: 800; color: var(--primary); }

/* ===== ORDER TRACKING ===== */
.track-steps { display: flex; align-items: center; justify-content: center; gap: 0; margin: 24px 0; flex-wrap: wrap; }
.track-step { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; min-width: 80px; }
.track-dot { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--border); background: var(--white); display: flex; align-items: center; justify-content: center; font-size: 16px; z-index: 1; color: var(--gray); }
.track-step.done .track-dot { background: var(--success); border-color: var(--success); color: white; }
.track-step.active .track-dot { background: var(--primary-light); border-color: var(--primary-light); color: white; box-shadow: 0 0 0 4px rgba(37,99,171,0.2); }
.track-line { flex: 1; height: 3px; background: var(--border); margin: 0 -5px; margin-top: -20px; z-index: 0; }
.track-line.done { background: var(--success); }
.track-label { font-size: 11px; font-weight: 600; color: var(--gray); text-align: center; }
.track-step.done .track-label, .track-step.active .track-label { color: var(--dark); }

/* ===== LOGIN PAGE ===== */
.login-page { min-height: 100vh; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, #60a5fa 100%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: white; border-radius: 20px; padding: 40px; width: 100%; max-width: 440px; box-shadow: 0 25px 50px rgba(0,0,0,0.25); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon { width: 70px; height: 70px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 34px; margin: 0 auto 12px; color: white; box-shadow: 0 8px 20px rgba(26,60,110,0.4); }
.login-title { font-size: 24px; font-weight: 800; color: var(--dark); }
.login-subtitle { font-size: 13px; color: var(--gray); margin-top: 4px; }
.tab-switcher { display: flex; background: var(--light); border-radius: 10px; padding: 4px; margin-bottom: 24px; }
.tab-btn { flex: 1; padding: 9px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; background: transparent; color: var(--gray); transition: all 0.2s; }
.tab-btn.active { background: white; color: var(--primary); box-shadow: var(--shadow); }

/* ===== ALERTS / NOTIFICATIONS ===== */
.alert-bar { padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ===== SEARCH BAR ===== */
.search-bar { position: relative; }
.search-bar input { padding-left: 38px; }
.search-bar i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray); }

/* ===== RESPONSIVE ===== */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrap { margin-left: 0; padding: 16px; }
    .cart-sidebar { width: 100%; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
    .topbar-nav { display: none; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .page-title { font-size: 17px; }
    .login-card { padding: 24px; }
}

/* ===== MOBILE MENU TOGGLE ===== */
.menu-toggle { display: none; background: rgba(255,255,255,0.15); border: none; color: white; width: 38px; height: 38px; border-radius: 8px; cursor: pointer; font-size: 18px; align-items: center; justify-content: center; }
@media (max-width: 991px) { .menu-toggle { display: flex; } }

/* ===== OVERLAY ===== */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }
.overlay.active { display: block; }

/* ===== PO DETAILS ===== */
.po-number-badge { font-size: 20px; font-weight: 800; color: var(--primary); background: var(--secondary); padding: 6px 18px; border-radius: 8px; display: inline-block; letter-spacing: 2px; }
.detail-row { display: flex; gap: 8px; margin-bottom: 8px; }
.detail-label { font-weight: 700; color: var(--gray); min-width: 130px; font-size: 12px; text-transform: uppercase; }
.detail-value { color: var(--dark); font-weight: 500; }

/* ===== PRINT ===== */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-wrap { margin: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ===== DATATABLES CUSTOM ===== */
.dataTables_wrapper .dataTables_filter input { border: 1.5px solid var(--border); border-radius: 6px; padding: 5px 10px; }
.dataTables_wrapper .dataTables_length select { border: 1.5px solid var(--border); border-radius: 6px; padding: 4px 8px; }
.paginate_button { border-radius: 6px !important; margin: 0 2px !important; }
.paginate_button.current { background: var(--primary-light) !important; border-color: var(--primary-light) !important; color: white !important; }

/* scroll to top btn */
#scrollTop { position: fixed; bottom: 24px; right: 24px; background: var(--primary-light); color: white; border: none; width: 42px; height: 42px; border-radius: 50%; cursor: pointer; font-size: 18px; display: none; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); z-index: 9999; transition: all 0.2s; }
#scrollTop:hover { background: var(--primary); transform: translateY(-2px); }
