/* Ecomy App - Main Stylesheet */
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --success: #0d9488;
    --success-light: #ccfbf1;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-w: 260px;
    --topbar-h: 56px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --transition: 150ms ease;
}

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

html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--gray-50); color: var(--gray-800); line-height: 1.5; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Staging Banner */
.staging-banner { background: var(--warning); color: #000; text-align: center; padding: 4px 12px; font-size: .8rem; font-weight: 600; position: fixed; top: 0; left: 0; right: 0; z-index: 9999; }
.staging-banner ~ .app-layout { padding-top: 28px; }

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

/* Sidebar */
.sidebar { width: var(--sidebar-w); background: var(--gray-900); color: #fff; position: fixed; top: 0; bottom: 0; left: 0; overflow-y: auto; z-index: 100; display: flex; flex-direction: column; transition: transform var(--transition); }
.sidebar-brand { padding: 16px 20px; font-size: 1.25rem; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 10px; }
.sidebar-brand img { height: 28px; }
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: var(--gray-400); font-size: .9rem; transition: all var(--transition); border-left: 3px solid transparent; }
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,.05); text-decoration: none; }
.sidebar-nav a.active { color: #fff; background: rgba(255,255,255,.1); border-left-color: var(--primary); }
.sidebar-nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-section { padding: 12px 20px 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); }
.sidebar-user { padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: .85rem; }
.sidebar-user .name { color: #fff; font-weight: 500; }
.sidebar-user .role { color: var(--gray-500); font-size: .75rem; }

/* Main Content */
.main-content { flex: 1; margin-left: var(--sidebar-w); }
.topbar { height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-size: 1.1rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 24px; max-width: 1400px; }

/* Cards */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }
.card-header h2, .card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--gray-100); background: var(--gray-50); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stat-card .stat-label { font-size: .8rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .03em; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; margin-top: 4px; }
.stat-card .stat-sub { font-size: .8rem; color: var(--gray-500); margin-top: 4px; }
.stat-card.primary .stat-value { color: var(--primary); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-size: .9rem; font-weight: 500; border: 1px solid transparent; cursor: pointer; transition: all var(--transition); line-height: 1.4; text-decoration: none !important; }
.btn:hover { opacity: .9; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; color: var(--gray-700); border-color: var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn svg { width: 16px; height: 16px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .85rem; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; }
.form-label .required { color: var(--danger); }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: .9rem; font-family: inherit; transition: border-color var(--transition); background: #fff; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.15); }
.form-control.error { border-color: var(--danger); }
select.form-control { appearance: auto; }
textarea.form-control { min-height: 80px; resize: vertical; }
.form-hint { font-size: .78rem; color: var(--gray-500); margin-top: 2px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 2px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-section { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--gray-200); }
.form-section:last-child { border-bottom: none; }
.form-section-title { font-size: .95rem; font-weight: 600; margin-bottom: 16px; color: var(--gray-700); }

.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .9rem; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th { text-align: left; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--gray-500); padding: 10px 12px; border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); font-size: .9rem; }
table tr:hover td { background: var(--gray-50); }
table .text-right { text-align: right; }
table .text-center { text-align: center; }
table .actions { white-space: nowrap; }
table .actions a { margin-right: 8px; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-concept { background: var(--gray-200); color: var(--gray-700); }
.badge-verzonden { background: var(--primary-light); color: var(--primary); }
.badge-geaccepteerd { background: var(--success-light); color: var(--success); }
.badge-afgewezen { background: var(--danger-light); color: var(--danger); }
.badge-verlopen { background: var(--warning-light); color: #92400e; }
.badge-gefactureerd { background: #dbeafe; color: #1e40af; }
.badge-open { background: var(--primary-light); color: var(--primary); }
.badge-betaald { background: var(--success-light); color: var(--success); }
.badge-geannuleerd { background: var(--danger-light); color: var(--danger); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: .9rem; }
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.alert-info { background: var(--primary-light); color: #1e40af; border: 1px solid #93c5fd; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: none; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--gray-500); }

/* Quote Lines Editor */
.lines-table { width: 100%; }
.lines-table th { font-size: .75rem; }
.lines-table td { padding: 6px 4px; vertical-align: top; }
.lines-table input, .lines-table select { font-size: .85rem; padding: 6px 8px; }
.lines-table .line-desc { min-width: 250px; }
.lines-table .line-qty { width: 70px; }
.lines-table .line-price { width: 100px; }
.lines-table .line-total { width: 100px; text-align: right; font-weight: 500; }
.line-remove { color: var(--danger); cursor: pointer; background: none; border: none; font-size: 1.1rem; }

.totals-box { background: var(--gray-50); border-radius: var(--radius); padding: 16px 20px; margin-top: 16px; }
.totals-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: .9rem; }
.totals-row.total { font-weight: 700; font-size: 1.1rem; padding-top: 8px; border-top: 2px solid var(--gray-300); margin-top: 8px; }

/* Wizard Steps */
.wizard-steps { display: flex; margin-bottom: 24px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.wizard-step { flex: 1; padding: 14px 16px; text-align: center; font-size: .85rem; font-weight: 500; color: var(--gray-500); border-bottom: 3px solid transparent; cursor: pointer; transition: all var(--transition); }
.wizard-step.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-light); }
.wizard-step.done { color: var(--success); border-bottom-color: var(--success); }
.wizard-step .step-num { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 50%; background: var(--gray-200); font-size: .75rem; margin-right: 6px; }
.wizard-step.active .step-num { background: var(--primary); color: #fff; }
.wizard-step.done .step-num { background: var(--success); color: #fff; }

/* Search */
.search-box { position: relative; }
.search-box input { padding-left: 36px; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray-400); width: 18px; height: 18px; }

/* Pagination */
.pagination { display: flex; gap: 4px; margin-top: 16px; justify-content: center; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 4px; font-size: .85rem; }
.pagination a { background: #fff; border: 1px solid var(--gray-300); color: var(--gray-700); }
.pagination a:hover { background: var(--gray-50); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border: 1px solid var(--primary); }

/* Guest/Login Layout */
.guest-layout { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%); padding: 20px; }
.guest-card { background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.15); padding: 40px; width: 100%; max-width: 420px; }
.guest-logo { text-align: center; margin-bottom: 24px; font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.guest-title { text-align: center; font-size: 1.1rem; margin-bottom: 24px; color: var(--gray-600); }

/* Responsive */
.mobile-toggle { display: none; background: none; border: none; padding: 8px; cursor: pointer; }
.mobile-toggle svg { width: 24px; height: 24px; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: block; }
    .wizard-steps { flex-wrap: wrap; }
    .wizard-step { flex: none; width: 50%; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 16px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .topbar-title { font-size: .95rem; }
}

/* Utilities */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-sm { font-size: .85rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none !important; }
.w-full { width: 100%; }
