/* =============================================
   INMO MANAGER — Estilos Globales
   ============================================= */

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #f1f5f9;
    overflow-x: hidden;           /* safety: nada puede causar scroll horizontal a nivel página */
}

:root {
    --navy:       #1e293b;
    --navy-hover: #334155;
    --blue:       #2563eb;
    --blue-dark:  #1d4ed8;
    --blue-light: rgba(37, 99, 235, 0.1);
    --bg-light:   #f8fafc;
    --border:     #e2e8f0;
    --text-muted: #64748b;
    --text-dark:  #334155;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.08);
}

/* ── Utilidades ── */
.text-navy   { color: var(--navy) !important; }
.bg-navy     { background-color: var(--navy) !important; }

/* ── Botones ── */
.btn-navy {
    background-color: var(--navy);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}
.btn-navy:hover {
    background-color: var(--navy-hover);
    color: white;
    box-shadow: 0 4px 12px rgba(30,41,59,0.25);
    transform: translateY(-1px);
}
.btn-navy:disabled { opacity: 0.65; transform: none; }

.btn-outline-navy {
    border: 1.5px solid var(--navy);
    color: var(--navy);
    background: transparent;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}
.btn-outline-navy:hover { background-color: var(--navy); color: white; }

/* ── Formularios ── */
.form-control,
.form-select {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--navy);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-light);
    outline: none;
}
.form-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 5px;
}

/* ── Badges ── */
.badge-custom {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.3px;
}
.badge-active    { background: #dcfce7; color: #15803d; }
.badge-inactive  { background: #f1f5f9; color: #64748b; }
.badge-available { background: #dcfce7; color: #15803d; }
.badge-rented    { background: #dbeafe; color: #1d4ed8; }
.badge-sold      { background: #fef9c3; color: #92400e; }

/* =============================================
   MANAGER LAYOUT
   ============================================= */

.manager-page {
    padding: 28px 32px;
}

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-header-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--navy), var(--navy-hover));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(30,41,59,0.2);
    flex-shrink: 0;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--navy);
    margin: 0;
    letter-spacing: -0.3px;
}

.page-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Search box ── */
.search-box {
    position: relative;
    width: 260px;
}
.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
}
.search-box input {
    padding-left: 36px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: white;
    font-size: 0.88rem;
    height: 38px;
    width: 100%;
    color: var(--navy);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-light);
    outline: none;
}

/* ── Body split ── */
.manager-body {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* ── Card base ── */
.manager-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

/* ── Lista ── */
.manager-list {
    flex: 1;
    min-width: 0;
}

.manager-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--navy);
    color: white;
}

.manager-list-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0;
    opacity: 0.9;
}

.manager-list-count {
    font-size: 0.75rem;
    background: rgba(255,255,255,0.15);
    padding: 2px 10px;
    border-radius: 50px;
}

/* ── Tabla ── */
.custom-table {
    width: 100%;
    background: white;
    margin-bottom: 0;
    border-collapse: collapse;
}

.custom-table thead th {
    padding: 11px 16px;
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.custom-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-dark);
    vertical-align: middle;
    font-size: 0.88rem;
}

.custom-table tbody tr:last-child td { border-bottom: none; }

.custom-table tbody tr {
    transition: background 0.15s;
    cursor: pointer;
}

.custom-table tbody tr:hover { background: #f8fafc; }

.table-row-active {
    background: #eff6ff !important;
    border-left: 3px solid var(--blue);
}

.table-row-active td { color: #1e40af; }

/* ── Estado vacío ── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 20px;
    color: #cbd5e1;
}
.empty-icon { font-size: 2.8rem; margin-bottom: 12px; }
.empty-text { font-size: 0.88rem; color: var(--text-muted); margin: 0; }

/* ── Loading ── */
.loading-state {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 64px;
}

/* ── Footer de lista ── */
.manager-list-footer {
    padding: 10px 18px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ── Panel formulario ── */
.manager-form {
    width: 340px;
    flex-shrink: 0;
}

.manager-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--navy);
    color: white;
}

.manager-form-title {
    font-size: 0.88rem;
    font-weight: 700;
    margin: 0;
}

.manager-form-body {
    padding: 20px;
}

.form-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.form-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

/* ── Modal confirmación ── */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.15s ease;
}

.modal-card {
    background: white;
    border-radius: 16px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 24px 64px rgba(0,0,0,0.25);
    animation: slideDown 0.2s ease;
    overflow: hidden;
}

.modal-card-header {
    padding: 16px 20px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--navy);
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.modal-card-body {
    padding: 20px;
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.6;
}

.modal-card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #f8fafc;
}

/* ── Animaciones ── */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.manager-form { animation: slideInRight 0.2s ease; }

/* ── Responsive ─────────────────────────────────────── */

/* Tablet y mobile (debajo del breakpoint del sidebar) */
@media (max-width: 991px) {
    .manager-page { padding: 16px; }
    .manager-body { flex-direction: column; }
    .manager-form { width: 100%; }

    /* Header de página: el row se envuelve cuando no entra todo en una línea */
    .page-header {
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 16px;
    }
    .page-header-actions {
        flex-wrap: wrap;
        width: 100%;             /* el row de acciones ocupa toda la fila debajo del título */
        gap: 8px;
    }
    .search-box {
        flex: 1 1 200px;
        width: auto;
        min-width: 0;
    }

    /* Tablas: en lugar de scroll horizontal, las columnas marcadas con .col-hide-X
       se esconden a medida que el ancho disminuye (ver utilidades abajo).
       Mantenemos overflow-x:auto como fallback si una tabla no usa las clases. */
    .custom-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .custom-table thead,
    .custom-table tbody { display: table; width: 100%; }
}

/* ── Utilidades de visibilidad por breakpoint ─────────────────────────
   Marca <th> y <td> con la clase apropiada para ocultarla cuando el
   viewport se achica. Pensado especialmente para tablas con muchas
   columnas — en lugar de scroll horizontal, simplemente desaparecen
   las menos importantes.

   Convención:
     col-hide-lg    →  oculta debajo de 1200px
     col-hide-md    →  oculta debajo de 992px
     col-hide-sm    →  oculta debajo de 768px
     col-hide-xs    →  oculta debajo de 480px
*/
@media (max-width: 1199px) { .col-hide-lg { display: none !important; } }
@media (max-width: 991px)  { .col-hide-md { display: none !important; } }
@media (max-width: 767px)  { .col-hide-sm { display: none !important; } }
@media (max-width: 479px)  { .col-hide-xs { display: none !important; } }

/* Phone — ajustes finos para pantallas chicas */
@media (max-width: 480px) {
    .manager-page { padding: 12px; }
    .page-title    { font-size: 1.2rem; }
    .page-subtitle { font-size: .75rem; }
    .page-header-icon {
        width: 40px; height: 40px;
        font-size: 1.1rem;
        border-radius: 10px;
    }
    .custom-table thead th,
    .custom-table tbody td {
        padding: 10px 12px;
        font-size: .85rem;
    }
    .manager-list-header { padding: 10px 14px; }
    .manager-list-title  { font-size: .72rem; }
}

/* Phones ultra chicos (320-360) — comprimimos todo aún más */
@media (max-width: 360px) {
    main { padding: 64px 8px 12px !important; }
    .manager-page { padding: 8px; }
    .page-title { font-size: 1.05rem; }
    .page-header-icon { width: 36px; height: 36px; font-size: 1rem; }
}

/* =============================================
   VALIDACIÓN BLAZOR
   ============================================= */
.valid.modified:not([type=checkbox]) { outline: 1px solid #22c55e; }
.invalid { outline: 1px solid #ef4444; }
.validation-message { color: #dc2626; font-size: 0.8rem; margin-top: 3px; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.blazor-error-boundary::after { content: "Ocurrió un error inesperado." }

#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;
}
