/* EH Mecanic Invoice System - Styles */

:root {
    --primary: #0b2b5a;
    --primary-light: #1a4a8a;
    --accent: #d9e5f5;
    --accent-dark: #b7c6df;
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --text: #2d3748;
    --text-light: #718096;
    --success: #38a169;
    --danger: #e53e3e;
    --warning: #dd6b20;
    --border: #e2e8f0;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Layout */
.app-header {
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-header img { height: 40px; border-radius: 6px; }
.app-header h1 { font-size: 18px; font-weight: 600; }
.app-header .nav-links { margin-left: auto; display: flex; gap: 6px; }
.app-header .nav-links button {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.25);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.app-header .nav-links button:hover,
.app-header .nav-links button.active {
    background: rgba(255,255,255,0.3);
}

.container {
    max-width: 960px;
    margin: 20px auto;
    padding: 0 16px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}
.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #2f8a5a; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c53030; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #c05621; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--accent); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 12px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: white;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11,43,90,0.1);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* Selection lists */
.select-list {
    display: grid;
    gap: 6px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 4px;
}
.select-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}
.select-item:hover { border-color: var(--primary); background: var(--accent); }
.select-item.selected {
    border-color: var(--primary);
    background: var(--accent);
    font-weight: 500;
}
.select-item .item-main { font-weight: 500; }
.select-item .item-sub { font-size: 12px; color: var(--text-light); }

/* Steps / Wizard */
.wizard-steps {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.wizard-step {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    background: var(--border);
    border-radius: 6px;
    min-width: 90px;
    white-space: nowrap;
}
.wizard-step.active {
    background: var(--primary);
    color: white;
}
.wizard-step.done {
    background: var(--success);
    color: white;
}

/* Invoice items table */
.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.items-table th {
    background: var(--accent);
    color: var(--primary);
    font-weight: 600;
    padding: 8px 10px;
    text-align: left;
    border: 1px solid var(--accent-dark);
}
.items-table td {
    padding: 8px 10px;
    border: 1px solid var(--border);
    vertical-align: top;
}
.items-table .vehicle-row {
    background: #eef2f8;
    font-weight: 600;
    color: var(--primary);
}
.items-table .total-row {
    font-weight: 700;
    background: var(--accent);
}
.items-table .remove-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
}
.items-table .remove-btn:hover { background: #fee; border-radius: 4px; }

/* Invoice actions bar */
.actions-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

/* Totals box */
.totals-box {
    background: var(--accent);
    border-radius: 8px;
    padding: 14px 18px;
    margin-top: 12px;
    width: 260px;
    margin-left: auto;
}
.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}
.totals-row.grand-total {
    font-weight: 700;
    font-size: 16px;
    border-top: 2px solid var(--primary);
    padding-top: 8px;
    margin-top: 4px;
    color: var(--primary);
}

/* 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: white;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
}
.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}
.checkbox-group label { margin-bottom: 0; font-size: 14px; }

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 300;
    animation: slideIn 0.3s ease;
    max-width: 350px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-light);
}
.empty-state p { margin-bottom: 12px; }

/* Invoices list */
.invoice-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s;
}
.invoice-list-item:hover { background: var(--accent); }
.invoice-list-item .inv-number {
    font-weight: 600;
    color: var(--primary);
    font-size: 15px;
}
.invoice-list-item .inv-info {
    font-size: 12px;
    color: var(--text-light);
}
.invoice-list-item .inv-actions { display: flex; gap: 6px; }

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 640px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .app-header { flex-wrap: wrap; }
    .app-header .nav-links { flex-wrap: wrap; }
    .totals-box { width: 100%; }
    .wizard-step { font-size: 10px; min-width: 70px; padding: 6px 4px; }
}
