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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

/* Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: all 0.3s ease;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    transition: all 0.3s ease;
}

@media (max-width: 992px) {
    .sidebar { width: 0; overflow: hidden; border: none; }
    .main-content { margin-left: 0; }
    .sidebar.active { width: 260px; border-right: 1px solid var(--border); }
}

/* Sidebar Styling */
.sidebar-header {
    padding: 2rem 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 0 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    transition: 0.2s;
    margin-bottom: 0.5rem;
}

.nav-link:hover, .nav-link.active {
    background-color: var(--primary);
    color: white;
}

/* Dashboard Cards */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-icon {
    width: 40px;
    height: 40px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
}

.stat-title {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* Forms & Tables */
.card {
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); }
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: white;
    outline: none;
}

.table-container { overflow-x: auto; margin-top: 1.5rem; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 0.75rem 1rem; border-bottom: 2px solid var(--border); color: var(--text-muted); }
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }

/* Thermal Receipt Styling (Print) */
@media print {
    @page { margin: 0; }
    body { background: white !important; padding: 0; margin: 0; }
    
    /* Hide everything by default */
    body > *:not(.print-only) {
        display: none !important;
    }

    /* Format receipt */
    .print-receipt {
        width: 58mm !important;
        margin: 0 auto !important;
        padding: 5px !important;
        font-family: 'Courier New', Courier, monospace;
        font-size: 11px;
        color: black !important;
        background: white !important;
    }

    .print-receipt * { color: black !important; }
    .print-receipt img { display: block; margin: 0 auto; max-width: 100%; filter: grayscale(1); }
    .print-receipt .header { text-align: center; border-bottom: 1px dashed black; padding-bottom: 5px; }
    .print-receipt .items { margin-top: 10px; }
    .print-receipt .totals { border-top: 1px dashed black; margin-top: 10px; text-align: right; }
}

/* Helper class for JS print */
.print-only { display: none; }
@media print { .print-only { display: block !important; } }

/* POS Interface */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1.5rem;
}
@media (max-width: 900px) {
    .pos-container { grid-template-columns: 1fr; }
}
