/* GMGNPro - Dark Theme */
:root {
    --bg-primary: #0d0d12;
    --bg-secondary: #13131a;
    --bg-card: #1c1c26;
    --bg-input: #25252f;
    --bg-elevated: #2a2a36;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-light: rgba(139, 92, 246, 0.15);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.15);
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.05);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    background: var(--bg-primary);
}

html, body {
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-primary);
    overflow: hidden;
}

/* Lucide Icons */
[data-lucide] {
    width: 22px;
    height: 22px;
    stroke-width: 2;
}

/* Safe Areas */
.safe-area-top {
    height: var(--safe-top);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.safe-area-bottom {
    height: var(--safe-bottom);
    background: var(--bg-primary);
    flex-shrink: 0;
}

/* Page Header */
.page-header {
    background: var(--bg-primary);
    padding: 20px 20px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

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

.icon-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.icon-btn:active {
    transform: scale(0.95);
    background: var(--accent-light);
}

/* Search Box */
.search-filter {
    padding: 0 20px 20px;
    background: var(--bg-primary);
    flex-shrink: 0;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 0 16px;
    gap: 12px;
    border: 1px solid var(--border);
    height: 52px;
}

.search-box svg {
    color: var(--text-muted);
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0 20px 20px;
    background: var(--bg-primary);
    flex-shrink: 0;
}

.stat-mini {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 16px 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-mini .stat-num {
    display: block;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-mini .stat-txt {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.stat-mini.in-stock { background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.05)); border-color: rgba(59, 130, 246, 0.3); }
.stat-mini.in-stock .stat-num { color: #3b82f6; }

.stat-mini.expired { background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.05)); border-color: rgba(239, 68, 68, 0.3); }
.stat-mini.expired .stat-num { color: #ef4444; }

.stat-mini.recent { background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05)); border-color: rgba(16, 185, 129, 0.3); }
.stat-mini.recent .stat-num { color: #10b981; }

/* Section Title */
.section-title {
    padding: 8px 20px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-primary);
    flex-shrink: 0;
}

/* Main Content */
#main-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tab-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    background: var(--bg-primary);
}

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

/* Items List */
.items-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
    padding-bottom: calc(100px + var(--safe-bottom));
    -webkit-overflow-scrolling: touch;
}

.item-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.item-card:active {
    transform: scale(0.98);
    background: var(--bg-elevated);
}

.item-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-input);
    flex-shrink: 0;
}

.item-image-placeholder {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.item-image-placeholder svg {
    color: var(--accent);
    width: 28px;
    height: 28px;
}

.item-info {
    flex: 1;
    min-width: 0;
}

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

.item-category {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.item-meta {
    text-align: right;
    flex-shrink: 0;
}

.item-price {
    font-weight: 700;
    font-size: 16px;
    color: var(--success);
    margin-bottom: 4px;
}

.item-qty {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge.in-stock { background: var(--success-bg); color: var(--success); }
.badge.expired { background: var(--danger-bg); color: var(--danger); }
.badge.low-stock { background: var(--warning-bg); color: var(--warning); }

/* FAB Button */
.fab {
    position: fixed;
    bottom: calc(90px + var(--safe-bottom));
    right: 20px;
    height: 56px;
    padding: 0 24px;
    border-radius: 28px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 100;
}

.fab svg {
    width: 22px;
    height: 22px;
}

.fab:active {
    transform: scale(0.95);
}

/* Bottom Navigation */
.bottom-nav {
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-around;
    padding: 12px 8px;
    padding-bottom: calc(12px + var(--safe-bottom));
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    min-width: 70px;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.75;
}

.nav-item.active {
    color: var(--accent);
}

.nav-item.active svg {
    stroke-width: 2.25;
}

/* Dashboard */
.dashboard-content,
.reports-content,
.suppliers-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: calc(100px + var(--safe-bottom));
    -webkit-overflow-scrolling: touch;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
}

.stat-card.highlight {
    background: linear-gradient(135deg, var(--accent), #6366f1);
    border: none;
}

.stat-icon {
    width: 52px;
    height: 52px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card.highlight .stat-icon {
    background: rgba(255, 255, 255, 0.2);
}

.stat-icon svg {
    width: 26px;
    height: 26px;
    color: var(--text-primary);
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.stat-card.highlight .stat-label {
    color: rgba(255, 255, 255, 0.8);
}

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

.section {
    margin-bottom: 28px;
}

.section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Alerts */
.alerts-list .alert-item {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
}

.alert-item .alert-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--warning-bg);
    flex-shrink: 0;
}

.alert-item .alert-icon svg {
    width: 22px;
    height: 22px;
    color: var(--warning);
}

.alert-item .alert-info { flex: 1; }
.alert-item .alert-name { font-weight: 500; font-size: 15px; margin-bottom: 2px; }
.alert-item .alert-stock { font-size: 13px; color: var(--text-secondary); }

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.category-item {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
}

.cat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cat-icon svg { width: 22px; height: 22px; }

.cat-icon.footwear { background: var(--info-bg); color: var(--info); }
.cat-icon.electronics { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.cat-icon.clothing { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.cat-icon.food { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.cat-icon.accessories { background: rgba(20, 184, 166, 0.15); color: #14b8a6; }
.cat-icon.general { background: rgba(107, 114, 128, 0.15); color: #9ca3af; }

.cat-info { flex: 1; }
.cat-name { font-weight: 500; font-size: 14px; }
.cat-count { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Report Cards */
.report-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.report-card:active {
    transform: scale(0.98);
    background: var(--bg-elevated);
}

.report-icon {
    width: 52px;
    height: 52px;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.report-icon svg {
    width: 26px;
    height: 26px;
    color: var(--accent);
}

.report-info { flex: 1; }
.report-info h3 { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.report-info p { font-size: 13px; color: var(--text-secondary); }

.report-card > svg:last-child {
    color: var(--text-muted);
    width: 20px;
    height: 20px;
}

/* Suppliers */
.supplier-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
}

.supplier-avatar {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 20px;
    flex-shrink: 0;
}

.supplier-info { flex: 1; }
.supplier-name { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.supplier-contact { font-size: 14px; color: var(--text-secondary); }

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 24px;
    padding-bottom: calc(28px + var(--safe-bottom));
    animation: slideUp 0.3s ease;
}

.modal-content.small {
    border-radius: var(--radius);
    text-align: center;
    padding: 36px 28px;
    max-width: 340px;
    margin: auto;
}

.modal-content.detail-view {
    border-radius: 0;
    height: 100%;
    max-height: 100%;
    padding-top: var(--safe-top);
}

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

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-card);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.close-btn:active {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Detail View */
.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.back-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.detail-header h2 { flex: 1; font-size: 18px; }
.detail-actions { display: flex; gap: 10px; }

.detail-image {
    width: 100%;
    height: 200px;
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--bg-card);
    margin-bottom: 24px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h3 {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 500;
}

.detail-value {
    font-size: 17px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.form-group label svg {
    width: 18px;
    height: 18px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

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

.form-check {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
}

.form-check input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: var(--accent);
    border-radius: 6px;
}

.form-check label {
    font-size: 15px;
    color: var(--text-secondary);
}

.submit-btn {
    width: 100%;
    padding: 18px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    transition: all 0.2s ease;
}

.submit-btn:active {
    transform: scale(0.98);
}

.submit-btn svg {
    width: 20px;
    height: 20px;
}

/* Delete Modal */
.delete-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    background: var(--danger-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-icon svg {
    width: 32px;
    height: 32px;
    color: var(--danger);
}

.modal-content.small h2 {
    margin-bottom: 12px;
    font-size: 22px;
}

.modal-content.small p {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 15px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.btn-cancel, .btn-delete {
    flex: 1;
    padding: 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn-cancel {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
}

.empty-state .empty-icon {
    width: 100px;
    height: 100px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
    border: 1px solid var(--border);
}

.empty-state .empty-icon svg {
    width: 44px;
    height: 44px;
    color: var(--text-muted);
    stroke-width: 1.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 10px;
    font-weight: 600;
}

.empty-state p {
    font-size: 15px;
    color: var(--text-secondary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 0;
    height: 0;
}

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

.item-card, .report-card, .supplier-card {
    animation: fadeIn 0.3s ease;
}
