/* InventoryPro ERP - Exact Design Match */
:root {
    --primary: #7F3E98;
    --primary-dark: #6B2F82;
    --primary-light: #9B5BB5;
    --primary-soft: #F3E8F8;
    --sidebar-bg: #1A1A2E;
    --sidebar-hover: #25253D;
    --bg: #F5F3F7;
    --card-bg: #FFFFFF;
    --text: #1F2937;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ========== APP LAYOUT ========== */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
    width: 40px; height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.logo-text strong { display: block; font-size: 16px; }
.logo-text small { font-size: 11px; opacity: 0.6; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section {
    padding: 16px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.5;
    font-weight: 600;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    transition: all 0.2s;
    margin: 2px 8px;
    border-radius: 8px;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
    background: var(--primary);
    color: #fff;
    font-weight: 500;
}
.nav-item i { width: 20px; text-align: center; font-size: 15px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 11px;
    opacity: 0.6;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--card-bg);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.menu-toggle { display: none; background: none; font-size: 18px; color: var(--text); padding: 8px; }

.search-box {
    flex: 1;
    max-width: 480px;
    position: relative;
}
.search-box i {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted);
}
.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    outline: none;
    transition: border 0.2s;
}
.search-box input:focus { border-color: var(--primary); }
.search-box kbd {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: #E5E7EB; padding: 2px 6px; border-radius: 4px;
    font-size: 11px; color: var(--text-muted);
}

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.icon-btn {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    position: relative;
    color: var(--text);
}
.badge-count {
    position: absolute; top: -2px; right: -2px;
    background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 600;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

.user-menu {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
}
.user-menu:hover { background: var(--bg); }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.user-info strong { display: block; font-size: 13px; }
.user-info small { font-size: 11px; color: var(--text-muted); }
.dropdown-menu {
    display: none;
    position: absolute; top: 100%; right: 0;
    background: #fff; border-radius: 10px;
    box-shadow: var(--shadow-md);
    min-width: 180px;
    padding: 8px 0;
    z-index: 100;
}
.user-menu:hover .dropdown-menu { display: block; }
.dropdown-menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; font-size: 13px;
}
.dropdown-menu a:hover { background: var(--bg); }
.dropdown-menu hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.text-danger { color: var(--danger) !important; }

/* Page Content */
.page-content { padding: 24px; flex: 1; }

.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p { color: var(--text-muted); margin-top: 4px; }

/* ========== KPI CARDS ========== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 8px;
}
.kpi-card .kpi-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.kpi-icon.purple { background: var(--primary-soft); color: var(--primary); }
.kpi-icon.blue { background: #DBEAFE; color: var(--info); }
.kpi-icon.green { background: #D1FAE5; color: var(--success); }
.kpi-icon.red { background: #FEE2E2; color: var(--danger); }
.kpi-card .kpi-value { font-size: 28px; font-weight: 700; }
.kpi-card .kpi-label { font-size: 13px; color: var(--text-muted); }
.kpi-card .kpi-change {
    font-size: 12px; font-weight: 500;
    display: flex; align-items: center; gap: 4px;
}
.kpi-change.up { color: var(--success); }
.kpi-change.down { color: var(--danger); }

/* ========== ACTION CARDS ========== */
.action-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.action-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.action-card.primary {
    background: var(--primary);
    color: #fff;
}
.action-card .action-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.action-card.primary .action-icon { background: rgba(255,255,255,0.2); }
.action-card:not(.primary) .action-icon { background: var(--primary-soft); color: var(--primary); }
.action-card h3 { font-size: 16px; font-weight: 600; }
.action-card p { font-size: 13px; opacity: 0.8; }
.action-card .btn-sm { align-self: flex-start; margin-top: 8px; }

/* ========== CARDS & TABLES ========== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted); font-weight: 600; background: #FAFAFA; }
td { font-size: 13px; }
tr:hover td { background: #FAFAFA; }
.item-cell { display: flex; align-items: center; gap: 12px; }
.item-img {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--primary-soft);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary); font-size: 14px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-completed, .badge-active { background: #D1FAE5; color: #065F46; }
.badge-danger, .badge-open { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-purple { background: var(--primary-soft); color: var(--primary); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; margin-bottom: 6px;
    font-size: 13px; font-weight: 500; color: var(--text);
}
.form-group label .required { color: var(--danger); }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: border 0.2s;
    background: #fff;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(127,62,152,0.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* Steps */
.steps {
    display: flex; gap: 8px;
    margin-bottom: 24px;
}
.step {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg);
}
.step.active { background: var(--primary); color: #fff; }
.step.done { background: var(--primary-soft); color: var(--primary); }
.step-num {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
}
.step.active .step-num { background: rgba(255,255,255,0.3); }
.step.done .step-num { background: var(--primary); color: #fff; }

/* Two column layout for checkout */
.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}
.checkout-panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.checkout-panel h3 {
    font-size: 14px; font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* Scanner area */
.scanner-box {
    border: 2px dashed var(--primary-light);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: var(--primary-soft);
    margin-bottom: 16px;
}
.scanner-box i { font-size: 48px; color: var(--primary); margin-bottom: 12px; }
.scanner-box p { color: var(--text-muted); font-size: 13px; }

/* Quantity stepper */
.qty-stepper {
    display: flex; align-items: center; gap: 8px;
}
.qty-stepper button {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 16px;
}
.qty-stepper input {
    width: 60px; text-align: center;
    padding: 6px; border: 1px solid var(--border);
    border-radius: 8px;
}

/* Activity feed */
.activity-list { list-style: none; }
.activity-item {
    display: flex; gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}
.activity-icon.green { background: #D1FAE5; color: var(--success); }
.activity-icon.blue { background: #DBEAFE; color: var(--info); }
.activity-icon.red { background: #FEE2E2; color: var(--danger); }
.activity-icon.purple { background: var(--primary-soft); color: var(--primary); }
.activity-content { flex: 1; }
.activity-content strong { font-size: 13px; }
.activity-content p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #7F3E98 0%, #4A1C6B 100%);
}
.login-left {
    flex: 1;
    display: flex; flex-direction: column;
    justify-content: center;
    padding: 60px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.login-left::before {
    content: '';
    position: absolute; inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="80" cy="20" r="40" fill="rgba(255,255,255,0.05)"/><circle cx="20" cy="80" r="30" fill="rgba(255,255,255,0.03)"/></svg>');
}
.login-left h1 { font-size: 36px; font-weight: 700; margin: 24px 0 12px; position: relative; }
.login-left p { font-size: 16px; opacity: 0.85; max-width: 400px; position: relative; }
.login-features {
    display: flex; gap: 24px; margin-top: 40px; position: relative;
}
.login-feature { text-align: center; }
.login-feature i {
    width: 48px; height: 48px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 8px; font-size: 18px;
}
.login-feature span { font-size: 12px; opacity: 0.8; }

.login-right {
    width: 480px;
    background: #fff;
    display: flex; flex-direction: column;
    justify-content: center;
    padding: 60px 48px;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon { margin: 0 auto 12px; }
.login-logo h2 { font-size: 22px; margin-bottom: 4px; }
.login-logo p { color: var(--text-muted); font-size: 14px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form .form-control { padding: 12px 16px; }
.login-options {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px; font-size: 13px;
}
.login-options a { color: var(--primary); }
.login-options label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    font-size: 15px; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-btn:hover { background: var(--primary-dark); }
.login-footer {
    text-align: center; margin-top: 24px;
    font-size: 12px; color: var(--text-muted);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff;
    border-radius: 16px;
    width: 90%; max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 18px; }
.modal-close { background: none; font-size: 20px; color: var(--text-muted); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 12px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
    display: flex; align-items: center; gap: 10px;
}
.alert-success { background: #D1FAE5; color: #065F46; }
.alert-danger { background: #FEE2E2; color: #991B1B; }
.alert-warning { background: #FEF3C7; color: #92400E; }
.alert-info { background: #DBEAFE; color: #1E40AF; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.content-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
}

/* Profile header */
.profile-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius);
    padding: 32px;
    color: #fff;
    display: flex; align-items: center; gap: 24px;
    margin-bottom: 24px;
}
.profile-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.3);
}
.profile-stats {
    display: flex; gap: 32px; margin-left: auto;
}
.profile-stat { text-align: center; }
.profile-stat .val { font-size: 24px; font-weight: 700; }
.profile-stat .lbl { font-size: 12px; opacity: 0.8; }

/* Tabs */
.tabs {
    display: flex; gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.tab {
    padding: 12px 20px;
    font-size: 13px; font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Empty state */
.empty-state {
    text-align: center; padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }

/* Responsive */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .checkout-grid { grid-template-columns: 1fr; }
    .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .action-grid { grid-template-columns: 1fr; }
    .login-page { flex-direction: column; }
    .login-left { display: none; }
    .login-right { width: 100%; }
    .form-row { grid-template-columns: 1fr; }
    .profile-header { flex-direction: column; text-align: center; }
    .profile-stats { margin-left: 0; }
}

/* Utility */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 12px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.fw-600 { font-weight: 600; }
.w-100 { width: 100%; }

/* Logo image in sidebar */
.logo-img {
    max-width: 180px;
    max-height: 48px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}
.sidebar-header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
}
.logo-fallback {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Login page logo */
.login-logo-img {
    max-width: 220px;
    max-height: 60px;
    margin-bottom: 16px;
}
.login-left .login-brand-logo {
    max-width: 200px;
    max-height: 55px;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}
