/* =====================================================
   Aplikasi Stok Toko Rokok - Styles
   ===================================================== */

:root {
    --color-primary: #1a472a;
    --color-primary-light: #2d5a3d;
    --color-accent: #c9a227;
    --color-bg: #f5f5f0;
    --color-card: #ffffff;
    --color-text: #1a1a1a;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-success: #059669;
    --color-danger: #dc2626;
    --color-warning: #d97706;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.5;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
}

.nav-brand a {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-menu a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Page header */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary);
}

.page-header p {
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--color-text);
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26, 71, 42, 0.15);
}

.form-control::placeholder {
    color: var(--color-text-muted);
}

/* Select2 overrides */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px !important;
    border-radius: var(--radius) !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 0.25rem 0 !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-secondary {
    background: var(--color-border);
    color: var(--color-text);
}

.btn-secondary:hover {
    background: #d1d5db;
}

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

.btn-success:hover {
    filter: brightness(1.1);
}

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Table */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    background: var(--color-bg);
    font-weight: 600;
    color: var(--color-primary);
}

tr:hover td {
    background: rgba(26, 71, 42, 0.03);
}

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Stats */
.stat-card {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: #fff;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-card .label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Penjualan form - table layout */
.penjualan-table {
    margin-top: 1rem;
}

.penjualan-table th {
    white-space: nowrap;
}

.penjualan-table input[type="number"],
.penjualan-table input[type="text"] {
    width: 100%;
    min-width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.penjualan-table .select2-container {
    width: 100% !important;
}
/* Row totals */
.row-total {
    font-weight: 600;
    color: var(--color-primary);
}

.grand-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
    padding: 1rem;
    background: var(--color-bg);
    border-radius: var(--radius);
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* Form inline */
.form-inline {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.form-inline .form-group { margin-bottom: 0; }

/* Utility */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }

.select2-container {
    width: 100% !important;
}

/* ===== FIX DROPDOWN HARGA ===== */

.penjualan-table {
    table-layout: auto;
}

.penjualan-table th,
.penjualan-table td {
    white-space: nowrap;
}

/* Kolom harga biar lebar */
.penjualan-table th:nth-child(3),
.penjualan-table td:nth-child(3) {
    min-width: 140px;
}

/* Select full width */
.select-harga {
    width: 100% !important;
}

/* Select2 fix */
.select2-container {
    width: 100% !important;
}

/* Dropdown biar tidak kepotong */
.select2-dropdown {
    z-index: 9999 !important;
}

/* ===== RAPIIIN KOLOM ===== */

.col-merk { min-width: 180px; }
.col-varian { min-width: 220px; }
.col-harga { min-width: 120px; }
.col-qty { min-width: 90px; }

/* input qty biar center */
.qty-slof,
.qty-bungkus {
    text-align: center;
}

/* select biar full */
.select-merk,
.select-varian,
.select-harga {
    width: 100% !important;
}

/* select2 fix */
.select2-container {
    width: 100% !important;
}

/* biar dropdown ga ketutup */
.select2-dropdown {
    z-index: 9999 !important;
}

@media (max-width: 768px) {
    .btn {
        min-height: 36px;
    }
}

@media (max-width: 768px) {

    .hide-mobile {
        display: none;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 6px;
    }

    .btn-sm {
        font-size: 11px;
        padding: 4px 6px;
    }

    input[type="password"] {
        width: 50px !important;
    }
}


.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 12px;
    margin-bottom: 4px;
}

.form-group.full {
    grid-column: span 3;
}

.btn-block {
    width: 100%;
}

/* HP */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full {
        grid-column: span 1;
    }
}

.transfer-box {
    background: linear-gradient(135deg, #3f51b5, #2196f3);
    color: white;
    border-radius: 14px;
    padding: 15px;
}

.transfer-box .card-title {
    font-weight: bold;
    margin-bottom: 10px;
}

.transfer-form {
    width: 100%;
}

.transfer-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: end;
}

.input-group {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.input-group label {
    font-size: 12px;
    margin-bottom: 3px;
}

.input-group select,
.input-group input {
    padding: 8px;
    border-radius: 8px;
    border: none;
}

.btn-transfer {
    background: #ffeb3b;
    color: black;
    border: none;
    padding: 9px 14px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.btn-transfer:hover {
    background: #ffc107;
}