/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    height: 100%;
    color: #333;
}

.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Navigation */
.top-nav {
    background: #12141e;
    border-bottom: 1px solid #2a2d3e;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 56px;
}

.nav-brand {
    font-size: 20px;
    font-weight: 700;
    color: #4f8cff;
    text-decoration: none;
    letter-spacing: -0.5px;
    margin-right: 24px;
    flex-shrink: 0;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

/* Direct top-level links (Work Orders, Invoices, VIN Lookup) */
.nav-link-direct {
    display: block;
    padding: 8px 14px;
    color: #8b8fa3;
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    border-radius: 6px;
    transition: color 0.18s, background 0.18s;
    white-space: nowrap;
}
.nav-link-direct:hover {
    color: #e8eaf0;
    background: rgba(79, 140, 255, 0.08);
}

/* Dropdown trigger labels */
.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    padding: 8px 14px;
    color: #8b8fa3;
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.18s, background 0.18s;
    white-space: nowrap;
}
.nav-link:hover {
    color: #e8eaf0;
    background: rgba(79, 140, 255, 0.08);
}

/* Muted variant (Admin label) */
.nav-link-muted {
    color: #5c6078;
}
.nav-link-muted:hover {
    color: #8b8fa3;
}

/* Spacer — pushes Admin/site/user to the right */
.nav-spacer {
    flex: 1;
}

/* Site selector wrapper */
.nav-site-selector {
    display: flex;
    align-items: center;
    margin: 0 4px;
}

/* + New create button */
.nav-create-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    background: linear-gradient(135deg, #4f8cff 0%, #6366f1 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: filter 0.18s, transform 0.18s;
    white-space: nowrap;
}
.nav-create-btn:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}
.nav-create-btn svg {
    width: 13px; height: 13px;
}

/* Dropdown panel */
.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #1a1d2b;
    border: 1px solid #2a2d3e;
    min-width: 210px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.45);
    border-radius: 10px;
    padding: 6px 6px 6px 6px;
    padding-top: 12px; /* visual gap lives inside the panel — no dead zone between trigger and menu */
    z-index: 200;
}

.nav-dropdown-right {
    left: auto;
    right: 0;
}

.nav-item:hover .nav-dropdown {
    display: block;
}

.nav-dropdown-btn {
    display: block;
    width: 100%;
    padding: 9px 10px;
    color: #8b8fa3;
    background: none;
    border: none;
    text-align: left;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.nav-dropdown-btn:hover {
    color: #e8eaf0;
    background: rgba(79, 140, 255, 0.08);
}

.nav-dropdown a {
    display: block;
    padding: 9px 10px;
    color: #8b8fa3;
    text-decoration: none;
    font-size: 13px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.nav-dropdown a:hover {
    color: #e8eaf0;
    background: rgba(79, 140, 255, 0.08);
}

.dropdown-header {
    padding: 8px 10px 4px;
    font-size: 10px;
    font-weight: 600;
    color: #5c6078;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dropdown-divider {
    height: 1px;
    background: #2a2d3e;
    margin: 4px 6px;
}

/* Database Indicator */
.db-indicator {
    background: #fff3cd;
    border-bottom: 2px solid #ffc107;
    padding: 8px 20px;
    text-align: center;
    font-size: 13px;
    color: #856404;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Footer */
.footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}

/* About Modal */
.about-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.about-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    min-width: 300px;
    overflow: hidden;
}

.about-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #4169e1;
    color: white;
    font-size: 15px;
}

.about-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.about-modal-body {
    padding: 16px 20px;
}

.about-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.about-row:last-child {
    border-bottom: none;
}

.about-row span:first-child {
    color: #666;
    font-weight: 500;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
}

.table tbody td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #4169e1;
    color: white;
}

.btn-primary:hover {
    background: #1e3a8a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(65, 105, 225, 0.3);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #4169e1;
    box-shadow: 0 0 0 3px rgba(65, 105, 225, 0.1);
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
    color: #0c5460;
}

.alert-danger {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.alert-success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 15px;
    font-weight: 600;
    color: #2d3748;
}

h1 { font-size: 32px; }
h2 { font-size: 28px; }
h3 { font-size: 24px; }
h4 { font-size: 20px; }

/* Responsive */
@media (max-width: 768px) {
    .nav-menu {
        display: none; /* Simplified - hide on mobile */
    }
    
    .main-content {
        padding: 20px 15px;
    }
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Table Action Buttons - Global Styles */
.table th:last-child,
.table td:last-child {
    text-align: right;
    white-space: nowrap;
    width: 180px;
    min-width: 180px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-sm.btn-primary {
    background: #4169e1;
    color: white;
}

.btn-sm.btn-primary:hover {
    background: #1e3a8a;
}

.btn-sm.btn-success {
    background: #28a745;
    color: white;
}

.btn-sm.btn-success:hover {
    background: #218838;
}

.btn-sm.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-sm.btn-warning:hover {
    background: #e0a800;
}

.btn-sm.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-sm.btn-danger:hover {
    background: #c82333;
}

.btn-sm.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-sm.btn-info:hover {
    background: #138496;
}

.btn-sm.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-sm.btn-secondary:hover {
    background: #5a6268;
}

.btn-icon {
    font-size: 14px;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-3 { margin-top: 20px; }
.mb-3 { margin-bottom: 20px; }
.container-fluid { padding: 0 20px; }

/* Hide Blazor error UI on print pages and when printing */
@media print {
    #blazor-error-ui {
        display: none !important;
    }
}

/* Style the error UI when it does appear (non-print pages) */
#blazor-error-ui {
    background: #ffebee;
    bottom: 0;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 10000;
    color: #721c24;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}