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

:root {
    /* Exact colors from screenshot vibe */
    --primary: #4361ee;
    --primary-light: #eff2fe;
    --primary-hover: #3a53d0;
    
    --sidebar-bg: #1c2331;
    --sidebar-text: #8a92a6;
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: #4361ee;
    --sidebar-active-text: #ffffff;
    
    --bg-color: #f5f6fa;
    --card-bg: #ffffff;
    --text-main: #232d3f;
    --text-muted: #8a92a6;
    --border-color: #eef2f7;
    
    --success: #10b981;
    --success-light: #e6f7f1;
    --danger: #ef4444;
    --danger-light: #fde8e8;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #eff6ff;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Auth Layout */
.auth-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f6fa;
}

.auth-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid var(--border-color);
}

/* Layout Wrapper */
.app-wrapper {
    display: flex;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-brand {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 25px;
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.sidebar-brand .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 14px;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
}

.menu-category {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 10px;
    margin-bottom: 8px;
    margin-top: 25px;
    color: #6c757d;
    font-weight: 600;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 4px;
}

.sidebar-menu a i {
    width: 24px;
    font-size: 14px;
    text-align: left;
}

.sidebar-menu a:hover {
    color: var(--sidebar-text-hover);
    background: rgba(255,255,255,0.03);
}

.sidebar-menu a.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.2);
}

.sidebar-bottom {
    padding: 20px 15px;
    border-top: 1px solid rgba(255,255,255,0.03);
}

.sidebar-bottom a {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: #ef4444;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.sidebar-bottom a:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: all 0.3s ease;
    background-color: var(--bg-color);
}

/* Topbar */
.topbar {
    height: 70px;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-bar {
    background: var(--bg-color);
    border-radius: 20px;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    width: 320px;
    border: 1px solid transparent;
    transition: border 0.3s;
}

.search-bar:focus-within {
    border-color: var(--primary);
    background: #fff;
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    margin-left: 10px;
    font-size: 13px;
    color: var(--text-main);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
}
.topbar-action-btn:hover { color: var(--primary); }

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding-left: 15px;
    border-left: 1px solid var(--border-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-info {
    display: flex;
    flex-direction: column;
}
.user-info .name { font-size: 13px; font-weight: 600; color: var(--text-main); }
.user-info .role { font-size: 11px; color: var(--text-muted); }

/* Page Content */
.page-content {
    padding: 30px;
    flex: 1;
}

.page-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 5px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

/* Dashboard Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    display: flex;
    position: relative;
    padding: 20px 25px;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 18px;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
}

.stat-info h4 {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    font-weight: 600;
}

.stat-info .value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
}

.stat-card .badge {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px 15px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 0.5px;
}

td {
    padding: 15px;
    font-size: 13.5px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f8fafc;
}

/* Buttons & Forms */
.btn {
    padding: 9px 18px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-color);
}

.form-group {
    margin-bottom: 18px;
}

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: #ffffff;
    color: var(--text-main);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a92a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 30px;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); position: fixed; top: 0; left: 0; height: 100vh; z-index: 1050; }
    .main-content { margin-left: 0; width: 100%; }
    
    body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.1); }
    
    /* Overlay for sidebar on mobile */
    body.sidebar-open::after {
        content: '';
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1040;
    }

    .pos-container { flex-direction: column !important; height: auto !important; }
    .pos-products { height: 50vh !important; border-right: none !important; border-bottom: 2px solid var(--border-color); }
    .pos-cart { height: 50vh !important; width: 100% !important; border-left: none !important; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important; }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .search-bar { width: 180px; }
    .topbar { padding: 15px; }
    
    /* Data tables responsive */
    .card { overflow-x: auto; padding: 15px; }
    table { width: 100%; min-width: 600px; }
    
    /* POS interface adjustments for small mobile */
    .pos-products { height: 60vh !important; }
    .pos-cart { height: auto !important; min-height: 40vh !important; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important; }
    .product-item img { height: 90px !important; }
}

@media (max-width: 480px) {
    .search-bar { display: none; } /* Hide quick search on very small screens to save space */
    .page-header { flex-direction: column; align-items: flex-start !important; gap: 10px; }
    .page-header > div:last-child { width: 100%; max-width: 100% !important; }
}
