﻿:root {
    --bg-color: #0d1117;
    --text-main: #f0f6fc;
    --text-muted: #8b949e;
    --primary: #3b82f6; 
    --primary-hover: #2563eb;
    --secondary: #8b5cf6; 
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --glass-bg: rgba(22, 27, 34, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.36);
    --card-radius: 16px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* subtle background mesh/gradient */
    background-image: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
    background-attachment: fixed;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    box-shadow: var(--glass-shadow);
    padding: 24px;
}

/* Layout */
.app-container {
    display: flex;
    flex: 1;
}

.sidebar {
    width: 250px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text-main);
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--primary);
    color: var(--primary);
}

.nav-link i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.2rem;
}

.main-content {
    flex: 1;
    padding: 32px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100vh;
}

.page-title {
    font-size: 2rem;
    margin-bottom: 24px;
    font-weight: 700;
    background: linear-gradient(to right, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.95rem;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-icon {
    padding: 8px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 16px;
}

.table th, .table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

/* Grid Layouts */
.grid {
    display: grid;
    gap: 24px;
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Utility */
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }

/* Dashboard Cards */
.stat-card {
    display: flex;
    align-items: center;
    padding: 24px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-right: 20px;
}

.stat-icon.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }

.stat-details h3 {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-details .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Responsive Design Updates */

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    cursor: pointer;
}

@media (max-width: 1024px) {
    /* POS Page specific responsive */
    .pos-container {
        flex-direction: column !important;
        height: auto !important;
    }
    
    .pos-products {
        height: 50vh !important;
    }
    
    .pos-cart {
        height: 50vh !important;
    }
}

@media (max-width: 900px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
    
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 999;
        transition: left 0.3s ease;
        background: rgba(13, 17, 23, 0.95);
    }
    
    .sidebar.active {
        left: 0;
        box-shadow: 50px 0 100px rgba(0,0,0,0.5);
    }
    
    .mobile-toggle {
        display: flex;
    }
    
    .main-content {
        padding-top: 80px; /* Leave room for mobile toggle */
    }
}

@media (max-width: 768px) {
    .grid-cols-2 { grid-template-columns: 1fr; }
    
    .table th, .table td {
        padding: 12px 8px;
        font-size: 0.9rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
        margin-right: 16px;
    }
    
    /* Sales Page specific */
    .sales-grid {
        grid-template-columns: 1fr !important;
    }
    
    .sticky-details {
        position: relative !important;
        top: 0 !important;
    }
}

@media (max-width: 600px) {
    .grid-cols-3 { grid-template-columns: 1fr; }
    
    /* Modify POS Grid for smaller phones */
    #productsGrid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .product-card {
        padding: 12px;
    }
    
    .login-box {
        padding: 24px;
        border: none;
        box-shadow: none;
        background: transparent;
    }
}

/* Helper Class for POS split view wrapper */
.pos-container {
    display: flex; gap: 24px; height: calc(100vh - 180px);
}
.pos-products {
    flex: 2; display: flex; flex-direction: column;
}
.pos-cart {
    flex: 1; display: flex; flex-direction: column;
}
.sales-grid {
    grid-template-columns: 1fr 1fr; gap: 24px; padding-bottom: 24px;
}

/* Responsive Design Updates */

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    cursor: pointer;
}

@media (max-width: 1024px) {
    /* POS Page specific responsive */
    .pos-container {
        flex-direction: column !important;
        height: auto !important;
    }
    
    .pos-products {
        height: 50vh !important;
    }
    
    .pos-cart {
        height: 50vh !important;
    }
}

@media (max-width: 900px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
    
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 999;
        transition: left 0.3s ease;
        background: rgba(13, 17, 23, 0.95);
    }
    
    .sidebar.active {
        left: 0;
        box-shadow: 50px 0 100px rgba(0,0,0,0.5);
    }
    
    .mobile-toggle {
        display: flex;
    }
    
    .main-content {
        padding-top: 80px; /* Leave room for mobile toggle */
    }
}

@media (max-width: 768px) {
    .grid-cols-2 { grid-template-columns: 1fr; }
    
    .table th, .table td {
        padding: 12px 8px;
        font-size: 0.9rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
        margin-right: 16px;
    }
    
    /* Sales Page specific */
    .sales-grid {
        grid-template-columns: 1fr !important;
    }
    
    .sticky-details {
        position: relative !important;
        top: 0 !important;
    }
}

@media (max-width: 600px) {
    .grid-cols-3 { grid-template-columns: 1fr; }
    
    /* Modify POS Grid for smaller phones */
    #productsGrid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .product-card {
        padding: 12px;
    }
    
    .login-box {
        padding: 24px;
        border: none;
        box-shadow: none;
        background: transparent;
    }
}

/* Helper Class for POS split view wrapper */
.pos-container {
    display: flex; gap: 24px; height: calc(100vh - 180px);
}
.pos-products {
    flex: 2; display: flex; flex-direction: column;
}
.pos-cart {
    flex: 1; display: flex; flex-direction: column;
}
.sales-grid {
    grid-template-columns: 1fr 1fr; gap: 24px; padding-bottom: 24px;
}
