/* =========================================================
   0) NOTA
   - Archivo organizado: variables -> base -> layout -> blazor ->
     componentes -> sidebar -> utilidades -> fixes finales.
   ========================================================= */

/* =========================================================
   1) VARIABLES DE COLOR Y CONSTANTES
   ========================================================= */
:root {
    --orange: #ff8c00;
    --orange-dark: #ff6600;
    --orange-hover: #ffa733;
    --orange-contrast: #ffffff;
    --bg-body: #f5f5f5;
    --bg-dark: #181818;
    --bg-panel: #1b1b1b;
    --bg-panel-alt: #111111;
    --table-header: #111111;
    --table-row-hover: #2c2c2c;
    --success: #26b050;
    --danger: #ff4d4d;
}

/* =========================================================
   2) BASE / RESET / TIPOGRAFÍA
   ========================================================= */
html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
}

h1:focus {
    outline: none;
}

a,
.btn-link {
    color: #0071c1;
}

code {
    /* Evita el violeta remanente */
    color: var(--orange);
}

.content {
    padding-top: 1.1rem;
}

/* Validaciones */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--success);
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

/* Focus común de controles */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
   
}

/* =========================================================
   3) LAYOUT PRINCIPAL (page / main / top-row / article)
   ========================================================= */
/* Contenedor general: sidebar + main */
.page {
    position: relative;
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    gap: 0;
    background: var(--bg-body);
}

/* Main: ocupa el resto y cubre fondo para evitar franjas */
.page > main {
    flex: 1 1 auto;
    background: #ffffff;
    min-width: 0;
}

/* Top row (encabezado superior dentro del main) */
.top-row {
    background-color: #f7f7f7;
    border-bottom: 1px solid #d6d5d5;
    justify-content: flex-end;
    height: 3.5rem;
    display: flex;
    align-items: center;
}

/* Ajustes de padding global para pantallas grandes */
@media (min-width: 641px) {
    .top-row, article {
        padding-left: 2rem !important;
        padding-right: 1.5rem !important;
    }
}

/* =========================================================
   4) BLAZOR: ERROR UI Y LOADING
   ========================================================= */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px 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: 1000;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* Loader circular */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}
.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: #1b6ec2;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}
.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}
.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* =========================================================
   5) COMPONENTES: BOTONES
   ========================================================= */
/* Botón principal naranja (Nuevo, Guardar, etc.) */
.btn-naranja {
    background-color: var(--orange);
    border-color: var(--orange);
    color: #111;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}
.btn-naranja:hover {
    background-color: var(--orange-hover);
    border-color: var(--orange-hover);
    color: #111;
}

/* Botón secundario oscuro (Volver, Cancelar) */
.btn-secondary {
    background-color: #111;
    color: #fff;
    border: 1px solid var(--orange);
    font-weight: 500;
    border-radius: 4px;
}
.btn-secondary:hover {
    background-color: var(--orange);
    border-color: var(--orange);
    color: #111;
}

/* Outlines y variantes */
.btn-outline-primary {
    border: 1px solid var(--orange);
    color: var(--orange);
    background-color: transparent;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}
.btn-outline-primary:hover {
    background-color: var(--orange);
    color: #fff;
}

.btn-outline-warning {
    border: 1px solid var(--orange);
    color: var(--orange);
    background-color: transparent;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}
.btn-outline-warning:hover {
    background-color: var(--orange);
    color: #111;
}

.btn-outline-danger {
    border: 1px solid var(--danger);
    color: var(--danger);
    background-color: transparent;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}
.btn-outline-danger:hover {
    background-color: var(--danger);
    color: #fff;
}

.btn-outline-dark {
    border: 1px solid var(--orange);
    background-color: #111;
    color: #ffffff;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}
.btn-outline-dark:hover {
    background-color: var(--orange);
    border-color: var(--orange);
    color: #111;
}

/* =========================================================
   6) COMPONENTES: FORMULARIOS / FILTROS
   ========================================================= */
.filtros-container {
    background-color: #111;
    color: #ffffff;
    border: 1px solid var(--orange);
    border-radius: 6px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s ease-in-out, transform 0.3s ease-in-out;
}
.filtros-container h5,
.filtros-container label {
    color: var(--orange);
}
.filtros-container .form-control,
.filtros-container .form-select {
    background-color: #1a1a1a;
    color: #ffffff;
    border: 1px solid var(--orange);
    border-radius: 4px;
}
.filtros-container .form-control::placeholder {
    color: #aaaaaa;
}
.filtros-container:hover {
    box-shadow: 0 0 10px rgba(255, 140, 0, 0.5);
    transform: translateY(-1px);
}

/* =========================================================
   7) COMPONENTES: TABLAS
   ========================================================= */
.table {
    width: 100%;
    background-color: #222;
    color: #ffffff;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 6px;
    overflow: hidden;
}
.table thead {
    background-color: var(--table-header);
    color: var(--orange);
    font-weight: bold;
}
.table thead th {
    border-bottom: 1px solid #333;
}
.table tbody tr:hover {
    background-color: var(--table-row-hover);
    transition: 0.2s;
}

/* =========================================================
   8) COMPONENTES: MODALES
   ========================================================= */
.modal-content {
    background-color: var(--bg-panel);
    border: 1px solid var(--orange);
    color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(255, 140, 0, 0.4);
}
.modal-header {
    border-bottom: 1px solid #333;
    background-color: #121212;
}
.modal-title {
    color: var(--orange);
}
.modal-footer {
    border-top: 1px solid #333;
}

/* =========================================================
   9) HOME / CARDS / DASHBOARD
   ========================================================= */
.home-container {
    padding: 2rem;
    background-color: var(--bg-body);
    min-height: 100vh;
}
.home-header {
    text-align: center;
    margin-bottom: 3rem;
}
.home-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--orange-dark);
}
.home-header .subtitle {
    font-size: 1.2rem;
    color: var(--orange-dark);
}
.card-access {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-access:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

/* ===== Utilidad: ocultar visualmente (presente en DOM para devs/inspector) ===== */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* =========================================================
   10) SIDEBAR / NAV LATERAL
   ========================================================= */
/* Contenedor lateral */
.sidebar {
    width: 250px; /* coherente con MainLayout.razor.css */
    min-height: 100vh;
    background: linear-gradient(180deg, #000000 0%, #111111 50%, var(--orange) 100%);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    box-shadow: none;
    border-right: 0;
}

/* Encabezado del sidebar */
.sidebar-header {
    background: linear-gradient(90deg, var(--orange) 0%, #ff5500 100%);
    border-bottom: 1px solid #ffa31a;
}
.sidebar-header img {
    filter: drop-shadow(0 0 3px var(--orange));
}

/* Scroll del sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: var(--orange);
    border-radius: 10px;
}
.sidebar::-webkit-scrollbar-track {
    background: #1a1a1a;
}

/* Links del menú lateral */
.nav-link-custom {
    color: #f5f5f5;
    font-weight: 500;
    border-left: 4px solid transparent;
    border-radius: 6px;
    padding: 10px 15px;
    transition: all 0.2s ease-in-out;
}
.nav-link-custom:hover {
    background-color: #1c1c1c;
    border-left: 4px solid var(--orange);
    color: var(--orange);
    text-shadow: 0 0 5px rgba(255, 140, 0, 0.6);
}
.nav-link-custom.active {
    background-color: #1a1a1a;
    border-left: 4px solid var(--orange);
    color: var(--orange);
}

/* Nav base */
.nav-link {
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
}
.nav-link:hover,
.nav-link.active {
    background-color: var(--orange);
    color: #000 !important;
    font-weight: 600;
}

/* =========================================================
   11) ICONOS / DETALLES / UTILIDADES
   ========================================================= */
.bi {
    font-size: 1.1rem;
    vertical-align: middle;
}

.text-naranja {
    color: var(--orange) !important;
}

.text-white {
    color: #ffffff !important;
}

.border-warning {
    border-color: var(--orange) !important;
}

.spinner-border.text-warning {
    color: var(--orange) !important;
}

.resultados-info {
    color: #bbbbbb;
    font-style: italic;
    font-size: 0.9rem;
}

/* =========================================================
   12) FIXES FINALES: eliminar franjas y residuos violetas
   ========================================================= */
/* Asegurar sin gaps entre sidebar y main */
.page > .sidebar,
.page > main {
    margin: 0;
    padding: 0;
}

/* Quitar sombras/bordes que puedan generar líneas visibles */
nav.sidebar,
.page .sidebar,
.sidebar {
    box-shadow: none !important;
    outline: none !important;
    border-right: 0 !important;
}

/* Elimina padding lateral que pueda subir separación visual */
.page main,
.page main article,
.page main .content,
.top-row,
article {
    padding-left: 0 !important;
}

/* Forzar transparencia si hay estilos inline con morado remanente */
*[style*="#1c0030"],
*[style*="#1c0030"] * {
    border-color: transparent !important;
    background-image: none !important;
}

/* =========================================================
   13) SIDEBAR COLAPSABLE 
   ========================================================= */

/* Sobrescribir ancho base (Importante: define el ancho normal aquí si no lo tienes) */
.sidebar {
    width: 250px;
    min-height: 100vh; 
    background: linear-gradient(180deg, #000000 0%, #111111 50%, var(--orange) 100%);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease-in-out;
    overflow-x: hidden;
    white-space: nowrap;
    flex-shrink: 0;
}

    /* Estilo cuando está contraído */
    .sidebar.collapsed {
        width: 70px !important;
    }

        /* Ocultar textos del menú */
        .sidebar.collapsed .nav-link-text,
        .sidebar.collapsed .sidebar-header h4 {
            display: none;
        }

        /* Centrar iconos y botón */
        .sidebar.collapsed .nav-item .nav-link {
            justify-content: center !important;
            padding: 10px 0;
        }

        .sidebar.collapsed .bi {
            margin-right: 0 !important;
            font-size: 1.5rem !important;
        }

        .sidebar.collapsed .sidebar-header {
            justify-content: center !important;
            padding: 15px 0;
        }

    /* Botón de toggle */
    .sidebar-toggler {
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        line-height: 1;
        transition: transform 0.3s;
    }

    /* Rotar botón al contraer */
    .sidebar.collapsed .sidebar-toggler {
        transform: rotate(180deg);
        margin: 0 auto;
    }


/* =========================================================
   14) HISTORIAL / TIMELINE (estilos agregados para ClienteHistorial)
   ========================================================= */

/* Contenedor general del timeline */
.timeline {
    padding: 0.6rem 0;
    max-width: 1100px;
    margin: 0 auto 1.5rem auto;
}

/* Cada evento de la línea de tiempo */
.timeline-item {
    display: block;
    background: #ffffff;                 /* tarjeta clara dentro del canvas blanco */
    border-left: 4px solid var(--orange);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 0.9rem;
}

/* Ajuste de la card-body para timeline (usa estructura .card .card-body) */
.timeline-item .card-body {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    color: #222;
}

/* Icono redondo de la izquierda */
.timeline-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--orange-hover), var(--orange-dark));
    color: #fff;
    font-size: 18px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* Metadatos pequeños (fecha) */
.timeline-item .small.text-muted {
    color: #6c757d;
    font-size: 0.85rem;
}

/* Título y descripción */
.timeline-item strong {
    color: #111;
    font-size: 1rem;
}
.timeline-item p {
    color: #444;
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    line-height: 1.25;
}

/* Badges dentro del timeline (tipo / estado) */
.timeline-item .badge {
    font-size: 0.72rem;
    padding: 0.28rem 0.45rem;
}

/* Botón "Ver" pequeño */
.timeline-item .btn-outline-primary {
    border-color: var(--orange);
    color: var(--orange);
    background-color: transparent;
}
.timeline-item .btn-outline-primary:hover {
    background-color: var(--orange);
    color: #fff;
}

/* Mensaje vacío */
.timeline-empty {
    text-align: center;
    color: #6c757d;
    padding: 2rem 0;
}

/* Responsive tweaks */
@media (max-width: 768px) {
    .timeline-item .card-body { flex-direction: row; gap: 0.7rem; padding: 0.6rem; }
    .timeline-icon { width:40px; height:40px; font-size:16px; }
}

/* =========================================================
   FIN DEL ARCHIVO (mantener este comentario al final)
   ========================================================= */
