/**
 * Tema Bootstrap 5 — Autoescuela Valencia
 */

:root,
[data-bs-theme='light'] {
    --bs-body-font-family: 'Work Sans', system-ui, sans-serif;
    --bs-body-bg: var(--color-background);
    --bs-body-color: var(--color-on-surface);
    --bs-primary: #ef8719;
    --bs-primary-rgb: 239, 135, 25;
    --bs-primary-text-emphasis: #582d00;
    --bs-primary-bg-subtle: #ffdcc3;
    --bs-primary-border-subtle: #ffb77d;
    --bs-border-color: rgba(136, 115, 99, 0.12);
    --bs-border-radius: var(--radius-lg);
    --bs-border-radius-sm: var(--radius-default);
    --bs-border-radius-lg: var(--radius-xl);
    --bs-border-radius-xl: var(--radius-2xl);
    --bs-link-color: var(--color-primary-container);
    --bs-link-hover-color: var(--ae-color-primary-hover);
}

/* Selección de texto con colores de marca */
::selection {
    background: var(--ae-color-primary);
    color: #fff;
}

::-moz-selection {
    background: var(--ae-color-primary);
    color: #fff;
}

/* Texto largo sin espacios (p. ej. "aaaaaaaa..."): evita desbordes de layout */
.ae-admin-shell :where(
    p,
    li,
    td,
    th,
    dd,
    dt,
    .card-text,
    .alert,
    .small,
    .text-muted,
    .badge
),
.portal-body :where(
    p,
    li,
    td,
    th,
    dd,
    dt,
    .card-text,
    .alert,
    .small,
    .text-muted,
    .badge
) {
    overflow-wrap: break-word;
    word-break: normal;
}

/* Campos tipo token (DNI, códigos): evitar cortes agresivos */
.ae-admin-shell :where(code, .ae-preserve-token),
.portal-body :where(code, .ae-preserve-token),
.ae-admin-shell :where(td, dd, span)[data-label*='DNI'],
.portal-body :where(td, dd, span)[data-label*='DNI'],
.ae-admin-shell :where(td, dd, span)[data-label*='Código'],
.portal-body :where(td, dd, span)[data-label*='Código'] {
    overflow-wrap: normal;
    word-break: normal;
    white-space: nowrap;
}

.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:focus-visible,
.btn-primary:active,
.btn-primary.active,
.btn-primary.disabled,
.btn-primary:disabled,
.show > .btn-primary.dropdown-toggle {
    --bs-btn-color: #fff;
    --bs-btn-bg: #ef8719;
    --bs-btn-border-color: #ef8719;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #d97610;
    --bs-btn-hover-border-color: #d97610;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #d97610;
    --bs-btn-active-border-color: #d97610;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #ef8719;
    --bs-btn-disabled-border-color: #ef8719;
    --bs-btn-focus-shadow-rgb: 239, 135, 25;
    --bs-btn-border-radius: var(--radius-lg);
    --bs-btn-font-weight: 600;
    --bs-btn-padding-y: 0.55rem;
    --bs-btn-padding-x: 1.25rem;
    color: #fff;
    background-color: #ef8719;
    border-color: #ef8719;
}

.btn-primary:hover,
.btn-primary:focus-visible {
    color: #fff;
    background-color: #d97610;
    border-color: #d97610;
}

.btn-primary:active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle {
    color: #fff;
    background-color: #d97610;
    border-color: #d97610;
}

.btn-check:checked + .btn-primary,
.btn-check:active + .btn-primary {
    color: #fff;
    background-color: #d97610;
    border-color: #d97610;
}

.btn-outline-primary {
    --bs-btn-color: var(--ae-color-primary);
    --bs-btn-border-color: rgba(239, 135, 25, 0.45);
    --bs-btn-bg: transparent;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--ae-color-primary);
    --bs-btn-hover-border-color: var(--ae-color-primary);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--ae-color-primary-hover);
    --bs-btn-active-border-color: var(--ae-color-primary-hover);
    --bs-btn-focus-shadow-rgb: 239, 135, 25;
    --bs-btn-border-radius: var(--radius-lg);
    --bs-btn-font-weight: 600;
}

.btn-outline-secondary,
.btn-outline-danger {
    --bs-btn-border-radius: var(--radius-lg);
    --bs-btn-font-weight: 600;
}

.btn-dark {
    --bs-btn-border-radius: var(--radius-lg);
    --bs-btn-border-color: transparent;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
}

.material-symbols-outlined.filled {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Formularios — panel admin y auth */
.ae-admin-shell .form-label,
.portal-body .form-label {
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    color: var(--color-on-surface-variant);
    margin-bottom: 0.35rem;
}

.ae-admin-shell .form-control,
.portal-body .form-control:not(.portal-input-group .form-control) {
    min-height: 2.75rem;
    padding: 0.6rem 1rem;
    font-size: 0.9375rem;
    border-radius: var(--radius-lg);
    border: none;
    background-color: var(--color-surface-container-lowest);
    box-shadow: var(--shadow-inset-field);
    transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.portal-body .form-select {
    min-height: 2.75rem;
    padding: 0.6rem 2.75rem 0.6rem 1rem;
    font-size: 0.9375rem;
    border-radius: var(--radius-lg);
    border: none;
    background-color: var(--color-surface-container-lowest);
    box-shadow: var(--shadow-inset-field);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23554335' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1.125rem;
}

.ae-admin-shell .form-control:hover,
.portal-body .form-control:not(.portal-input-group .form-control):hover {
    background-color: #fff;
    box-shadow: inset 0 0 0 1px rgba(239, 135, 25, 0.25);
}

.ae-admin-shell .form-control:focus,
.portal-body .form-control:not(.portal-input-group .form-control):focus,
.portal-body .form-select:focus {
    background-color: #fff;
    border-color: transparent;
    box-shadow: var(--shadow-inset-field), 0 0 0 3px var(--ae-color-focus);
}

.ae-admin-shell .form-control::placeholder {
    color: rgba(85, 67, 53, 0.45);
}

.ae-admin-shell .form-control:disabled,
.portal-body .form-control:disabled,
.ae-admin-shell .form-control[readonly],
.portal-body .form-control[readonly] {
    background-color: var(--color-surface-container-low) !important;
    color: var(--color-on-surface-variant) !important;
    opacity: 0.72 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

.ae-admin-shell .form-check-input {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 0.35rem;
    border: none;
    box-shadow: var(--shadow-inset-field);
}

.ae-admin-shell .form-check-input:checked {
    background-color: var(--ae-color-primary);
    box-shadow: none;
}

.ae-admin-shell .form-check-input:focus {
    box-shadow: 0 0 0 3px var(--ae-color-focus);
}

.ae-admin-shell textarea.form-control {
    min-height: 6rem;
    resize: vertical;
}

.ae-admin-shell .input-group .form-control {
    border-radius: 0;
}

.ae-admin-shell .input-group > .form-control:first-child,
.ae-admin-shell .input-group > .input-group-text:first-child {
    border-top-left-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
}

.ae-admin-shell .input-group > .form-control:last-child,
.ae-admin-shell .input-group > .input-group-text:last-child {
    border-top-right-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

.ae-admin-shell .input-group-text {
    border: none;
    background-color: var(--color-surface-container-low);
    box-shadow: var(--shadow-inset-field);
}

/* —— Scrollbars naranja (Firefox + WebKit): página general y contenedores —— */
html,
body {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
    width: var(--scrollbar-size);
    height: var(--scrollbar-size);
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: var(--radius-full);
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: var(--radius-full);
    border: 2px solid var(--scrollbar-track);
    min-height: 2.5rem;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
*::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb-hover);
}

html::-webkit-scrollbar-thumb:active,
body::-webkit-scrollbar-thumb:active,
*::-webkit-scrollbar-thumb:active {
    background-color: var(--scrollbar-thumb-active);
}

html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner,
*::-webkit-scrollbar-corner {
    background: var(--scrollbar-track);
}

.ae-admin-shell,
.ae-admin-shell .table-responsive,
.ae-admin-shell main,
.portal-body {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
