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

:root {
    --bg-main: #f8fafc;
    --bg-panel: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    
    --color-primary: #1d4ed8;
    --color-primary-hover: #1e40af;
    --color-accent: #ef4444;
    --color-accent-hover: #dc2626;
    --color-success: #10b981;
    --color-success-hover: #059669;
    --color-warning: #f59e0b;
    --color-warning-hover: #d97706;
    
    --border-glow: rgba(29, 78, 216, 0.08);
    --border-light: #e2e8f0;
    --shadow-premium: 0 10px 30px -5px rgba(15, 23, 42, 0.06), 0 4px 6px -2px rgba(15, 23, 42, 0.03);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --color-primary-glow: rgba(29, 78, 216, 0.05);
    --color-accent-glow: rgba(239, 68, 68, 0.03);
}

/* Custom Theme Overrides */
body.theme-pink {
    --bg-main: #fdf2f8; /* Soft pink background */
    --bg-input: #fdf4f5;
    --color-primary: #ec4899; /* Pink-500 */
    --color-primary-hover: #db2777; /* Pink-600 */
    --border-glow: rgba(236, 72, 153, 0.08);
    --color-primary-glow: rgba(236, 72, 153, 0.08);
    --color-accent-glow: rgba(219, 39, 119, 0.04);
}
body.theme-purple {
    --bg-main: #faf5ff; /* Soft purple background */
    --bg-input: #f5f3ff;
    --color-primary: #8b5cf6; /* Purple-500 */
    --color-primary-hover: #7c3aed; /* Purple-600 */
    --border-glow: rgba(139, 92, 246, 0.08);
    --color-primary-glow: rgba(139, 92, 246, 0.08);
    --color-accent-glow: rgba(124, 58, 237, 0.04);
}
body.theme-orange {
    --bg-main: #fff7ed; /* Soft orange background */
    --bg-input: #fffaf2;
    --color-primary: #f97316; /* Orange-500 */
    --color-primary-hover: #ea580c; /* Orange-600 */
    --border-glow: rgba(249, 115, 22, 0.08);
    --color-primary-glow: rgba(249, 115, 22, 0.08);
    --color-accent-glow: rgba(234, 88, 12, 0.04);
}
body.theme-green {
    --bg-main: #f0fdf4; /* Soft green background */
    --bg-input: #f4fbf7;
    --color-primary: #10b981; /* Emerald-500 */
    --color-primary-hover: #059669; /* Emerald-600 */
    --border-glow: rgba(16, 185, 129, 0.08);
    --color-primary-glow: rgba(16, 185, 129, 0.08);
    --color-accent-glow: rgba(5, 150, 105, 0.04);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, var(--color-primary-glow) 0px, transparent 50%),
        radial-gradient(at 100% 100%, var(--color-accent-glow) 0px, transparent 50%);
    background-attachment: fixed;
}

body::before, body::after {
    content: '';
    position: fixed;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.06;
    animation: floatGlow 15s infinite alternate ease-in-out;
}

body::before {
    background: var(--color-primary);
    top: 15%;
    left: 5%;
}

body::after {
    background: var(--color-accent);
    bottom: 15%;
    right: 5%;
    animation-delay: -7.5s;
}

@keyframes floatGlow {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(120px, 60px) scale(1.4);
    }
}

/* Scrollbar Custom */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* UTILITIES */
.hidden {
    display: none !important;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ANIMATIONS */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ============================================================
   VIEW 1: LOGIN PAGE
   ============================================================ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    box-shadow: var(--shadow-premium), 0 0 40px var(--border-glow);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
}

.login-header h1 span {
    color: var(--color-primary);
    text-shadow: 0 0 15px var(--color-primary);
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
    background: var(--bg-card);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(29, 78, 216, 0.25);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: rgba(15, 23, 42, 0.05);
}

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

.btn-success:hover {
    background: var(--color-success-hover);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.btn-danger {
    background: var(--color-accent);
    color: white;
}

.btn-danger:hover {
    background: var(--color-accent-hover);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.25);
}

.btn-warning {
    background: var(--color-warning);
    color: white;
}

.btn-warning:hover {
    background: var(--color-warning-hover);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

/* ============================================================
   VIEW 2: MAIN DASHBOARD & SYSTEM
   ============================================================ */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* TOPBAR */
.topbar {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    padding: 14px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-brand {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

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

.topbar-nav {
    display: flex;
    gap: 8px;
    background: rgba(15, 23, 42, 0.03);
    padding: 4px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-light);
}

.nav-tab {
    padding: 8px 20px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    color: var(--text-main);
}

.nav-tab.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 10px rgba(29, 78, 216, 0.2);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-badge {
    text-align: right;
}

.user-badge .name {
    font-weight: 600;
    font-size: 14px;
    display: block;
}

.user-badge .role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: block;
}

/* MAIN CONTENT AREA */
.main-content {
    flex: 1;
    padding: 30px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* ============================================================
   TAB: KASIR / POS VIEW
   ============================================================ */
.pos-grid {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 30px;
}

@media (max-width: 1024px) {
    .pos-grid {
        grid-template-columns: 1fr;
    }
}

/* LEFT COLUMN: PRODUCTS CATALOG */
.catalog-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: calc(100vh - 170px);
    min-width: 0;
    width: 100%;
}

/* POS SUB-TAB SYSTEM */
.pos-subtab-bar {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.pos-subtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    padding: 10px 18px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
}

.pos-subtab-btn:hover {
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.04);
}

.pos-subtab-btn.active {
    color: var(--color-primary);
    background: rgba(29, 78, 216, 0.06);
}

.pos-subtab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
}

.subtab-badge {
    background: var(--color-accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
    line-height: 1;
}

.pos-subview {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.register-items-container {
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
}

/* POS SEARCH SUGGESTIONS DROPDOWN */
.pos-search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-top: 6px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
    z-index: 999;
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.pos-search-suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s ease;
}

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

.pos-search-suggestion-item:hover {
    background: rgba(29, 78, 216, 0.05);
}

.pos-search-suggestion-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pos-search-suggestion-name {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-main);
}

.pos-search-suggestion-sku {
    font-size: 11px;
    color: var(--text-muted);
}

.pos-search-suggestion-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pos-search-suggestion-price {
    font-weight: 700;
    font-size: 13px;
    color: var(--color-accent);
}

.pos-search-suggestion-stock {
    font-size: 11px;
    color: var(--text-muted);
}



.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    color: var(--text-main);
    padding: 10px 20px 10px 45px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--bg-card);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.category-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    max-width: 100%;
}

.filter-pill {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.filter-pill:hover {
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.04);
}

.filter-pill.active {
    background: linear-gradient(135deg, var(--color-primary), #3b82f6);
    border-color: transparent;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.25);
}

/* PRODUCT GRID */
.product-grid-container {
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}

.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
}

.pos-product-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.pos-product-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--color-primary);
    box-shadow: 0 12px 30px rgba(29, 78, 216, 0.12);
    background: var(--bg-card);
}

/* KELAS IMAGE BARU */
.product-image-wrapper {
    width: 100%;
    height: 110px;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.product-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pos-product-card:hover .product-card-image {
    transform: scale(1.06);
}

.product-card-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.admin-product-thumbnail {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    display: inline-block;
    vertical-align: middle;
}

.pos-product-card.out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
}

.pos-product-card.out-of-stock:hover {
    transform: none;
    border-color: var(--border-light);
    box-shadow: none;
}

.product-sku-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.05);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.product-cat-label {
    font-size: 11px;
    color: var(--color-primary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.product-name-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
    flex: 1;
}

.product-price-label {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-accent);
}

.product-stock-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    padding-top: 8px;
}

.stock-indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    margin-right: 4px;
}

.stock-indicator.safe { background: var(--color-success); }
.stock-indicator.warning { background: var(--color-warning); }
.stock-indicator.danger { background: var(--color-accent); }

/* RIGHT COLUMN: POS REGISTER */
.register-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 170px);
    box-shadow: var(--shadow-premium);
    min-width: 0;
    width: 100%;
}

.register-panel h2 {
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.register-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
    padding-right: 4px;
}

.register-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    animation: fadeIn 0.2s ease;
}

.register-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.register-item-name {
    font-weight: 600;
    font-size: 14px;
}

.register-item-price {
    font-size: 12px;
    color: var(--text-muted);
}

.register-item-price span.custom-price-badge {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.register-qty-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-btn {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-light);
    background: var(--bg-input);
    color: var(--text-main);
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.qty-btn:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.qty-display {
    min-width: 22px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
}

.register-item-subtotal {
    min-width: 90px;
    text-align: right;
    font-weight: 700;
    font-size: 14px;
}

.register-item-actions {
    margin-left: 10px;
}

.delete-item-btn {
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.15s ease;
}

.delete-item-btn:hover {
    color: var(--color-accent);
}

.register-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 60px 0;
    font-size: 14px;
}

/* TOTAL SUMMARY SECTION */
.register-summary {
    border-top: 1px dashed var(--border-light);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-muted);
}

.summary-row.grand-total {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
    margin-top: 4px;
}

.summary-row.grand-total span:last-child {
    color: var(--color-primary);
}

/* POS REGISTER CUSTOM BUTTONS */
.register-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.register-actions .btn {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 8px;
    white-space: nowrap;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.register-actions .btn-danger {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #dc2626;
    box-shadow: none;
}

.register-actions .btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

.register-actions .btn-success {
    background: var(--color-success);
    border: 1px solid transparent;
    color: white;
}

.register-actions .btn-success:hover {
    background: var(--color-success-hover);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

/* INPUT DISKON & BAYAR */
.checkout-fields {
    background: rgba(15, 23, 42, 0.015);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkout-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.checkout-row label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    width: 105px;
    flex-shrink: 0;
}

.checkout-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-main);
    padding: 8px 14px;
    font-size: 13.5px;
    text-align: right;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 0;
}

.checkout-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.register-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

/* ============================================================
   TAB: ADMIN PANEL VIEW
   ============================================================ */
.admin-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* SUMMARY STATS CARDS */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06), 0 0 20px rgba(29, 78, 216, 0.04);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card.revenue::after { background: var(--color-primary); }
.stat-card.transactions::after { background: var(--color-success); }
.stat-card.all-revenue::after { background: var(--color-warning); }

.stat-icon {
    font-size: 32px;
    background: var(--bg-input);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.stat-card.revenue:hover .stat-icon {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--color-primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.stat-card.transactions:hover .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--color-success);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.stat-card.all-revenue:hover .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--color-warning);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

.stat-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-details .value {
    font-size: 24px;
    font-weight: 800;
}

.stat-details .label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* TWO PANELS: LEFT MANAGEMENT, RIGHT HISTORY/CHART */
.admin-content-split {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 30px;
}

@media (max-width: 900px) {
    .admin-content-split {
        grid-template-columns: 1fr;
    }
}

.admin-sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px;
    height: fit-content;
}

.admin-menu-item {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-menu-item:hover {
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.03);
}

.admin-menu-item.active {
    background: var(--color-primary);
    color: white;
}

/* SUBMENU & SO STYLING Overrides */
.admin-submenu {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding-left: 16px;
    margin-top: -4px;
    margin-bottom: 4px;
}

.admin-submenu .admin-menu-item.active {
    background: rgba(29, 78, 216, 0.08) !important;
    color: var(--color-primary) !important;
    box-shadow: none !important;
}

.opname-split-container {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.opname-product-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 12px;
}

.admin-panel-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    min-height: 480px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    width: 100%;
}

.admin-panel-card h2 {
    font-size: 20px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* FORMS AND TABLES */
.table-responsive {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tampilkan indikator scrollbar horizontal secara paksa agar user mobile tahu tabel bisa digeser */
.table-responsive::-webkit-scrollbar {
    height: 8px;
    display: block !important;
}

.table-responsive::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.02);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(29, 78, 216, 0.3);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(29, 78, 216, 0.6);
}

.table-premium {
    width: 100%;
    min-width: 650px; /* Garansi lebar minimum agar tidak gepeng di mobile dan bisa di-scroll horizontal */
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.table-premium th {
    background: rgba(15, 23, 42, 0.02);
    border-bottom: 2px solid var(--border-light);
    padding: 14px 16px;
    font-weight: 700;
    color: var(--text-muted);
}

.table-premium td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
}

.table-premium tr:hover td {
    background: rgba(15, 23, 42, 0.01);
}

.badge-role {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-role.admin {
    background: rgba(29, 78, 216, 0.1);
    color: var(--color-primary);
}

.badge-role.cashier {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

/* CRUD MODAL FORM */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    padding: 30px;
    box-shadow: var(--shadow-premium);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.modal-lg {
    max-width: 800px;
    width: 95%;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.close-btn:hover {
    color: var(--text-main);
}

.modal-footer {
    border-top: 1px solid var(--border-light);
    padding-top: 16px;
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* TOAST NOTIF */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
}

.toast {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-premium), 0 10px 25px rgba(15, 23, 42, 0.08);
    color: var(--text-main);
    padding: 14px 28px;
    border-radius: var(--radius-full);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   RECEIPT / STRUK (PRINT STYLES)
   ============================================================ */
.receipt-wrapper {
    background: white;
    color: black;
    padding: 20px;
    width: 320px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid #ccc;
    margin: 0 auto;
}

.receipt-header {
    text-align: center;
    margin-bottom: 15px;
}

.receipt-header h2 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 2px;
}

.receipt-divider {
    border-bottom: 1px dashed black;
    margin: 10px 0;
}

.receipt-item-line {
    display: flex;
    justify-content: space-between;
}

.receipt-total-line {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
}

/* Tampilan di Screen */
#receiptModal .modal-content {
    background: white;
    color: black;
    max-width: 380px;
}

#receiptModal .close-btn {
    color: #666;
}

#receiptModal .close-btn:hover {
    color: black;
}

/* CSS Khusus Print */
@media print {
    body * {
        visibility: hidden;
    }
    #receiptModal, #receiptModal * {
        visibility: visible;
    }
    #receiptModal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
    }
    #receiptModal .modal-header,
    #receiptModal .modal-footer {
        display: none !important;
    }
    .receipt-wrapper {
        border: none;
        padding: 0;
        margin: 0;
        width: 100%;
    }
}

/* Dashboard Grid Layout (5 Produk Terlaris & Penjualan per Kasir) */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 30px;
    margin-top: 24px;
}

/* ============================================================
   RESPONSIVE DESIGN SYSTEM OVERRIDES (V2.0 POLISH)
   ============================================================ */

/* Screens < 1024px (Tablets & Landscape Mobile) */
@media (max-width: 1024px) {
    .pos-grid,
    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }
    .catalog-panel,
    .register-panel {
        max-height: none; /* Let them expand naturally on vertical stack */
    }
    .product-grid-container {
        max-height: 480px; /* Scrolling inside the grid */
        overflow-y: auto;
    }
    .register-items {
        max-height: 320px; /* Limit cart height in stack view */
        overflow-y: auto;
    }
}

/* Screens < 900px (Tablets & Mobile Admin Layout) */
@media (max-width: 900px) {
    .admin-content-split {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }
    .admin-sidebar {
        flex-direction: row !important;
        overflow-x: auto;
        padding: 8px;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        max-width: 100%;
        border-radius: var(--radius-md);
    }
    .admin-menu-item {
        padding: 10px 18px;
        font-size: 13px;
        flex-shrink: 0;
    }
}

/* Screens < 768px (Mobile Portrait) */
@media (max-width: 768px) {
    body {
        padding-bottom: 90px !important; /* Beri ruang agar konten tidak tertutup bar navigasi bawah */
    }

    .tab-text {
        display: block !important;
        font-size: 10px;
        font-weight: 600;
        margin-top: 4px;
        letter-spacing: 0;
        text-transform: none;
        opacity: 0.8;
    }
    .nav-tab, 
    .admin-menu-item {
        padding: 8px 12px;
        font-size: 18px; /* Ukuran icon */
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
    }
    .admin-sidebar {
        flex-direction: row !important;
        justify-content: space-around;
        width: 100%;
        overflow-x: visible;
        white-space: normal;
        gap: 4px;
    }
    .topbar {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
        text-align: center;
    }
    
    /* Pindahkan bar navigasi utama (POS vs Admin) ke bawah layar secara sticky */
    .topbar-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.95); /* Latar belakang putih menyatu tema */
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-light);
        border-bottom: none;
        border-radius: 0;
        padding: 10px 0;
        display: flex;
        justify-content: space-around;
        flex-wrap: nowrap;
        z-index: 1000;
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    }
    
    .topbar-user {
        width: 100%;
        justify-content: space-between;
        border-top: 1px solid var(--border-light);
        padding-top: 10px;
    }
    .user-badge {
        text-align: left;
    }
    .main-content {
        padding: 16px;
    }
    .stats-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .admin-content-split {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }
}

/* Screens < 576px (Small Mobile) */
@media (max-width: 576px) {
    .modal-content {
        padding: 20px;
        width: 95%;
        margin: 10px;
    }
    .modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
    }
    .modal-footer .btn {
        width: 100%;
    }
    .category-filters {
        -webkit-overflow-scrolling: touch;
    }
}

/* Screens < 480px (Extra Small Mobile) */
@media (max-width: 480px) {
    .pos-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
    .pos-product-card {
        padding: 12px;
        gap: 8px;
    }
    .product-sku-badge {
        display: none; /* Hide SKU on tiny screens to save space */
    }
    .product-name-title {
        font-size: 13px;
    }
    .product-price-label {
        font-size: 15px;
    }
    .register-item-row {
        flex-wrap: wrap;
        gap: 8px;
    }
    .register-item-info {
        min-width: 100%;
    }
    .register-item-subtotal {
        min-width: fit-content;
        flex: 1;
    }
    .checkout-fields {
        padding: 10px;
    }
    .checkout-row label {
        width: 70px;
        font-size: 11px;
    }
}

/* ============================================================
   TABLE REPLACEMENT CARD LISTS FOR MOBILE DEVICES (V2.0 UX)
   ============================================================ */
.desktop-only {
    display: block !important;
}
.mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    .mobile-only {
        display: block !important;
    }
    
    .mobile-list-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 14px;
        width: 100%;
    }
    
    .mobile-list-card {
        background: var(--bg-card);
        border: 1px solid var(--border-light);
        border-radius: var(--radius-md);
        padding: 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        transition: all 0.2s ease;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    }
    
    .mobile-list-card:hover {
        background: var(--bg-card);
        border-color: rgba(29, 78, 216, 0.3);
    }
    
    .mobile-list-card .card-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0; /* Enforces text clipping */
    }
    
    .mobile-list-card .sku {
        font-size: 11px;
        color: var(--text-muted);
        font-family: monospace;
        margin-top: 2px;
    }
    
    .mobile-list-card .cat {
        font-size: 10px;
        color: var(--color-primary);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .mobile-list-card .title {
        font-size: 15px;
        font-weight: 600;
        color: var(--text-main);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .mobile-list-card .price-stock {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 13px;
        margin-top: 8px;
        border-top: 1px solid var(--border-light);
        padding-top: 8px;
    }
    
    .mobile-list-card .price {
        color: var(--color-accent);
        font-weight: 700;
    }
    
    .mobile-list-card .stock {
        color: var(--text-muted);
    }
    
    .mobile-list-card .card-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .mobile-list-card .card-actions .btn {
        width: 80px;
        padding: 6px 10px;
        font-size: 12px;
        border-radius: var(--radius-sm);
    }
}

/* ============================================================
   QRIS PAYMENT TERMINAL CUSTOM ANIMATIONS
   ============================================================ */
.qris-laser {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, rgba(16, 185, 129, 0) 10%, rgba(16, 185, 129, 1) 50%, rgba(16, 185, 129, 0) 90%);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
    animation: qris-scanning 2s infinite ease-in-out;
}

@keyframes qris-scanning {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

.qris-pulse-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--color-warning);
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(245, 158, 11, 0.4);
    animation: qris-pulse 1.5s infinite;
}

@keyframes qris-pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

.qris-pulse-dot.success {
    background-color: var(--color-success);
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    animation: qris-pulse-success 1.5s infinite;
}

@keyframes qris-pulse-success {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Desktop hide mobile POS switcher */
.mobile-pos-switcher {
    display: none;
}

/* ============================================================
   RESPONSIVE MOBILE VIEW OVERRIDES (< 768px)
   ============================================================ */
@media (max-width: 767px) {
    /* Main Content Padding */
    .main-content {
        padding: 12px;
    }

    /* Topbar Stacked Layout */
    .topbar {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .topbar-brand {
        font-size: 18px;
        text-align: center;
    }
    
    .topbar-user {
        justify-content: space-between;
        width: 100%;
        order: -1; /* Place user profile and logout at top */
    }
    
    .user-badge {
        text-align: left;
    }
    
    .topbar-nav {
        width: 100%;
        justify-content: center;
    }
    
    .nav-tab {
        flex: 1;
        text-align: center;
        padding: 8px 10px;
        font-size: 13px;
    }

    /* POS Grid overrides */
    .pos-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        display: flex;
        flex-direction: column;
    }

    /* Mobile switcher row */
    .mobile-pos-switcher {
        display: flex !important;
        background: var(--bg-panel);
        border: 1px solid var(--border-light);
        border-radius: var(--radius-md);
        padding: 4px;
        gap: 6px;
        box-shadow: var(--shadow-premium);
        margin-bottom: 4px;
    }
    
    .mobile-switch-btn {
        flex: 1;
        padding: 10px 12px;
        border: none;
        background: none;
        font-size: 13px;
        font-weight: 700;
        color: var(--text-muted);
        border-radius: var(--radius-sm);
        cursor: pointer;
        transition: all 0.2s ease;
        text-align: center;
    }
    
    .mobile-switch-btn.active {
        background: var(--color-primary);
        color: white;
        box-shadow: 0 4px 12px var(--border-glow);
    }

    /* Panel visibility toggles */
    .pos-grid.mobile-show-catalog .catalog-panel {
        display: flex !important;
    }
    .pos-grid.mobile-show-catalog .register-panel {
        display: none !important;
    }
    .pos-grid.mobile-show-cart .catalog-panel {
        display: none !important;
    }
    .pos-grid.mobile-show-cart .register-panel {
        display: flex !important;
    }

    /* Default view state on mobile: show catalog first */
    .pos-grid:not(.mobile-show-catalog):not(.mobile-show-cart) .catalog-panel {
        display: flex !important;
    }
    .pos-grid:not(.mobile-show-catalog):not(.mobile-show-cart) .register-panel {
        display: none !important;
    }

    /* Panel heights & layout overrides */
    .catalog-panel, .register-panel {
        max-height: none !important;
        height: auto !important;
        padding: 16px;
        border-radius: var(--radius-md);
    }
    
    .register-items-container {
        max-height: 350px;
    }

    .pos-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .pos-product-card {
        padding: 8px;
        gap: 6px;
    }
    
    .product-image-wrapper {
        height: 80px;
    }
    
    .product-name-title {
        font-size: 13px;
    }
    
    .product-price-label {
        font-size: 15px;
    }

    /* Catalog header search wrappers */
    .catalog-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .search-wrapper {
        min-width: 0;
    }

    /* Modals & Dialogs responsive styling */
    .modal-content {
        width: 95% !important;
        margin: 10px auto;
        padding: 16px;
        border-radius: var(--radius-md);
    }
}
