/* DISEGME — Estilos globales */
:root {
    --disegme-primary: #1a3a5c;
    --disegme-accent: #c9a227;
    --disegme-bg: #f0f4f8;
    --disegme-card-shadow: 0 2px 12px rgba(26, 58, 92, 0.08);
}

body {
    background-color: var(--disegme-bg);
    min-height: 100vh;
}

.navbar-disegme {
    background: linear-gradient(135deg, var(--disegme-primary) 0%, #0d2137 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* —— Navbar v2 —— */
.navbar-disegme-v2 {
    background: #0f2744;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    z-index: 1030;
    overflow: visible;
}

.navbar-disegme-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 64px;
    flex-wrap: wrap;
    overflow: visible;
}

#navbarMain,
#navbarMain.collapse,
.navbar-search-v2 {
    overflow: visible !important;
}

.navbar-brand-v2 {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: #fff;
    flex-shrink: 0;
}

.brand-logo-wrap {
    background: #fff;
    border-radius: 8px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.brand-logo {
    height: 52px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    display: block;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(145deg, var(--disegme-accent), #a8861f);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: .04em;
}

.brand-sub {
    font-size: .68rem;
    color: rgba(255, 255, 255, 0.62);
    letter-spacing: .02em;
}

.navbar-toggler-v2 {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 6px;
    padding: .45rem .5rem;
    margin-left: auto;
}

.navbar-toggler-v2 span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

#navbarMain {
    align-items: center;
    gap: 1.25rem;
    flex: 1;
    justify-content: flex-end;
}

@media (min-width: 992px) {
    #navbarMain {
        display: flex !important;
    }
}

.navbar-nav-v2 {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.nav-link-v2 {
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    padding: .45rem .85rem;
    border-radius: 6px;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.nav-link-v2:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link-v2.active {
    color: #fff;
    background: rgba(201, 162, 39, 0.22);
    box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.35);
}

.navbar-search-v2 {
    position: relative;
    width: 100%;
    max-width: 340px;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.45);
    pointer-events: none;
    display: flex;
}

.search-input-v2 {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    color: #fff;
    font-size: .875rem;
    padding: .5rem .85rem .5rem 2.35rem;
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.search-input-v2::placeholder {
    color: rgba(255, 255, 255, 0.42);
}

.search-input-v2:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(201, 162, 39, 0.55);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
    color: #fff;
}

.search-results-v2 {
    position: fixed;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 16px 48px rgba(15, 39, 68, 0.22);
    max-height: min(420px, 70vh);
    overflow: hidden;
    display: none;
    z-index: 2000;
    min-width: 320px;
}

.search-results-v2.is-open {
    display: flex;
    flex-direction: column;
}

.search-preview-header {
    padding: .55rem 1rem;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.search-preview-list {
    overflow-y: auto;
    max-height: min(360px, 60vh);
}

.search-state {
    padding: .85rem 1rem;
    color: #64748b;
    font-size: .875rem;
}

.search-state-error {
    color: #b42318;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .75rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
}

.search-avatar-wrap {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--disegme-primary);
    background: #e2e8f0;
}

.search-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.search-info {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}

.search-name {
    font-weight: 600;
    font-size: .92rem;
    color: #0f2744;
    line-height: 1.25;
}

.search-cedula {
    font-size: .8rem;
    color: #475569;
    font-variant-numeric: tabular-nums;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.is-active {
    background: #f1f5f9;
}

.search-result-item.is-active {
    box-shadow: inset 3px 0 0 var(--disegme-accent);
}

.site-footer {
    text-align: center;
    color: #64748b;
    padding: 1rem;
    font-size: .8rem;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

@media (max-width: 991.98px) {
    .navbar-toggler-v2 {
        display: flex;
    }

    #navbarMain {
        flex-direction: column;
        align-items: stretch !important;
        padding: .75rem 0 1rem;
        gap: .75rem;
    }

    .navbar-nav-v2 {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-link-v2 {
        padding: .6rem .75rem;
    }

    .navbar-search-v2 {
        max-width: none;
    }
}

.navbar-disegme .navbar-brand {
    font-weight: 700;
    letter-spacing: .5px;
}

.navbar-disegme .nav-link {
    color: rgba(255,255,255,.85) !important;
    font-weight: 500;
    padding: .5rem 1rem !important;
    border-radius: .375rem;
    transition: background .2s;
}

.navbar-disegme .nav-link:hover,
.navbar-disegme .nav-link.active {
    background: rgba(255,255,255,.12);
    color: #fff !important;
}

.navbar-disegme .nav-link.active {
    border-bottom: 2px solid var(--disegme-accent);
}

.form-section-card {
    background: #fff;
    border-radius: .75rem;
    box-shadow: var(--disegme-card-shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
    border: 1px solid rgba(26, 58, 92, 0.06);
}

.form-section-header {
    background: linear-gradient(90deg, var(--disegme-primary), #2a5080);
    color: #fff;
    padding: .85rem 1.25rem;
    font-weight: 600;
    font-size: .95rem;
}

.form-section-body {
    padding: 1.25rem;
}

.page-header h1 {
    color: var(--disegme-primary);
    font-weight: 700;
    font-size: 1.75rem;
}

.cedula-input-wrap .cedula-status {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
}

.cedula-valid { border-color: #198754 !important; }
.cedula-invalid { border-color: #dc3545 !important; }

.cedula-feedback { font-size: .8rem; margin-top: .25rem; }
.cedula-feedback.valid { color: #198754; }
.cedula-feedback.invalid { color: #dc3545; }

.rango-na-display {
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: .375rem;
    padding: .575rem .75rem;
    color: #6c757d;
    font-weight: 600;
    text-align: center;
}

.campo-militar-oculto { display: none !important; }

.btn-disegme {
    background: var(--disegme-primary);
    border-color: var(--disegme-primary);
    color: #fff;
}

.btn-disegme:hover {
    background: #0d2137;
    border-color: #0d2137;
    color: #fff;
}

.home-card {
    transition: transform .2s, box-shadow .2s;
    border: none;
    box-shadow: var(--disegme-card-shadow);
}

.home-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(26, 58, 92, 0.15);
}

.home-card .card-icon {
    font-size: 2.5rem;
    color: var(--disegme-primary);
}

.audit-filter-card {
    background: #fff;
    border-radius: .75rem;
    box-shadow: var(--disegme-card-shadow);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.table-audit thead th {
    background: var(--disegme-primary);
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
    white-space: nowrap;
}

.form-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    min-width: 280px;
}

.foto-perfil-wrap {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--disegme-primary);
    background: #dee2e6;
}

.field-error-feedback {
    font-size: .8rem;
    color: #dc3545;
    margin-top: .25rem;
    min-height: 1rem;
}

.field-error-feedback:not(:empty)::before {
    content: "⚠ ";
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 .15rem rgba(220, 53, 69, .15);
}

#validation-summary {
    border-left: 4px solid #dc3545;
}

.foto-perfil-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Dashboard */
.stat-card {
    background: #fff;
    border-radius: .75rem;
    padding: 1.25rem;
    box-shadow: var(--disegme-card-shadow);
    border-left: 4px solid var(--disegme-primary);
    height: 100%;
}

.stat-card.stat-success { border-left-color: #198754; }
.stat-card.stat-info { border-left-color: #0dcaf0; }
.stat-card.stat-accent { border-left-color: var(--disegme-accent); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--disegme-primary);
    line-height: 1.1;
}

.stat-label {
    color: #6c757d;
    font-size: .85rem;
    margin-top: .25rem;
}

.bg-disegme {
    background-color: var(--disegme-primary) !important;
}

/* Perfil */
.profile-foto-wrap {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--disegme-primary);
    background: #dee2e6;
}

.profile-foto {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-meta .list-group-item {
    font-size: .9rem;
}

.timeline-item {
    padding: .75rem 0 .75rem 1rem;
    border-left: 3px solid var(--disegme-accent);
    margin-bottom: .5rem;
}

/* Badges estado */
.badge-estado {
    font-weight: 600;
    font-size: .75rem;
}

.badge-activo { background: #198754; color: #fff; }
.badge-licencia { background: #0dcaf0; color: #000; }
.badge-suspendido { background: #fd7e14; color: #fff; }
.badge-inactivo { background: #6c757d; color: #fff; }
.badge-desvinculado { background: #dc3545; color: #fff; }

/* Auditoría filas clicables */
.audit-row-clickable {
    cursor: pointer;
}

.audit-row-clickable:hover {
    background-color: rgba(26, 58, 92, 0.06) !important;
}

/* Usuario en navbar */
.navbar-user-v2 {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-shrink: 0;
    margin-left: .5rem;
}

.navbar-user-info {
    text-align: right;
    line-height: 1.2;
    max-width: 180px;
}

.navbar-user-name {
    display: block;
    color: #fff;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar-user-role {
    display: block;
    color: rgba(201, 162, 39, 0.95);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.btn-navbar-logout {
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    font-size: .75rem;
    padding: .25rem .55rem;
}

.btn-navbar-logout:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
}

@media (max-width: 991.98px) {
    .navbar-user-v2 {
        margin-left: 0;
        justify-content: space-between;
        width: 100%;
        padding-top: .5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .navbar-user-info {
        text-align: left;
        max-width: none;
    }
}

/* Pantallas de autenticación */
.auth-body {
    background: linear-gradient(160deg, #0f2744 0%, #1a3a5c 50%, #0d2137 100%);
    min-height: 100vh;
}

.auth-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-logo {
    height: 56px;
    background: #fff;
    border-radius: 8px;
    padding: 4px 10px;
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.letter-spacing-code {
    letter-spacing: .35em;
}

/* Consultas */
.consultas-tabs .nav-link {
    color: var(--disegme-primary);
    font-weight: 500;
}

.consultas-tabs .nav-link.active {
    font-weight: 600;
}

.consulta-talla-row {
    cursor: pointer;
}

.consulta-talla-row:hover {
    background-color: rgba(26, 58, 92, 0.08);
}

.consulta-bar-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 120px;
}

.consulta-bar {
    height: 8px;
    background: var(--disegme-primary);
    border-radius: 4px;
    min-width: 4px;
    transition: width .3s ease;
}

.consulta-bar-pct {
    font-size: .75rem;
    color: #6c757d;
    white-space: nowrap;
}

.stat-card.stat-warning { border-left-color: #fd7e14; }

.stat-card-clickable {
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}

.stat-card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 58, 92, 0.12);
}

.stat-card-clickable:focus-visible {
    outline: 2px solid var(--disegme-primary);
    outline-offset: 2px;
}

.consultas-fechas-filtro {
    background: #f8fafc;
    border-radius: .5rem;
    padding: .75rem 1rem;
    border: 1px solid rgba(26, 58, 92, 0.1);
}

.consultas-fecha-campo {
    min-width: 11rem;
}

.consultas-fecha-campo .form-control.is-invalid {
    border-color: #dc3545;
}
