/* Benz General - Back-office Dashboard Stylesheet (Light Theme) */

/* Auth Layout */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.04) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(2, 132, 199, 0.04) 0px, transparent 50%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    background: var(--bg-secondary);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue-glow);
    margin: 0 auto 1rem auto;
    object-fit: cover;
}

/* Dashboard Panel Layout */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* Sidebar Styling */
aside {
    background: var(--bg-secondary);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--accent-blue);
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
}

.sidebar-user {
    padding: 1.25rem 1.5rem;
    background: rgba(0, 0, 0, 0.01);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--accent-blue);
    font-weight: 600;
    text-transform: uppercase;
    display: block;
    margin-top: 0.2rem;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.menu-item:hover, .menu-item.active {
    background: rgba(2, 132, 199, 0.08);
    color: var(--accent-blue);
}

.menu-item svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* Main Content Area */
main {
    padding: 2rem;
    overflow-y: auto;
    max-height: 100vh;
}

.main-header {
    margin-bottom: 2rem;
}

.main-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.panel-view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.panel-view.active {
    display: block;
}

/* Dashboard Widgets */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-sales { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.icon-exp { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); }
.icon-profit { background: rgba(2, 132, 199, 0.1); color: var(--accent-blue); }
.icon-repairs { background: rgba(217, 119, 6, 0.1); color: var(--accent-gold); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Charts Wrapper */
.chart-card {
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: var(--bg-secondary);
}

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

.chart-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-filters {
    display: flex;
    gap: 0.5rem;
}

.chart-filter-btn {
    background: var(--bg-tertiary);
    border: 1px solid rgba(0,0,0,0.06);
    color: var(--text-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
}

.chart-filter-btn.active {
    background: var(--accent-blue);
    color: #ffffff;
}

/* SVG Chart rendering styles */
.bar-chart-svg {
    width: 100%;
    height: 250px;
}

.chart-bar-income {
    fill: var(--accent-blue);
    transition: height 0.5s ease, y 0.5s ease;
}

.chart-bar-expense {
    fill: var(--accent-red);
    transition: height 0.5s ease, y 0.5s ease;
}

.chart-axis-line {
    stroke: rgba(0, 0, 0, 0.1);
    stroke-width: 1px;
}

.chart-text {
    fill: var(--text-secondary);
    font-size: 10px;
    font-family: var(--font-family);
    font-weight: 500;
}

.chart-legend {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Table layout styling */
.table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--bg-secondary);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

th {
    background: #f1f5f9;
    color: var(--text-secondary);
    font-weight: 700;
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
    vertical-align: middle;
}

tr:hover td {
    background: rgba(0, 0, 0, 0.01);
}

/* Forms in Admin view */
.admin-card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.search-bar-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Webcam module styling */
.webcam-container {
    background: #000;
    border-radius: var(--border-radius-sm);
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.webcam-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.webcam-canvas {
    display: none;
}

.webcam-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.webcam-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* POS / Billing Panels */
.pos-layout {
    display: grid;
    grid-template-columns: 1.6fr 1.4fr;
    gap: 1.5rem;
}

.pos-cart-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
}

.cart-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pos-totals {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding-top: 1rem;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.50rem;
    color: var(--text-primary);
}

/* Popups & Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius-md);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

@media print {
    #admin-container, #auth-container, .no-print, .modal-close, button {
        display: none !important;
    }
    body, html {
        background: #fff !important;
        color: #000 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }
    .modal-overlay {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        background: #fff !important;
        backdrop-filter: none !important;
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: auto !important;
    }
    .modal-content {
        position: static !important;
        max-width: 100% !important;
        width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #fff !important;
        overflow: visible !important;
        max-height: none !important;
    }
    #print-invoice-area, #print-invoice-area * {
        visibility: visible !important;
    }
}

/* Responsive configurations for Admin */
@media (max-width: 1024px) {
    .admin-layout { grid-template-columns: 80px 1fr; }
    .sidebar-title, .user-name, .user-role, .menu-item span { display: none; }
    .sidebar-header { justify-content: center; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .pos-layout { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .stat-grid { grid-template-columns: 1fr; }
    main { padding: 1rem; }
}
