/* =====================================================
   KOPI NUSANTARA - COFFEE POS SYSTEM
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Coffee Colors */
    --espresso: #1a0f0a;
    --dark-roast: #2d1810;
    --medium-roast: #4a2c2a;
    --light-roast: #6f4e37;
    --crema: #c4a77d;
    --milk-foam: #f5f0e8;
    --latte: #e8dcc8;
    
    /* Status Colors */
    --success: #2e7d32;
    --warning: #f9a825;
    --danger: #c62828;
    --info: #1565c0;
    
    /* Typography */
    --font-main: 'Poppins', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Shadows */
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    
    /* Border Radius */
    --radius: 8px;
    --radius-lg: 12px;
}

/* Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, var(--milk-foam) 0%, var(--latte) 100%);
    color: var(--espresso);
    min-height: 100vh;
    line-height: 1.5;
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo .icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.login-logo h1 {
    font-size: 24px;
    color: var(--dark-roast);
}

.login-logo p {
    color: var(--light-roast);
    font-size: 14px;
}

/* =====================================================
   FORMS
   ===================================================== */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--medium-roast);
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--latte);
    border-radius: var(--radius);
    font-family: var(--font-main);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--crema);
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--medium-roast), var(--dark-roast));
    color: white;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.btn-secondary {
    background: var(--latte);
    color: var(--dark-roast);
}

.btn-secondary:hover { background: var(--crema); }

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-lg { padding: 16px 24px; font-size: 16px; }

.btn-logout {
    width: 100%;
    background: rgba(255,255,255,0.1);
    color: var(--milk-foam);
    padding: 10px;
    border-radius: var(--radius);
    text-decoration: none;
    display: block;
    text-align: center;
    font-size: 14px;
}

.btn-logout:hover { background: rgba(255,255,255,0.2); }

/* =====================================================
   LAYOUT
   ===================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--dark-roast), var(--espresso));
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.sidebar-brand .icon { font-size: 32px; }
.sidebar-brand h2 { font-size: 16px; font-weight: 600; }
.sidebar-brand span { font-size: 12px; opacity: 0.7; }

.sidebar-nav { flex: 1; }

.nav-section { margin-bottom: 24px; }

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
    margin-bottom: 10px;
    padding-left: 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 4px;
    transition: all 0.2s;
}

.nav-link:hover { background: rgba(255,255,255,0.1); color: white; }

.nav-link.active {
    background: var(--crema);
    color: var(--dark-roast);
}

.nav-icon { font-size: 18px; }

.sidebar-user {
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--crema);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--dark-roast);
}

.user-details h4 { font-size: 14px; font-weight: 500; }
.user-details span { font-size: 12px; opacity: 0.7; }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px;
    min-height: 100vh;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title h1 { font-size: 24px; color: var(--dark-roast); }
.page-title p { color: var(--light-roast); font-size: 14px; }

.top-bar-actions { display: flex; gap: 12px; align-items: center; }

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--latte);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 { font-size: 16px; }

.card-body { padding: 20px; }
.card-footer { padding: 16px 20px; background: var(--milk-foam); }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.primary { background: var(--medium-roast); color: white; }
.stat-icon.success { background: var(--success); color: white; }
.stat-icon.warning { background: var(--warning); color: white; }
.stat-icon.info { background: var(--info); color: white; }

.stat-content h4 {
    font-size: 12px;
    color: var(--light-roast);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat-content .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-roast);
}

/* =====================================================
   POS INTERFACE
   ===================================================== */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    height: calc(100vh - 120px);
}

/* Products Side */
.pos-products {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.category-tabs {
    display: flex;
    gap: 8px;
    padding-bottom: 16px;
    overflow-x: auto;
    flex-shrink: 0;
}

.category-tab {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--latte);
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: var(--font-main);
}

.category-tab:hover { border-color: var(--crema); }

.category-tab.active {
    background: var(--medium-roast);
    border-color: var(--medium-roast);
    color: white;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    overflow-y: auto;
    padding: 4px;
    flex: 1;
}

.product-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    text-align: center;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--crema);
}

.product-card.out-of-stock {
    opacity: 0.5;
    pointer-events: none;
}

.product-emoji {
    font-size: 40px;
    margin-bottom: 8px;
}

.product-card h4 {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--dark-roast);
}

.product-card .price {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--medium-roast);
}

/* Cart Side */
.pos-cart {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--dark-roast), var(--medium-roast));
    color: white;
}

.cart-header h3 {
    font-size: 18px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-header input {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.15);
    color: white;
    font-family: var(--font-main);
    font-size: 14px;
}

.cart-header input::placeholder { color: rgba(255,255,255,0.6); }

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--light-roast);
}

.cart-empty .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }

.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--milk-foam);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.cart-item-info { flex: 1; }
.cart-item-info h4 { font-size: 14px; font-weight: 500; }
.cart-item-info .price { font-size: 12px; color: var(--light-roast); }

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: var(--latte);
    color: var(--dark-roast);
    font-size: 16px;
    cursor: pointer;
    font-family: var(--font-main);
}

.qty-btn:hover { background: var(--crema); }

.qty-value {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
}

.cart-item-total {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 14px;
    min-width: 80px;
    text-align: right;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    opacity: 0.6;
}

.cart-item-remove:hover { opacity: 1; }

/* Cart Summary */
.cart-summary {
    padding: 20px;
    background: var(--milk-foam);
    border-top: 1px solid var(--latte);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.summary-row.total {
    font-size: 20px;
    font-weight: 700;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 2px solid var(--latte);
    color: var(--dark-roast);
}

/* Payment Methods */
.payment-methods {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.payment-method {
    padding: 12px 8px;
    border: 2px solid var(--latte);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.payment-method:hover { border-color: var(--crema); }

.payment-method.active {
    border-color: var(--medium-roast);
    background: rgba(74, 44, 42, 0.05);
}

.payment-method .icon { font-size: 20px; margin-bottom: 4px; }
.payment-method span { font-size: 11px; font-weight: 500; display: block; }

.payment-method input { display: none; }

/* Cash Input */
#cashInput { margin: 16px 0; }

.quick-cash {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.cart-actions { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }

/* =====================================================
   TABLES
   ===================================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--latte);
}

.data-table th {
    background: var(--milk-foam);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--light-roast);
}

.data-table tbody tr:hover { background: rgba(196, 167, 125, 0.1); }

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success { background: rgba(46, 125, 50, 0.15); color: var(--success); }
.badge-warning { background: rgba(249, 168, 37, 0.15); color: #b17900; }
.badge-danger { background: rgba(198, 40, 40, 0.15); color: var(--danger); }
.badge-info { background: rgba(21, 101, 192, 0.15); color: var(--info); }

/* =====================================================
   MODALS
   ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal { transform: scale(1); }

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--latte);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { font-size: 18px; }

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--light-roast);
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--latte);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Success Modal */
.success-modal .modal-header {
    background: var(--success);
    color: white;
}

.success-content {
    text-align: center;
    padding: 20px;
}

.success-content .icon { font-size: 64px; margin-bottom: 16px; }
.success-content .amount { font-size: 32px; font-weight: 700; color: var(--dark-roast); }
.success-content .label { color: var(--light-roast); margin-bottom: 8px; }

/* =====================================================
   ALERTS
   ===================================================== */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success { background: rgba(46, 125, 50, 0.15); color: var(--success); }
.alert-error { background: rgba(198, 40, 40, 0.15); color: var(--danger); }

/* =====================================================
   UTILITIES
   ===================================================== */
.text-center { text-align: center; }
.text-muted { color: var(--light-roast); }
.mt-1 { margin-top: 16px; }
.mt-2 { margin-top: 24px; }
.mb-1 { margin-bottom: 16px; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
    .sidebar { width: 70px; padding: 16px 10px; }
    .sidebar-brand h2, .sidebar-brand span, 
    .nav-section-title, .nav-link span, .user-details { display: none; }
    .sidebar-brand, .nav-link, .user-info { justify-content: center; }
    .main-content { margin-left: 70px; }
    .pos-container { grid-template-columns: 1fr; }
    .pos-cart {
        position: fixed;
        bottom: 0;
        left: 70px;
        right: 0;
        height: 50%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .pos-cart { left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .payment-methods { grid-template-columns: repeat(2, 1fr); }
}

/* Print */
@media print {
    .sidebar, .top-bar, .btn { display: none !important; }
    .main-content { margin: 0; padding: 0; }
}