/* ============================================================
   POS-INDIA — Main Stylesheet (Indian Retail Ready)
   ============================================================ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --dark: #1e293b;
    --sidebar-width: 250px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background: #f1f5f9;
    color: #334155;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    z-index: 1040;
    transition: width 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.sidebar-brand .brand-icon {
    width: 38px; height: 38px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.sidebar-brand .brand-text { white-space: nowrap; }
.sidebar-brand .brand-text small { font-size: 10px; opacity: 0.6; display: block; font-weight: 400; }

.sidebar-nav { padding: 12px 0; }
.sidebar-section { padding: 16px 20px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.35); font-weight: 600; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    position: relative;
}
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar-link.active { color: #fff; background: rgba(99,102,241,0.2); border-left-color: var(--primary); }
.sidebar-link .icon { width: 22px; text-align: center; font-size: 16px; flex-shrink: 0; }
.sidebar-link .badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 10px; }

/* ===== HEADER ===== */
.main-header {
    position: fixed;
    top: 0; left: var(--sidebar-width); right: 0;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1030;
    transition: left 0.3s;
}
.header-left {
    display: flex; align-items: center; gap: 16px;
}
.header-left h1 { font-size: 16px; font-weight: 600; color: var(--dark); }
.header-right {
    display: flex; align-items: center; gap: 12px;
}
.header-right .btn-icon {
    width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid #e2e8f0; background: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 18px; color: #64748b;
    transition: all 0.15s; position: relative;
}
.header-right .btn-icon:hover { background: #f8fafc; border-color: #cbd5e1; }
.header-right .btn-icon .dot {
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px; background: var(--danger);
    border-radius: 50%; border: 2px solid #fff;
}
.header-right .user-avatar {
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; cursor: pointer;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 24px;
    min-height: calc(100vh - var(--header-height));
    transition: margin-left 0.3s;
}

/* ===== CARDS ===== */
.card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    margin-bottom: 24px;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.card-header h3 { font-size: 16px; font-weight: 600; color: var(--dark); }
.card-header .card-actions { display: flex; gap: 8px; }
.card-body { padding: 24px; }
.card-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
    border-radius: 0 0 14px 14px;
}

/* ===== STAT CARDS ===== */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: #fff; border-radius: 14px; padding: 20px 24px;
    border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    display: flex; justify-content: space-between; align-items: flex-start;
}
.stat-card .stat-info .stat-label { font-size: 12px; color: #94a3b8; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .stat-info .stat-value { font-size: 26px; font-weight: 700; color: var(--dark); margin-top: 4px; }
.stat-card .stat-info .stat-sub { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.stat-card .stat-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: 8px; font-size: 13px;
    font-weight: 600; cursor: pointer; border: 1px solid transparent;
    transition: all 0.15s; text-decoration: none; white-space: nowrap;
    font-family: var(--font-family);
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2563eb; }
.btn-outline {
    background: #fff; color: #64748b; border-color: #e2e8f0;
}
.btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; color: #475569; }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 13px; font-weight: 600;
    color: #475569; margin-bottom: 6px;
}
.form-control {
    width: 100%; padding: 10px 14px; border-radius: 8px;
    border: 1px solid #e2e8f0; font-size: 14px; color: #334155;
    background: #fff; transition: all 0.15s; font-family: var(--font-family);
    outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.form-control::placeholder { color: #94a3b8; }
.form-control-sm { padding: 6px 10px; font-size: 12px; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.input-group { display: flex; }
.input-group .form-control { border-radius: 8px 0 0 8px; border-right: none; }
.input-group .btn { border-radius: 0 8px 8px 0; }

.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.form-check label { font-size: 13px; color: #475569; cursor: pointer; }

.form-error { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* ===== TABLES ===== */
.table-responsive { overflow-x: auto; }
.table, .data-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}
.table th, .data-table th {
    padding: 12px 16px; text-align: left; font-weight: 600;
    color: #64748b; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.5px; background: #f8fafc; border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
.table td, .data-table td {
    padding: 12px 16px; border-bottom: 1px solid #f1f5f9;
    color: #334155;
}
.table tbody tr:hover, .data-table tbody tr:hover { background: #f8fafc; }
.table .text-right { text-align: right; }
.table .text-center { text-align: center; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 20px; font-size: 11px;
    font-weight: 600; white-space: nowrap;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-primary { background: #e0e7ff; color: #3730a3; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-dialog {
    background: #fff; border-radius: 16px; width: 90%; max-width: 500px;
    max-height: 85vh; overflow-y: auto; box-shadow: 0 25px 50px rgba(0,0,0,0.2);
    animation: slideUp 0.25s;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-lg { max-width: 700px; }
.modal-header {
    padding: 18px 24px; border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px; border: none; background: #f1f5f9;
    border-radius: 8px; cursor: pointer; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    color: #64748b; transition: all 0.15s;
}
.modal-close:hover { background: #e2e8f0; color: #334155; }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid #e2e8f0;
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px; border-radius: 10px; margin-bottom: 16px;
    font-size: 13px; font-weight: 500; border: 1px solid transparent;
}
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fed7aa; }
.alert-info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 20px; }
.pagination .page-item { list-style: none; }
.pagination .page-link {
    display: flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px;
    border-radius: 8px; border: 1px solid #e2e8f0; background: #fff;
    color: #475569; font-size: 13px; font-weight: 500;
    text-decoration: none; transition: all 0.15s;
}
.pagination .page-link:hover { background: #f8fafc; }
.pagination .active .page-link { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== POS BILLING SCREEN ===== */
.pos-container { display: grid; grid-template-columns: 1fr 380px; gap: 20px; height: calc(100vh - var(--header-height) - 48px); }
.pos-left { display: flex; flex-direction: column; gap: 16px; overflow: hidden; }
.pos-right { display: flex; flex-direction: column; background: #fff; border-radius: 14px; border: 1px solid #e2e8f0; overflow: hidden; }

.pos-search-box {
    position: relative; flex-shrink: 0;
}
.pos-search-box input {
    width: 100%; padding: 14px 18px; padding-left: 48px;
    border-radius: 12px; border: 2px solid #e2e8f0;
    font-size: 15px; font-family: var(--font-family);
    transition: all 0.2s; outline: none; background: #fff;
}
.pos-search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,0.08); }
.pos-search-box .search-icon {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    font-size: 18px; color: #94a3b8;
}
.pos-search-results {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border-radius: 12px; border: 1px solid #e2e8f0;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1); z-index: 100;
    max-height: 300px; overflow-y: auto; margin-top: 4px; display: none;
}
.pos-search-results.show { display: block; }
.pos-search-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #f8fafc;
    transition: background 0.1s;
}
.pos-search-item:hover { background: #f8fafc; }
.pos-search-item .p-name { font-weight: 600; font-size: 13px; }
.pos-search-item .p-price { font-weight: 700; color: var(--primary); font-size: 14px; }
.pos-search-item .p-stock { font-size: 11px; color: #94a3b8; }

.pos-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    align-content: start;
    gap: 12px; overflow-y: auto; padding-right: 4px;
    flex: 1;
}
.pos-product-card {
    background: #fff; border-radius: 12px; border: 1px solid #e2e8f0;
    padding: 14px; cursor: pointer; text-align: center;
    transition: all 0.15s; position: relative;
}
.pos-product-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(99,102,241,0.1); transform: translateY(-1px); }
.pos-product-card .pp-name { font-size: 12px; font-weight: 600; margin-top: 6px; line-height: 1.3; }
.pos-product-card .pp-price { font-size: 14px; font-weight: 700; color: var(--primary); margin-top: 2px; }
.pos-product-card .pp-stock { font-size: 10px; color: #94a3b8; }
.pos-product-card .pp-stock.low { color: var(--danger); }

/* Cart Area */
.cart-header {
    padding: 18px 20px; border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center; justify-content: space-between;
}
.cart-header h2 { font-size: 16px; font-weight: 700; }
.cart-items { flex: 1; overflow-y: auto; padding: 12px 16px; }
.cart-item {
    display: grid; grid-template-columns: 1fr auto auto auto;
    gap: 8px; align-items: center; padding: 10px 0;
    border-bottom: 1px solid #f8fafc; font-size: 13px;
}
.cart-item .ci-name { font-weight: 600; }
.cart-item .ci-price { color: #64748b; font-size: 11px; }
.cart-item .ci-qty { display: flex; align-items: center; gap: 6px; }
.cart-item .ci-qty button {
    width: 24px; height: 24px; border-radius: 6px; border: 1px solid #e2e8f0;
    background: #fff; cursor: pointer; font-size: 14px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.1s; color: #64748b;
}
.cart-item .ci-qty button:hover { background: #f1f5f9; }
.cart-item .ci-qty span { min-width: 20px; text-align: center; font-weight: 600; }
.cart-item .ci-total { font-weight: 700; color: var(--primary); text-align: right; min-width: 70px; }
.cart-item .ci-remove { color: var(--danger); cursor: pointer; font-size: 16px; padding: 2px; }

.cart-summary {
    padding: 16px 20px; border-top: 2px solid #e2e8f0; background: #fafbfc;
}
.cart-summary-row {
    display: flex; justify-content: space-between; padding: 5px 0;
    font-size: 13px; color: #64748b;
}
.cart-summary-row.total {
    font-size: 18px; font-weight: 700; color: var(--dark); border-top: 1px dashed #e2e8f0;
    padding-top: 10px; margin-top: 6px;
}
.cart-actions { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }

/* ===== AUTH PAGES ===== */
.auth-container {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 24px;
}
.auth-card {
    background: #fff; border-radius: 20px; width: 100%; max-width: 440px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15); overflow: hidden;
}
.auth-header { padding: 32px 32px 0; text-align: center; }
.auth-header .auth-logo {
    width: 56px; height: 56px; background: var(--primary); color: #fff;
    border-radius: 16px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 28px; margin-bottom: 16px;
}
.auth-header h2 { font-size: 22px; font-weight: 700; color: var(--dark); }
.auth-header p { font-size: 14px; color: #94a3b8; margin-top: 4px; }
.auth-body { padding: 28px 32px 32px; }
.auth-footer { padding: 16px 32px; text-align: center; border-top: 1px solid #f1f5f9; font-size: 13px; color: #94a3b8; }
.auth-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* ===== UTILITIES ===== */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: #94a3b8; }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mr-2 { margin-right: 8px; }
.ml-auto { margin-left: auto; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.rounded { border-radius: 8px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .pos-container { grid-template-columns: 1fr; }
    .pos-right { max-height: 50vh; }
}
@media (max-width: 768px) {
    .sidebar { width: var(--sidebar-collapsed); }
    .sidebar .sidebar-link span, .sidebar .brand-text, .sidebar .sidebar-section { display: none; }
    .sidebar .sidebar-link { justify-content: center; padding: 14px; }
    .sidebar .sidebar-link .badge { display: none; }
    .main-header { left: var(--sidebar-collapsed); }
    .main-content { margin-left: var(--sidebar-collapsed); }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .stat-cards { grid-template-columns: 1fr; }
    .main-content { padding: 12px; }
}

/* ===== PRINT ===== */
@media print {
    .sidebar, .main-header, .btn, .cart-actions { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
}
