/* ===================================================
   GAYA AM & PEMBOLEH UBAH (CSS VARIABLES)
   =================================================== */
/* ====== PREMIUM GLOSSY BLACK THEME ====== */
:root {
    --primary-color: #1e293b;
    --secondary-color: #9b9b9b;
    --accent-color: #6366f1;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --light-color: #f1f5f9;
    --dark-color: #0f172a;
    --border-color: #374151;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #9ca3af;
    --background: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.8);
    --highlight-bg: rgba(51, 65, 85, 0.8);
    --glass-bg: rgba(30, 41, 59, 0.6);
    --box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    --box-shadow-light: 0 4px 12px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --glossy-border: rgba(255, 255, 255, 0.1);
    --glossy-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    
    /* Additional variables from second set */
    --white-color: #ffffff;
    --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-size-base: 0.9rem;
    --font-size-sm: 0.8rem;
    --font-size-lg: 1.1rem;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
}

/* ===================================================
   GAYA BADAN & TAJUK UTAMA
   =================================================== */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-sans);
    background-color: #f4f4f4;
    color: var(--dark-color);
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: var(--spacing-md);
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #3b82f6;
}

h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===================================================
   SUSUN ATUR UTAMA
   =================================================== */
.main-content {
    padding: 15px;
    max-width: 100%;
    margin: 0 auto;
}

.top-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background-color: var(--white-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.content-wrapper {
    display: flex;
    gap: var(--spacing-xl);
}

.content-wrapper > div {
    flex: 1;
}

/* ===================================================
   STATUS & LENCANA (BADGE)
   =================================================== */
.status-pending {
    color: #856404;
    font-weight: bold;
}

.status-received {
    color: #155724;
    font-weight: bold;
}

.badge {
    padding: 0.25em 0.4em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    text-transform: uppercase;
}

.badge-success {
    background-color: var(--success-color);
    color: white;
}

.badge-danger {
    background-color: var(--danger-color);
    color: white;
}

.badge.masuk {
    color: #fff;
    background-color: var(--success-color);
}

.badge.keluar {
    color: #fff;
    background-color: var(--danger-color);
}

/* ===================================================
   BEKAS MEMUATKAN (LOADING OVERLAY)
   =================================================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: var(--border-radius);
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 1s ease infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================================
   NOTIFIKASI
   =================================================== */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    max-width: 350px;
}

.notification {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    padding: 12px;
    border-left: 4px solid var(--primary-color);
    animation: slideIn 0.3s ease-out;
    font-size: 0.9rem;
}

.notification.success {
    border-left-color: var(--success-color);
}

.notification.error {
    border-left-color: var(--danger-color);
}

.notification.warning {
    border-left-color: var(--warning-color);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===================================================
   KELAS UTILITI (UTILITY CLASSES)
   =================================================== */
.debt-amount {
    color: var(--danger-color);
    font-weight: bold;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.info-label {
    font-weight: bold;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.summary-row.total {
    font-weight: bold;
    border-top: 1px dotted var(--border-color);
    padding-top: 5px;
    margin-top: 5px;
}

.toggle-btn, .toggle-purchase-btn {
    cursor: pointer;
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1em;
    margin-right: 0.5rem;
}

/* ==========================================================================
   Gaya Butang
   ========================================================================== */

/* Butang Asas */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
}

.btn i {
    margin-right: var(--spacing-xs);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Butang Primari */
.btn-primary { 
    color: var(--white-color); 
    background-color: var(--primary-color); 
    border-color: var(--primary-color); 
}

.btn-primary:hover {
    background-color: #0069d9;
    border-color: #0062cc;
}

/* Butang Sekunder */
.btn-secondary { 
    color: var(--white-color); 
    background-color: var(--secondary-color); 
    border-color: var(--secondary-color); 
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

/* Butang Kejayaan */
.btn-success { 
    color: var(--white-color); 
    background-color: var(--success-color); 
    border-color: var(--success-color); 
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

/* Butang Bahaya */
.btn-danger { 
    color: var(--white-color); 
    background-color: var(--danger-color); 
    border-color: var(--danger-color); 
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Butang Amaran */
.btn-warning { 
    color: var(--dark-color); 
    background-color: var(--warning-color); 
    border-color: var(--warning-color); 
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}

/* Butang Khas untuk Sistem POS - Gradien */
.btn-pos {
    padding: 12px 18px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.btn-pos.btn-success {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
    box-shadow: 0 6px 12px rgba(5, 150, 105, 0.4);
}

.btn-pos.btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    box-shadow: 0 6px 12px rgba(220, 38, 38, 0.4);
}

.btn-pos.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: white;
    box-shadow: 0 6px 12px rgba(79, 70, 229, 0.4);
}

.btn-pos.btn-secondary {
    background: linear-gradient(135deg, #374151, #1f2937);
    color: white;
    box-shadow: 0 6px 12px rgba(55, 65, 81, 0.4);
}

/* Butang Kuantiti */
.btn-quantity {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #555555;
    background: #3a3a3a;
    color: #ffffff;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Butang Harga Manual */
.manual-price-btn {
    background-color: #dc3545 !important;
    color: white !important;
    background-image: none !important;
}

.manual-price-btn:hover {
    background-color: #c82333 !important;
}

/* Butang Tambah ke Troli */
.add-to-cart-btn {
    background-color: #4CAF50 !important;
    color: white !important;
    background-image: none !important;
}

.add-to-cart-btn:hover {
    background-color: #45a049 !important;
}

/* Butang Keypad */
.keypad-btn {
    padding: 16px;
    font-size: 18px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-primary);
    font-weight: bold;
    transition: all 0.2s ease;
}

.keypad-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.keypad-btn.action-btn {
    background: linear-gradient(135deg, var(--accent-color) 0%, #4f46e5 100%);
    border-color: var(--accent-color);
    color: white;
}

.keypad-btn.action-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

#calculatorAcceptBtn {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    border-color: var(--success-color);
    grid-column: span 1;
    color: white;
}

#calculatorAcceptBtn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* ===================================================
   RESPONSIF
   =================================================== */
@media (max-width: 1200px) {
    .main-content { padding: 10px; }
    .inventory-section { padding: 0.8rem; }
}

@media (max-width: 992px) {
    .two-column-layout {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .log-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }
    .log-filters .form-group {
        width: 100%;
        margin-bottom: 0.8rem;
    }
    .inventory-section { margin-bottom: 10px; }
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.1rem; }
}

@media (max-width: 768px) {
    .main-content { padding: 8px; }
    .inventory-section { padding: 0.6rem; }
    .table-container { height: 400px; }
    .movement-table th, .movement-table td {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1rem; }
    .btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .modal-content { width: 95%; }
}

@media (max-width: 576px) {
    .main-content { padding: 5px; }
    .inventory-section { padding: 0.5rem; }
    .table-container { height: 350px; }
    .movement-table th, .movement-table td {
        padding: 0.3rem;
        font-size: 0.75rem;
    }
    h1 { font-size: 1.4rem; }
    h2 { font-size: 0.95rem; }
    .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    .form-group input, .form-group select, .form-group textarea {
        padding: 0.4rem;
        font-size: 0.85rem;
    }
    .log-filters .form-group { min-width: auto; }
}
