html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow-x: hidden;
    color: #1f2937;
    line-height: 1.6;
}

body {
    margin: 0;
    background: #f8f9fa;
}

a, .btn-link {
    color: #2563eb;
    transition: color 0.2s ease;
}

a:hover, .btn-link:hover {
    color: #1d4ed8;
}

.btn-primary {
    color: #fff;
    background-color: #2563eb;
    border-color: #2563eb;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn-success {
    background-color: #059669;
    border-color: #059669;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-success:hover {
    background-color: #047857;
    border-color: #047857;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn-secondary {
    color: #fff;
    background-color: #6b7280;
    border-color: #6b7280;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    color: #fff;
    background-color: #4b5563;
    border-color: #4b5563;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn-warning {
    background-color: #f59e0b;
    border-color: #f59e0b;
    color: white;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-warning:hover {
    background-color: #d97706;
    border-color: #d97706;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #dc2626;
    border-color: #dc2626;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.15rem rgba(37, 99, 235, 0.25);
    outline: none;
}

.content {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

h5 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 2px solid #10b981;
    border-radius: 0.375rem;
}

.invalid {
    outline: 2px solid #ef4444;
    border-radius: 0.375rem;
}

.validation-message {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-control, .form-select {
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIg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0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Modal helper styles used by BrokerDrivers component */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-card {
    width: min(95vw, 1200px);
    max-height: 90vh;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: auto;
    position: relative;
    background: white;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header-sticky {
    position: sticky;
    top: 0;
    background: white;
    padding-top: 1rem;
    padding-bottom: 1rem;
    z-index: 5;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.modal-driver-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-vehicle-img {
    width: 100%;
    max-width: 240px;
    max-height: 140px;
    object-fit: cover;
    border-radius: 0.75rem;
    margin-top: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.finance-log-scroll {
    max-height: 40vh;
    overflow: auto;
    border-radius: 0.5rem;
}

.finance-log-container {
    max-height: 35vh;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    background: white;
}

/* Larger tables for main pages (company, drivers, trailers) */
.large-table-data-container {
    max-height: 63vh;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    background: white;
}

.large-table-data-container table {
    width: 100%;
    table-layout: fixed;
    margin-bottom: 0;
}

.finance-log-container table {
    width: 100%;
    table-layout: fixed;
    margin-bottom: 0;
}

.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table-header-sticky thead {
    position: sticky;
    top: 0;
    background-color: #f9fafb;
    z-index: 10;
}

.table-header-sticky th {
    position: sticky;
    top: 0;
    background-color: #f9fafb;
    z-index: 10;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: #f9fafb;
}

.table td {
    border-bottom: 1px solid #f3f4f6;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background-color: #f3f4f6 !important;
}

/* Small log modal used inside the driver details modal */
.log-modal {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    z-index: 2100;
    width: min(90%, 520px);
    max-width: calc(100% - 2rem);
    max-height: calc(80vh);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: auto;
    box-sizing: border-box;
    animation: modalPop 0.3s ease;
}

@keyframes modalPop {
    from {
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.log-modal.income {
    border-left: 4px solid #10b981;
}

.log-modal.expense {
    border-left: 4px solid #ef4444;
}

.log-modal .form-group {
    margin-bottom: 1rem;
}

/* Make tables inside small log modals responsive and scrollable */
.log-modal table {
    width: 100%;
    table-layout: auto;
    margin-bottom: 0;
}

.log-modal .table-responsive {
    overflow-x: auto;
    border-radius: 0.5rem;
}

.log-modal input, .log-modal select {
    width: 100%;
}

.log-modal.trip-modal-wide {
    position: fixed; /* place above the driver modal and center on viewport */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(96%, 960px);
    max-width: 960px;
    max-height: 90vh;
    overflow: auto;
    z-index: 2300; /* above other modal layers */
}

.log-modal .actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Dim the driver modal when a nested log modal is open */
.modal-card.dimmed {
    filter: brightness(0.6);
}

/* Modern utility classes */
.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.2s ease;
}

.card[style*="cursor: pointer"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.badge {
    font-weight: 500;
    border-radius: 0.375rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Smooth scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Enhanced button groups */
.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
}

.btn-group .btn:last-child {
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    animation: spin 1s linear infinite;
}

/* Better focus states */
*:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Disabled states */
.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Alert styles */
.alert {
    border-radius: 0.5rem;
    border-left-width: 4px;
    padding: 1rem 1.25rem;
}

.alert-success {
    background-color: #d1fae5;
    border-left-color: #10b981;
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    border-left-color: #ef4444;
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    border-left-color: #f59e0b;
    color: #92400e;
}

.alert-info {
    background-color: #dbeafe;
    border-left-color: #3b82f6;
    color: #1e40af;
}

/* Selected Vehicle Owner Styling */
.table-primary {
    background-color: #dbeafe !important;
    border-left: 4px solid #2563eb;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

.table-primary:hover {
    background-color: #bfdbfe !important;
}

/* Vehicle list under selected owner */
.table-primary + tr > td > .vehicle-owner-table {
    margin-bottom: 0;
    background-color: transparent;
}

.table-primary + tr > td {
    background-color: #f0f9ff;
    padding: 0 !important;
}

.table-primary + tr > td > .vehicle-owner-table tbody tr {
    background-color: #f0f7ff;
    transition: background-color 0.2s ease;
}

.table-primary + tr > td > .vehicle-owner-table tbody tr td {
    background-color: #f0f7ff;
}

.table-primary + tr > td > .vehicle-owner-table tbody tr:hover {
    background-color: #e7f1ff;
    transform: translateX(2px);
}

.table-primary + tr > td > .vehicle-owner-table tbody tr:hover td {
    background-color: #e7f1ff !important;
}

.attachment-modal-overlay {
    animation: none !important;
    backdrop-filter: none !important;
}
.attachment-modal-card {
    animation: none !important;
    transition: none !important;
}

/* ABSOLUTELY DISABLE ANIMATION FOR MANAGE ATTACHMENTS MODAL */
.attachment-modal-overlay,
.attachment-modal-card,
.attachment-modal-overlay:not(.never),
.attachment-modal-card:not(.never) {
    animation: none !important;
    -webkit-animation: none !important;
    animation-name: none !important;
    -webkit-animation-name: none !important;
    animation-duration: 0s !important;
    -webkit-animation-duration: 0s !important;
    transition: none !important;
    backdrop-filter: none !important;
}

/* Home page animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes growUp {
    from {
        transform: scaleY(0);
        transform-origin: bottom;
    }
    to {
        transform: scaleY(1);
        transform-origin: bottom;
    }
}

@keyframes growDown {
    from {
        transform: scaleY(0);
        transform-origin: top;
    }
    to {
        transform: scaleY(1);
        transform-origin: top;
    }
}
