@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --success-hover: #059669;
    --bg-gradient: linear-gradient(135deg, #f0fdf4 0%, #e0e7ff 100%);
    --surface: rgba(255, 255, 255, 0.7);
    --surface-border: rgba(255, 255, 255, 0.5);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --radius: 16px;
    --shadow: 0 8px 32px rgba(31, 38, 135, 0.1);
    --glass-blur: blur(12px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-main);
}

.glass-panel {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px; /* reduced from 24px */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px; /* reduced from 24px */
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px; /* reduced from 32px */
}

h1, h2, h3 {
    font-weight: 600;
}

.title {
    font-size: 2rem;
    background: linear-gradient(to right, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

button.danger {
    background: var(--danger);
}
button.danger:hover {
    background: var(--danger-hover);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

button.success {
    background: var(--success);
}
button.success:hover {
    background: var(--success-hover);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

button.outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}
button.outline:hover {
    background: var(--primary);
    color: white;
}

input, select, textarea {
    width: 100%;
    padding: 8px 12px; /* reduced from 12px 16px */
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.8);
    font-size: 0.95rem; /* reduced from 1rem */
    transition: all 0.2s;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group {
    margin-bottom: 12px; /* reduced from 16px */
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

th, td {
    padding: 8px; /* reduced from 12px */
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:hover {
    background: rgba(0,0,0,0.02);
}

.dense-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

.dense-table th, .dense-table td {
    padding: 6px 8px;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.dense-table th {
    font-size: 0.75rem;
    padding-top: 8px;
    padding-bottom: 4px;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px; /* reduced from 24px */
    border-bottom: 2px solid rgba(0,0,0,0.05);
    padding-bottom: 8px;
}

.tab {
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 8px;
    transition: all 0.2s;
}

.tab:hover {
    background: rgba(0,0,0,0.05);
}

.tab.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* Collapsible */
.category-header {
    padding: 10px 16px; /* reduced */
    background: rgba(255,255,255,0.5);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px; /* reduced */
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.2s;
}
.category-header:hover {
    background: rgba(255,255,255,0.8);
}

.category-content {
    padding-left: 16px;
    padding-bottom: 16px;
    display: none;
}
.category-content.open {
    display: block;
}

.product-item {
    padding: 8px 12px; /* reduced */
    border-bottom: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.product-item:hover {
    background: rgba(0,0,0,0.02);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s;
}
.modal-overlay.active .modal {
    transform: scale(1);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.close-btn {
    background: transparent;
    color: var(--text-muted);
    font-size: 1.5rem;
    padding: 0 8px;
}
.close-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--danger);
    box-shadow: none;
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}
.badge.sku {
    background: #e2e8f0;
    color: #475569;
}
.badge.qty {
    background: #dcfce7;
    color: #166534;
}
.badge.qty-low {
    background: #fee2e2;
    color: #991b1b;
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}
.toast {
    background: var(--text-main);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease forwards;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Utility */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    #print-area, #print-area * {
        visibility: visible;
    }
    #print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .no-print {
        display: none !important;
    }
}

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
}
.stat-card .stat-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-card .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}
.stat-card.alert .stat-value {
    color: var(--danger);
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.8);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 0 12px;
    margin-bottom: 16px;
    transition: all 0.2s;
}
.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.search-bar input {
    border: none;
    background: transparent;
    padding: 12px 8px;
    box-shadow: none;
    flex: 1;
    outline: none;
}
.search-bar i {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* QR Code Image Reset */
#print-area img, #print-area canvas {
    max-width: 100%;
    max-height: 100%;
}

