/**
 * AutoParts Pro ERP - Custom Automotive Design System
 * Modern, clean, responsive styling for enterprise ERP & POS
 */

:root {
    --erp-sidebar-bg: #0f172a;
    --erp-sidebar-hover: #1e293b;
    --erp-sidebar-active: #3b82f6;
    --erp-sidebar-text: #94a3b8;
    --erp-sidebar-text-active: #ffffff;
    --erp-topbar-bg: #ffffff;
    --erp-body-bg: #f1f5f9;
    --erp-card-bg: #ffffff;
    --erp-border-color: #e2e8f0;
    --erp-primary: #2563eb;
    --erp-primary-dark: #1d4ed8;
    --erp-success: #10b981;
    --erp-warning: #f59e0b;
    --erp-danger: #ef4444;
    --erp-info: #06b6d4;
    --erp-radius: 10px;
    --erp-shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --erp-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --erp-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--erp-body-bg);
    color: #1e293b;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* App Wrapper */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.erp-sidebar {
    width: 270px;
    min-width: 270px;
    background-color: var(--erp-sidebar-bg);
    color: var(--erp-sidebar-text);
    display: flex;
    flex-direction: column;
    transition: all 0.25s ease-in-out;
    z-index: 1020;
}

.erp-sidebar .brand-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.erp-sidebar .brand-header .brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.erp-sidebar .brand-header .brand-title i {
    color: var(--erp-sidebar-active);
}

.erp-sidebar .sidebar-menu {
    padding: 1rem 0.75rem;
    overflow-y: auto;
    flex: 1;
}

.erp-sidebar .menu-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    font-weight: 700;
    margin: 1.2rem 0.75rem 0.4rem 0.75rem;
}

.erp-sidebar .nav-link {
    color: var(--erp-sidebar-text);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    margin-bottom: 0.2rem;
}

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

.erp-sidebar .nav-link.active {
    background-color: var(--erp-sidebar-active);
    color: var(--erp-sidebar-text-active);
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.erp-sidebar .nav-link i {
    width: 20px;
    font-size: 1rem;
    text-align: center;
}

/* User Badge in Sidebar */
.sidebar-user-card {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-info .name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info .role-badge {
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    font-weight: 600;
}

/* Main Content Area */
.erp-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--erp-body-bg);
}

/* Top Navbar */
.erp-topbar {
    height: 70px;
    background-color: var(--erp-topbar-bg);
    border-bottom: 1px solid var(--erp-border-color);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1010;
    box-shadow: var(--erp-shadow-sm);
}

.erp-content {
    padding: 1.5rem;
    flex: 1;
}

/* Modern Card Styling */
.card {
    border: 1px solid var(--erp-border-color);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow-sm);
    background-color: var(--erp-card-bg);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: var(--erp-shadow-md);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--erp-border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* Metric / Stat Cards */
.stat-card {
    border: none;
    border-radius: var(--erp-radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    margin-top: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

/* POS Terminal Specific Styling */
.pos-container {
    height: calc(100vh - 120px);
    display: flex;
    gap: 1rem;
}

.pos-products-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: var(--erp-radius);
    border: 1px solid var(--erp-border-color);
    padding: 1rem;
    overflow: hidden;
}

.pos-cart-panel {
    width: 420px;
    min-width: 420px;
    background: #ffffff;
    border-radius: var(--erp-radius);
    border: 1px solid var(--erp-border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--erp-shadow-md);
}

.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}

.pos-cart-summary {
    background: #f8fafc;
    border-top: 1px solid var(--erp-border-color);
    padding: 1rem;
}

.pos-product-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.pos-product-card {
    border: 1px solid var(--erp-border-color);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    background: #ffffff;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pos-product-card:hover {
    border-color: var(--erp-primary);
    box-shadow: var(--erp-shadow-md);
    transform: translateY(-2px);
}

.pos-product-card .stock-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Vehicle Lookup Card */
.vehicle-lookup-banner {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #ffffff;
    border-radius: var(--erp-radius);
    padding: 1.5rem;
    box-shadow: var(--erp-shadow-md);
}

/* Tables */
.table th {
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: 2px solid var(--erp-border-color);
    background-color: #f8fafc;
    vertical-align: middle;
}

.table td {
    vertical-align: middle;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--erp-border-color);
}

/* Form Controls */
.form-control, .form-select {
    border-color: #cbd5e1;
    border-radius: 6px;
    font-size: 0.88rem;
    padding: 0.55rem 0.8rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--erp-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.88rem;
    padding: 0.5rem 1rem;
    transition: all 0.15s ease-in-out;
}

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

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

/* Badges */
.badge {
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 0.35rem 0.65rem;
    border-radius: 5px;
}

/* Invoice Layouts */
.invoice-box {
    max-width: 850px;
    margin: auto;
    padding: 30px;
    border: 1px solid #eee;
    background: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    line-height: 22px;
    color: #333;
}

.receipt-thermal {
    max-width: 80mm;
    margin: auto;
    padding: 10px;
    background: #fff;
    font-family: "Courier New", Courier, monospace;
    font-size: 12px;
    line-height: 16px;
    color: #000;
}

/* Print CSS */
@media print {
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
    }
    .erp-sidebar, .erp-topbar, .btn-print, .no-print, .btn, .breadcrumb, footer, .modal {
        display: none !important;
    }
    .erp-main, .erp-content, .app-wrapper {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        background: transparent !important;
    }
    .invoice-box {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    .receipt-thermal {
        width: 80mm !important;
        max-width: 80mm !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* Responsive */
@media (max-width: 992px) {
    .erp-sidebar {
        position: fixed;
        left: -270px;
        top: 0;
        bottom: 0;
    }
    .erp-sidebar.show {
        left: 0;
    }
    .pos-container {
        flex-direction: column;
        height: auto;
    }
    .pos-cart-panel {
        width: 100%;
        min-width: 100%;
    }
}
