/* assets/css/style.css - Desktop POS & Admin UI for SWADESH BOSTRALOY */
@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    --dark-bg: #0f172a;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #0284c7;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --font-family: 'Hind Siliguri', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--body-bg);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    font-size: 14.5px;
    -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid #334155;
    transition: width 0.2s ease;
}

.app-container.sidebar-collapsed .sidebar {
    width: 68px;
}
.app-container.sidebar-collapsed .brand-info,
.app-container.sidebar-collapsed .nav-label,
.app-container.sidebar-collapsed .nav-link span:not(.icon),
.app-container.sidebar-collapsed .nav-link strong,
.app-container.sidebar-collapsed .user-details,
.app-container.sidebar-collapsed .logout-btn {
    display: none !important;
}
.app-container.sidebar-collapsed .brand {
    padding: 16px 8px;
    justify-content: center;
}
.app-container.sidebar-collapsed .brand-icon {
    width: 36px;
    height: 36px;
}
.app-container.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}
.app-container.sidebar-collapsed .sidebar-user {
    padding: 12px 8px;
    justify-content: center;
}

.brand {
    padding: 22px 20px;
    background: #0f172a;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

.brand-info h2 {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    margin: 0;
}

.brand-info span {
    font-size: 11.5px;
    color: #94a3b8;
    display: block;
}

.nav-menu {
    list-style: none;
    padding: 15px 10px;
    flex: 1;
    overflow-y: auto;
}

.nav-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    padding: 10px 14px 4px;
}

.nav-item {
    margin-bottom: 3px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.nav-link .icon {
    font-size: 17px;
    width: 22px;
    text-align: center;
}

/* User Card in Sidebar */
.sidebar-user {
    padding: 15px 18px;
    background: #0f172a;
    border-top: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: #334155;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #38bdf8;
}

.user-details h4 {
    font-size: 13.5px;
    font-weight: 600;
    color: #f1f5f9;
}

.role-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
}

.role-admin { background: #0284c7; color: #fff; }
.role-cashier { background: #10b981; color: #fff; }

.logout-btn {
    color: #94a3b8;
    text-decoration: none;
    font-size: 18px;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

.logout-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Top Navbar */
.topbar {
    min-height: 60px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    position: relative;
    z-index: 10;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex-shrink: 1;
}

.btn-toggle-sidebar {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 17px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}
.btn-toggle-sidebar:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.page-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.shop-badge {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 1240px) {
    .shop-badge {
        display: none;
    }
}

.btn-pos-quick {
    background: #10b981;
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    transition: background 0.2s;
}

.btn-pos-quick:hover {
    background: #059669;
}

/* Content Body */
.content-body {
    padding: 24px 28px;
    flex: 1;
}

/* Flash Messages */
.flash-alert {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
}
.flash-success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }

/* Dashboard Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
}

.kpi-card.green::before { background: var(--success); }
.kpi-card.amber::before { background: var(--warning); }
.kpi-card.purple::before { background: #8b5cf6; }
.kpi-card.red::before { background: var(--danger); }

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: var(--primary-light);
    color: var(--primary);
}

.kpi-card.green .kpi-icon { background: var(--success-light); color: var(--success); }
.kpi-card.amber .kpi-icon { background: var(--warning-light); color: var(--warning); }
.kpi-card.purple .kpi-icon { background: #ede9fe; color: #8b5cf6; }
.kpi-card.red .kpi-icon { background: var(--danger-light); color: var(--danger); }

.kpi-content h3 {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.kpi-val {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Card Containers */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 22px 24px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1.5px solid var(--border-color);
    font-size: 13px;
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    color: #334155;
    vertical-align: middle;
}

.table tr:hover {
    background: #f1f5f9;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-info { background: var(--info-light); color: #1e40af; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #cbd5e1; }

.btn-sm {
    padding: 5px 10px;
    font-size: 12.5px;
    border-radius: 6px;
}

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

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13.5px;
    color: #334155;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-main);
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Search bar & filter */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
    background: #fff;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.filter-bar .form-control {
    max-width: 250px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-dialog {
    background: #ffffff;
    border-radius: 14px;
    max-width: 550px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: slideDown 0.25s ease-out;
}

.modal-header {
    padding: 16px 22px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #64748b;
}

.modal-body {
    padding: 22px;
}

.modal-footer {
    padding: 14px 22px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Retail POS Calculator Styles */
.calc-modal-dialog {
    max-width: 380px !important;
    border-radius: 16px;
    background: #0f172a;
    color: #fff;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid #334155;
}
.calc-modal-header {
    background: #1e293b;
    border-bottom: 1px solid #334155;
    padding: 12px 18px;
}
.calc-modal-header .modal-title {
    color: #f8fafc;
    font-size: 15px;
    font-weight: 700;
}
.calc-modal-header .modal-close {
    color: #94a3b8;
}
.calc-modal-header .modal-close:hover {
    color: #fff;
}
.calc-body {
    padding: 16px;
    background: #0f172a;
}
.calc-screen {
    background: #1e293b;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 14px;
    text-align: right;
    border: 1px solid #334155;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}
.calc-expression {
    font-size: 13px;
    color: #94a3b8;
    min-height: 18px;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.calc-current {
    font-size: 30px;
    font-weight: 800;
    color: #38bdf8;
    font-family: 'Segoe UI', Arial, monospace;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.calc-btn {
    height: 52px;
    border-radius: 10px;
    border: none;
    background: #1e293b;
    color: #f1f5f9;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}
.calc-btn:hover {
    background: #334155;
    transform: translateY(-1px);
}
.calc-btn:active {
    transform: translateY(1px);
}
.calc-btn-func {
    background: #334155;
    color: #94a3b8;
    font-size: 16px;
}
.calc-btn-func:hover {
    background: #475569;
    color: #fff;
}
.calc-btn-op {
    background: #0284c7;
    color: #ffffff;
    font-size: 20px;
}
.calc-btn-op:hover {
    background: #0369a1;
}
.calc-btn-eq {
    background: #10b981;
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}
.calc-btn-eq:hover {
    background: #059669;
}
.calc-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #334155;
}

/* Mobile & Camera Barcode Scanner Modal */
.scanner-modal-dialog {
    max-width: 440px !important;
    border-radius: 16px;
    background: #0f172a;
    color: #f8fafc;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    border: 1px solid #334155;
    overflow: hidden;
}
.scanner-modal-header {
    background: #1e293b;
    border-bottom: 1px solid #334155;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.scanner-modal-header .modal-title {
    color: #38bdf8;
    font-size: 15px;
    font-weight: 700;
}
.scanner-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.scanner-viewport-wrap {
    position: relative;
    width: 100%;
    min-height: 250px;
    background: #020617;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #0284c7;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}
#cameraScannerViewport {
    width: 100%;
}
#cameraScannerViewport video {
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
    border-radius: 10px;
}
.scanner-laser-line {
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ef4444, #f87171, #ef4444, transparent);
    box-shadow: 0 0 8px #ef4444, 0 0 14px #f87171;
    z-index: 10;
    pointer-events: none;
    animation: scanLaser 2s infinite ease-in-out;
}
@keyframes scanLaser {
    0% { transform: translateY(-45px); opacity: 0.8; }
    50% { transform: translateY(45px); opacity: 1; }
    100% { transform: translateY(-45px); opacity: 0.8; }
}
.scanner-status {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    min-height: 22px;
    color: #38bdf8;
    line-height: 1.4;
}
.scanner-last-code {
    font-size: 13px;
    text-align: center;
    color: #94a3b8;
    min-height: 20px;
}
.scanner-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}
.scanner-btn {
    padding: 8px 14px;
    background: #334155;
    color: #f8fafc;
    border: 1px solid #475569;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}
.scanner-btn:hover {
    background: #475569;
}
.scanner-hint {
    font-size: 12px;
    color: #64748b;
    text-align: center;
    line-height: 1.4;
}
