/* ==========================================
   RESET & BASE STYLES
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --dark: #1f2937;
    --darker: #111827;
    --light: #f3f4f6;
    --lighter: #f9fafb;
    --white: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    transition: var(--transition);
    color: var(--text-primary);
    line-height: 1.6;
}

@media (min-width: 768px) {
    body {
        padding: 20px;
    }
}

/* ==========================================
   DARK MODE
   ========================================== */
body.dark-mode {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border: #334155;
    --light: #1e293b;
    --lighter: #334155;
    --dark: #0f172a;
    --darker: #020617;
}

body.dark-mode .container {
    background: #0f172a;
    color: #f1f5f9;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

body.dark-mode .card {
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid #334155;
}

body.dark-mode .btn-secondary {
    background: #334155;
    color: #f1f5f9;
}

body.dark-mode .btn-secondary:hover {
    background: #475569;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: #334155;
    color: #f1f5f9;
    border-color: #475569;
}

body.dark-mode input::placeholder {
    color: #94a3b8;
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    border-color: var(--primary);
    background: #475569;
}

body.dark-mode table th {
    background: #1e293b;
    color: #f1f5f9;
    border-bottom: 2px solid #475569;
}

body.dark-mode table td {
    color: #e2e8f0;
    border-bottom: 1px solid #334155;
}

body.dark-mode table tr:hover {
    background: #334155;
}

body.dark-mode .cart-item {
    background: #334155;
}

body.dark-mode .cart-item-details {
    color: #94a3b8;
}

body.dark-mode .close-btn {
    color: #f1f5f9;
}

body.dark-mode .stat-label {
    color: rgba(255, 255, 255, 0.95);
}

body.dark-mode .nav {
    background: #0f172a;
    border-bottom: 1px solid #334155;
}

body.dark-mode .nav-item {
    color: #cbd5e1;
}

body.dark-mode .nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
}

body.dark-mode .nav-item.active {
    background: var(--primary);
    color: #ffffff;
}

body.dark-mode .modal-content {
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid #334155;
}

body.dark-mode .form-select-sm {
    background: #334155;
    color: #f1f5f9;
    border-color: #475569;
}

body.dark-mode .logo-upload {
    border-color: #475569;
    background: #334155;
}

body.dark-mode .logo-upload:hover {
    background: #475569;
    border-color: var(--primary);
}

body.dark-mode .product-card {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid #334155;
    color: #f1f5f9;
}

body.dark-mode .card-header h3 {
    color: #f1f5f9;
}

body.dark-mode .card-body p {
    color: #cbd5e1;
}

body.dark-mode .empty-state {
    color: #94a3b8;
}

body.dark-mode .badge-info {
    background: #1e3a8a;
    color: #93c5fd;
}

body.dark-mode .badge-success {
    background: #064e3b;
    color: #6ee7b7;
}

body.dark-mode .badge-danger {
    background: #7f1d1d;
    color: #fca5a5;
}

body.dark-mode .badge-warning {
    background: #78350f;
    color: #fcd34d;
}

body.dark-mode .alert-success {
    background: rgba(6, 95, 70, 0.2);
    color: #6ee7b7;
    border-left-color: #10b981;
}

body.dark-mode .alert-danger {
    background: rgba(153, 27, 27, 0.2);
    color: #fca5a5;
    border-left-color: #ef4444;
}

body.dark-mode .alert-warning {
    background: rgba(146, 64, 14, 0.2);
    color: #fcd34d;
    border-left-color: #f59e0b;
}

body.dark-mode .alert-info {
    background: rgba(30, 64, 175, 0.2);
    color: #93c5fd;
    border-left-color: #2563eb;
}

body.dark-mode .receipt-print {
    background: #1e293b;
    color: #f1f5f9;
}

body.dark-mode .stock.low {
    color: #fca5a5;
}

body.dark-mode .stock.medium {
    color: #fcd34d;
}

body.dark-mode .stock.high {
    color: #6ee7b7;
}

body.dark-mode .login-hint {
    color: #94a3b8;
    background: rgba(51, 65, 85, 0.5);
}

/* ==========================================
   CONTAINER & LAYOUT
   ========================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   HEADER
   ========================================== */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

@media (min-width: 768px) {
    .header {
        padding: 24px 30px;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.15);
    padding: 5px;
}

@media (min-width: 768px) {
    .header-logo {
        width: 50px;
        height: 50px;
    }
}

.header h1 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

@media (min-width: 480px) {
    .header h1 {
        font-size: 18px;
    }
}

@media (min-width: 768px) {
    .header h1 {
        font-size: 24px;
    }
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 12px;
}

@media (min-width: 768px) {
    .header-actions {
        gap: 10px;
        font-size: 14px;
    }
}

.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: inline;
    }
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

@media (min-width: 768px) {
    .btn {
        padding: 12px 24px;
        font-size: 14px;
        border-radius: 10px;
    }
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

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

.btn-success:hover:not(:disabled) {
    background: var(--secondary-dark);
}

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

.btn-danger:hover:not(:disabled) {
    background: var(--danger-dark);
}

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

.btn-warning:hover:not(:disabled) {
    background: var(--warning-dark);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
}

@media (min-width: 768px) {
    .btn-sm {
        padding: 10px 18px;
        font-size: 13px;
    }
}

.btn-block {
    width: 100%;
    justify-content: center;
}

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

.btn-edit:hover {
    background: var(--primary-dark);
}

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

.btn-delete:hover {
    background: var(--danger-dark);
}

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

.btn-activate:hover {
    background: var(--secondary-dark);
}

/* ==========================================
   NAVIGATION
   ========================================== */
.nav {
    background: var(--dark);
    display: flex;
    overflow-x: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
    border-bottom: 2px solid var(--primary);
}

.nav::-webkit-scrollbar {
    height: 3px;
}

.nav::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.nav-item {
    padding: 14px 18px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 3px solid transparent;
    font-size: 13px;
    font-weight: 500;
}

@media (min-width: 768px) {
    .nav-item {
        padding: 16px 25px;
        gap: 10px;
        font-size: 14px;
    }
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-item.active {
    background: var(--primary);
    border-bottom-color: var(--secondary);
    color: #fff;
}

/* ==========================================
   CONTENT & SECTIONS
   ========================================== */
.content {
    padding: 20px;
    min-height: 400px;
}

@media (min-width: 768px) {
    .content {
        padding: 30px;
    }
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==========================================
   CARDS
   ========================================== */
.card {
    background: white;
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border);
}

@media (min-width: 768px) {
    .card {
        padding: 28px;
        border-radius: var(--radius-lg);
    }
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .card-title {
        font-size: 20px;
        margin-bottom: 24px;
    }
}

.card-title i {
    color: var(--primary);
}

/* ==========================================
   FORMS
   ========================================== */
.form-group {
    margin-bottom: 18px;
}

@media (min-width: 768px) {
    .form-group {
        margin-bottom: 22px;
    }
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

@media (min-width: 768px) {
    .form-group label {
        margin-bottom: 10px;
        font-size: 15px;
    }
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
    color: var(--text-primary);
    background: var(--white);
}

@media (min-width: 768px) {
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 14px 16px;
        border-radius: 10px;
        font-size: 15px;
    }
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

@media (min-width: 768px) {
    .form-row {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 22px;
    }
}

.form-select-sm {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--white);
}

.filter-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-btn-group {
    display: flex;
    align-items: flex-end;
}

/* ==========================================
   TABLES
   ========================================== */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

table th,
table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

@media (min-width: 768px) {
    table th,
    table td {
        padding: 16px;
        font-size: 14px;
    }
}

table th {
    background: var(--light);
    font-weight: 700;
    color: var(--text-primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

table tr:hover {
    background: var(--lighter);
}

table tr:last-child td {
    border-bottom: none;
}

.table-detail {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 14px;
    background-color: var(--white);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.table-detail th,
.table-detail td {
    border: 1px solid var(--border);
    padding: 10px;
    text-align: left;
    color: var(--text-primary);
    word-break: break-word;
}

.table-detail th {
    background-color: var(--light);
    font-weight: 600;
    text-align: center;
}

.table-detail tr:nth-child(even) {
    background-color: var(--lighter);
}

/* ==========================================
   BADGES
   ========================================== */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

@media (min-width: 768px) {
    .badge {
        padding: 7px 14px;
        font-size: 13px;
    }
}

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

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

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

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ==========================================
   STATS GRID
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

.stat-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

@media (min-width: 768px) {
    .stat-card {
        padding: 28px;
        border-radius: var(--radius-lg);
    }
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.stat-card.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-card.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-card.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.stat-card i {
    font-size: 28px;
    opacity: 0.9;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin: 12px 0;
}

@media (min-width: 768px) {
    .stat-value {
        font-size: 40px;
    }
}

.stat-label {
    font-size: 13px;
    opacity: 0.95;
    font-weight: 500;
}

@media (min-width: 768px) {
    .stat-label {
        font-size: 14px;
    }
}

/* ==========================================
   MODALS
   ========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 95%;
    width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
    margin: auto;
}

@media (min-width: 768px) {
    .modal-content {
        padding: 36px;
        border-radius: 20px;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    color: var(--text-primary);
}

@media (min-width: 768px) {
    .modal-header h2 {
        font-size: 24px;
    }
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-btn:hover {
    color: var(--danger);
    background: var(--lighter);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* ==========================================
   ALERTS & NOTIFICATIONS
   ========================================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideDown 0.3s ease;
    font-size: 14px;
    position: relative;
}

@media (min-width: 768px) {
    .alert {
        padding: 16px 22px;
        border-radius: 10px;
        margin-bottom: 22px;
        font-size: 15px;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert i {
    flex-shrink: 0;
    font-size: 18px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #2563eb;
}

.alert-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: var(--transition);
    padding: 4px;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Alert Popup/Overlay */
.alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    backdrop-filter: blur(3px);
    padding: 20px;
    overflow-y: auto;
}

.alert-popup {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    padding: 24px;
    width: 90vw;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease-in-out;
    position: relative;
}

@media (min-width: 768px) {
    .alert-popup {
        padding: 32px;
    }
}

.alert-popup::-webkit-scrollbar {
    width: 6px;
}

.alert-popup::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

@media (max-width: 480px) {
    .alert-popup {
        width: 92vw;
        padding: 20px;
        border-radius: 12px;
        max-height: 80vh;
    }
}

/* ==========================================
   CART ITEMS
   ========================================== */
.cart-items-container {
    max-height: none;
    overflow-y: visible;
    margin-bottom: 16px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: var(--light);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    transition: var(--transition);
    border: 1px solid var(--border);
}

@media (min-width: 768px) {
    .cart-item {
        padding: 16px;
        border-radius: 10px;
    }
}

.cart-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-primary);
}

@media (min-width: 768px) {
    .cart-item-name {
        font-size: 15px;
    }
}

.cart-item-details {
    font-size: 12px;
    color: var(--text-secondary);
}

@media (min-width: 768px) {
    .cart-item-details {
        font-size: 13px;
    }
}

.cart-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cart-summary {
    border-top: 2px solid var(--border);
    padding-top: 16px;
    margin-top: 16px;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--lighter);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

@media (min-width: 768px) {
    .cart-total {
        font-size: 20px;
    }
}

.change-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: var(--lighter);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

/* ==========================================
   SALES LAYOUT - IMPROVED
   ========================================== */
.sales-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 1024px) {
    .sales-container {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }
}

.sales-form,
.sales-cart {
    height: fit-content;
}

.product-info-box {
    background: var(--lighter);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 16px;
    display: none;
}

.product-info-box .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.product-info-box .info-row.highlight {
    font-size: 16px;
    font-weight: 600;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 8px;
    color: var(--primary);
}

/* ==========================================
   SEARCH BOX
   ========================================== */
.search-box {
    position: relative;
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .search-box {
        margin-bottom: 20px;
    }
}

.search-box input {
    width: 100%;
    padding: 12px 45px 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

@media (min-width: 768px) {
    .search-box input {
        padding: 14px 50px 14px 16px;
        border-radius: 10px;
        font-size: 15px;
    }
}

.search-box i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 16px;
}

/* ==========================================
   LOGO UPLOAD
   ========================================== */
.logo-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--lighter);
}

.logo-upload:hover {
    border-color: var(--primary);
    background: var(--light);
}

.logo-upload i {
    font-size: 36px;
    color: var(--primary);
    margin-bottom: 12px;
}

.logo-upload p {
    margin: 8px 0;
    color: var(--text-primary);
    font-weight: 600;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

.logo-preview {
    max-width: 200px;
    max-height: 200px;
    margin: 16px auto;
    border-radius: var(--radius-md);
    display: block;
    box-shadow: var(--shadow);
}

@media (min-width: 768px) {
    .logo-preview {
        max-width: 250px;
        max-height: 250px;
    }
}

/* ==========================================
   RECEIPT PRINT
   ========================================== */
.receipt-print {
    font-family: 'Courier New', monospace;
    max-width: 320px;
    margin: 0 auto;
    font-size: 13px;
    background: var(--white);
    padding: 16px;
    border-radius: var(--radius-sm);
}

.receipt-header {
    text-align: center;
    border-bottom: 2px dashed #000;
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.receipt-logo {
    max-width: 100px;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
}

.receipt-header h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.receipt-header p {
    font-size: 12px;
    margin: 4px 0;
    color: var(--text-secondary);
}

.receipt-body {
    margin-bottom: 16px;
}

.receipt-body p {
    font-size: 12px;
    margin: 6px 0;
    color: var(--text-primary);
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 13px;
}

.receipt-footer {
    border-top: 2px dashed #000;
    padding-top: 16px;
    text-align: center;
}

.receipt-footer p {
    margin: 6px 0;
    font-size: 13px;
    color: var(--text-primary);
}

/* ==========================================
   CHARTS
   ========================================== */
canvas {
    max-width: 100%;
    height: 300px !important;
}

@media (min-width: 768px) {
    canvas {
        height: 400px !important;
    }
}

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

@media (min-width: 768px) {
    .empty-state {
        padding: 60px 40px;
    }
}

.empty-state i {
    font-size: 60px;
    margin-bottom: 16px;
    opacity: 0.5;
}

@media (min-width: 768px) {
    .empty-state i {
        font-size: 80px;
        margin-bottom: 20px;
    }
}

/* ==========================================
   PRODUCT GRID - CARD VIEW
   ========================================== */
.product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 20px;
}

@media (min-width: 640px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

.product-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 18px;
    transition: var(--transition);
    color: var(--text-primary);
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    gap: 10px;
}

.card-header h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.category {
    background: #e0f2fe;
    color: #0369a1;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.card-body {
    margin-bottom: 14px;
}

.card-body p {
    margin: 8px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.card-body strong {
    color: var(--text-primary);
}

.stock {
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
}

.stock.low {
    color: #dc2626;
    background: #fee2e2;
}

.stock.medium {
    color: #d97706;
    background: #fef3c7;
}

.stock.high {
    color: #059669;
    background: #d1fae5;
}

.status {
    font-weight: 600;
}

.status.active {
    color: #10b981;
}

.status.inactive {
    color: #ef4444;
}

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

.card-actions .btn {
    flex: 1;
    justify-content: center;
}

/* ==========================================
   HPP RESULTS - NO SCROLL, CLEAN LAYOUT
   ========================================== */
#hppResult,
#marginAnalysis,
#pricingResult,
#targetProfitResult,
#profitResult {
    max-height: none;
    overflow: visible;
}

#hppResult .stats-grid,
#profitResult .stats-grid {
    margin-bottom: 0;
}

#hppResult table,
#marginAnalysis table,
#pricingResult table,
#targetProfitResult table {
    margin-top: 16px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

/* ==========================================
   BACKUP CONTROLS
   ========================================== */
.backup-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.backup-controls .btn {
    flex: 1;
    min-width: 140px;
}

@media (max-width: 640px) {
    .backup-controls .btn {
        width: 100%;
    }
}

/* ==========================================
   AI INSIGHTS SECTION
   ========================================== */
.ai-insights {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
}

.ai-insights h4 {
    font-size: 18px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-insights p {
    margin: 10px 0;
    line-height: 1.7;
    font-size: 14px;
}

.ai-insights ul {
    margin: 12px 0;
    padding-left: 24px;
}

.ai-insights li {
    margin: 8px 0;
    line-height: 1.6;
}

.ai-insights .insight-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin: 12px 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-insights .insight-card h5 {
    font-size: 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-insights .insight-card p {
    font-size: 13px;
    margin: 6px 0;
}

/* ==========================================
   LOGIN MODAL & HINT
   ========================================== */
.login-hint {
    margin-top: 16px;
    padding: 12px;
    background: var(--lighter);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* ==========================================
   FOOTER
   ========================================== */
.game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    background: rgba(255, 255, 255, 0.13);
    backdrop-filter: blur(10px) saturate(180%);
    color: #fff;
    padding: 8px 0;
    font-size: 13px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 -2px 12px rgba(31, 38, 135, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-text {
    margin: 3px 0;
    color: #f1f1f1;
    font-size: 12px;
}

.footer-link {
    color: #6da8ff;
    text-decoration: none;
    transition: color 0.2s ease;
    font-size: 12px;
}

.footer-link:hover {
    color: #fff;
}

.footer-socials {
    margin-top: 4px;
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.social-link {
    color: #f1f1f1;
    opacity: 0.8;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 18px;
}

.social-link:hover {
    color: #6da8ff;
    opacity: 1;
    transform: scale(1.15);
}

@media (max-width: 480px) {
    .game-footer {
        padding: 6px 0;
        font-size: 11px;
    }
    .footer-text,
    .footer-link {
        font-size: 11px;
    }
    .footer-socials {
        gap: 8px;
    }
    .social-link {
        font-size: 16px;
    }
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

@media (min-width: 768px) {
    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }
}

::-webkit-scrollbar-track {
    background: var(--light);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

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

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
    body * {
        visibility: hidden;
    }
    .receipt-print,
    .receipt-print * {
        visibility: visible;
    }
    .receipt-print {
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm;
    }
    .modal-actions {
        display: none;
    }
}

/* ==========================================
   LOADING ANIMATION
   ========================================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 12px;
}

.mb-2 {
    margin-bottom: 12px;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-2 {
    gap: 12px;
}

.hidden {
    display: none !important;
}

/* ==========================================
   EXTRA SMALL DEVICES
   ========================================== */
@media (max-width: 360px) {
    .header h1 {
        font-size: 14px;
    }
    
    .nav-item {
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .btn {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .card {
        padding: 16px;
    }
    
    .product-grid {
        gap: 12px;
    }
}
