/* ============================================================
   Mis Servicios CORNARE — Design System
   ============================================================ */

:root {
    --ms-primary:       #1a4a7a;
    --ms-primary-dark:  #0f3560;
    --ms-primary-light: #d0dff0;
    --ms-footer-bg:     #0f2a47;
    --ms-shadow:        0 3px 18px rgba(0,0,0,0.11);
}

/* ============================================================
   Login (Inicio.aspx)
   ============================================================ */
.login-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 16px 0;
}

.login-panel {
    background: rgba(255,255,255,0.97);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.28);
    overflow: hidden;
}

.login-card-header {
    background: #ffffff;
    border-bottom: 3px solid var(--ms-primary-light);
    padding: 28px 24px 20px;
    text-align: center;
}

.login-logo {
    height: 120px;
    width: auto;
}

.login-app-subtitle {
    font-size: 1.05rem;
    font-weight: 500;
    color: #4a5568;
    line-height: 1.4;
    margin-top: 10px;
}

.login-card-body {
    padding: 22px 26px 20px;
}

.login-card-body .form-group {
    margin-bottom: 14px;
}

.login-card-body h6 {
    font-size: 15px;
}

.login-footer-link {
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
}

/* ============================================================
   Footer
   ============================================================ */
.footer-ms {
    background-color: var(--ms-footer-bg);
    color: rgba(255,255,255,0.82);
    padding: 12px 24px;
    font-size: 13px;
    text-align: center;
    width: 100%;
}

.footer-ms-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

/* Desplazar el badge de reCAPTCHA por encima del footer fijo */
.grecaptcha-badge {
    bottom: 96px !important;
}

.footer-ms strong {
    color: #ffffff;
}

.footer-copyright {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(255,255,255,0.15);
    font-size: 11px;
    color: rgba(255,255,255,0.55);
}

/* ============================================================
   Vista autenticada
   ============================================================ */

.ms-auth-body {
    background: #f0f4f8;
}
.ms-auth-body > form {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.ms-app-header {
    background: var(--ms-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    flex-shrink: 0;
}
.ms-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ms-header-logo {
    height: 40px;
    width: auto;
    background: #fff;
    padding: 3px 6px;
    border-radius: 4px;
}
.ms-header-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.2px;
}
.ms-header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 13px;
}
.ms-header-username {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.88);
    text-decoration: none;
}
.ms-header-logout {
    color: rgba(255,255,255,0.88);
    text-decoration: none;
}
.ms-header-username:hover,
.ms-header-logout:hover {
    color: #fff;
    text-decoration: underline;
}
.ms-header-sep {
    color: rgba(255,255,255,0.35);
}
.ms-header-user .glyphicon {
    font-size: 14px;
    vertical-align: middle;
}

/* Nav en header */
.ms-header-nav {
    flex: 1;
    display: flex;
    align-self: stretch;
    padding: 0 10px;
}
.ms-header-nav ul.nav.nav-tabs {
    border-bottom: none;
    margin: 0;
    display: flex;
    align-items: stretch;
    height: 100%;
}
.ms-header-nav ul.nav.nav-tabs > li {
    display: flex;
    align-items: stretch;
    position: relative;
}
.ms-header-nav ul.nav.nav-tabs > li > a {
    color: rgba(255,255,255,0.78);
    border: none;
    border-radius: 0;
    padding: 0 14px;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0.1px;
    background: transparent;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
.ms-header-nav ul.nav.nav-tabs > li > a:hover,
.ms-header-nav ul.nav.nav-tabs > li.active > a,
.ms-header-nav ul.nav.nav-tabs > li.active > a:focus {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: none;
}
.ms-header-nav ul.nav.nav-tabs > li .dropdown-menu {
    background: var(--ms-primary);
    border: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    padding: 4px 0;
    top: 100%;
    left: 0;
}
.ms-header-nav ul.nav.nav-tabs > li .dropdown-menu > li > a {
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    padding: 7px 16px;
    display: block;
    white-space: nowrap;
}
.ms-header-nav ul.nav.nav-tabs > li .dropdown-menu > li > a:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* Content */
.ms-app-content {
    flex: 1;
    padding: 18px 20px;
    background: #f0f4f8;
}

/* Cards de contenido */
.ms-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--ms-shadow);
    margin-bottom: 14px;
    overflow: hidden; /* fallback navegadores antiguos */
    overflow: clip;   /* no crea scroll-container, permite position:sticky en hijos */
}
.ms-card-header {
    background: var(--ms-primary);
    color: #fff;
    padding: 10px 16px;
    font-size: 17px;
    font-weight: 600;
}
.ms-card-header-light {
    background: #cfdcea;
    color: var(--ms-primary);
    padding: 9px 16px 9px 14px;
    font-size: 16px;
    font-weight: 700;
    border-left: 4px solid var(--ms-primary);
}
.ms-card-body {
    padding: 14px;
}

/* Anular width/margin/bg de #container definido en template.css */
.ms-app-content #container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

/* ============================================================
   Hamburguesa (oculta en escritorio)
   ============================================================ */
.ms-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 4px;
    padding: 7px 9px;
    cursor: pointer;
    flex-shrink: 0;
}
.ms-nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: rgba(255,255,255,0.88);
    border-radius: 1px;
}

/* ============================================================
   Responsive ≤ 767px
   ============================================================ */
@media (max-width: 767px) {

    /* Header: apila secciones */
    .ms-app-header {
        flex-wrap: wrap;
        padding: 8px 14px;
    }
    .ms-header-brand {
        flex: 1;
    }
    .ms-header-title {
        font-size: 0.85rem;
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .ms-nav-toggle {
        display: flex;
    }

    /* Usuario: fila completa debajo del brand */
    .ms-header-user {
        order: 2;
        width: 100%;
        padding: 7px 0;
        border-top: 1px solid rgba(255,255,255,0.15);
        font-size: 12px;
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Nav: oculto por defecto, se muestra al abrir hamburguesa */
    .ms-header-nav {
        order: 3;
        display: none;
        flex: none;
        width: 100%;
        padding: 0;
        border-top: 1px solid rgba(255,255,255,0.15);
    }
    .ms-header-nav.mobile-open {
        display: flex;
    }
    .ms-header-nav ul.nav.nav-tabs {
        flex-direction: column;
        height: auto;
        width: 100%;
    }
    .ms-header-nav ul.nav.nav-tabs > li {
        display: block;
        width: 100%;
    }
    .ms-header-nav ul.nav.nav-tabs > li > a {
        padding: 10px 16px;
        display: block;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .ms-header-nav ul.nav.nav-tabs > li .dropdown-menu {
        position: static;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }
    .ms-header-nav ul.nav.nav-tabs > li .dropdown-menu > li > a {
        padding: 8px 28px;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }

    /* Contenido */
    .ms-app-content {
        padding: 12px;
    }
    .ms-card-body {
        padding: 14px;
    }

    /* Login: en móvil alinear al inicio para que el card no quede centrado con poco espacio */
    .login-wrapper {
        align-items: flex-start;
    }
}

/* ============================================================
   Dashboard — fila de cards igual altura
   ============================================================ */
.row-eq-height {
    display: flex;
    flex-wrap: wrap;
}
.row-eq-height > [class*="col-"] {
    display: flex;
    flex-direction: column;
}
.row-eq-height > [class*="col-"] > .ms-card {
    flex: 1;
}

/* ============================================================
   Dashboard — stats de viáticos
   ============================================================ */
.db-stats-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.db-stat {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 16px 8px 14px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.db-stat-num {
    display: block;
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--ms-primary);
}
.db-stat-label {
    display: block;
    font-size: 1.2rem;
    color: #64748b;
    margin-top: 8px;
    font-weight: 500;
}
.db-stat-success .db-stat-num { color: #16a34a; }
.db-stat-warning .db-stat-num { color: #d97706; }
.db-stat-danger  .db-stat-num { color: #dc2626; }
.db-stat-info    .db-stat-num { color: #0284c7; }
.db-stat-valor {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    font-size: 15px;
    color: #475569;
}
.db-legend-wrap {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}
.db-legend-toggle {
    font-size: 13px;
    font-weight: 500;
    color: var(--ms-primary);
    cursor: pointer;
    user-select: none;
    list-style: none;
}
.db-legend-toggle::-webkit-details-marker { display: none; }
.db-legend-toggle::before {
    content: "\f054";
    font-family: "FontAwesome";
    font-size: 11px;
    margin-right: 6px;
    display: inline-block;
    transition: transform 0.2s;
}
details[open] .db-legend-toggle::before {
    transform: rotate(90deg);
}
.db-legend-toggle:hover {
    text-decoration: underline;
}
.db-legend {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.db-legend-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #475569;
    line-height: 1.4;
}
.db-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
}
.db-legend-default { background: var(--ms-primary); }
.db-legend-warning  { background: #d97706; }
.db-legend-info     { background: #0284c7; }
.db-legend-success  { background: #16a34a; }
.db-legend-danger   { background: #dc2626; }
.db-pending-vb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    font-size: 13px;
    color: #78350f;
}
.db-pending-vb .fa-clock-o {
    color: #d97706;
    font-size: 15px;
    flex-shrink: 0;
}
.db-pending-vb-link {
    margin-left: auto;
    color: var(--ms-primary);
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}
.db-pending-vb-link:hover {
    text-decoration: underline;
}
.db-card-action {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    text-align: right;
    font-size: 13px;
}
.db-card-action a {
    color: var(--ms-primary);
    font-weight: 500;
    text-decoration: none;
}
.db-card-action a:hover {
    text-decoration: underline;
}

/* ============================================================
   Servicios — panel de lanzamiento
   ============================================================ */
.svc-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.svc-item {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 14px 10px 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    text-decoration: none;
    color: var(--ms-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.svc-item:hover,
.svc-item:focus {
    background: var(--ms-primary-light);
    border-color: var(--ms-primary);
    box-shadow: 0 4px 14px rgba(26,74,122,0.18);
    transform: translateY(-3px);
    color: var(--ms-primary-dark);
    text-decoration: none;
}
.svc-item .fa {
    font-size: 2.2rem;
}
.svc-item-label {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.35;
}
/* Forzar 2 columnas dentro de un svc-grid (para grupos con 4 ítems en col estrecha) */
.svc-grid-2col .svc-item {
    flex: 0 0 calc(50% - 5px);
    min-width: 0;
}
/* Ítem único que ocupa el ancho completo de la card */
.svc-item-full {
    width: 100%;
    min-height: 90px;
    padding: 20px 16px;
    justify-content: center;
}
/* Tabla de formulario: etiquetas */
.ms-form-table td:first-child {
    color: #4a5568;
    font-weight: 500;
    vertical-align: middle;
}
/* Tabla de datos GridView */
.ms-table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
}
.ms-table th {
    background-color: #1a4a7a !important;
    color: #fff !important;
    border-color: #0f3560 !important;
    white-space: nowrap;
    text-align: center !important;
    vertical-align: middle !important;
}
.ms-table td { vertical-align: middle !important; text-align: center !important; }
.ms-table .col-left { text-align: left !important; }

/* Contenedor de scroll con headers fijos */
.ms-table-scroll {
    overflow-x: auto;
    overflow-y: auto;
}
.ms-table-sticky th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #1a4a7a !important;
    box-shadow: 0 1px 0 #0f3560;
}

/* Row con columnas de igual altura */
.ms-row-stretch { display: flex; flex-wrap: wrap; }
.ms-row-stretch > [class*="col-"] { display: flex; flex-direction: column; }
.ms-row-stretch > [class*="col-"] > .ms-card { flex: 1; }

/* Encabezado de página */
.ms-page-header { margin-bottom: 24px; }
.ms-page-header h2 { margin: 0 0 4px 0; font-size: 22px; color: #2c3e50; }
.ms-page-subtitle { margin: 0; color: #6c757d; font-size: 14px; }

/* Manual de usuario */
.manual-section { margin-bottom: 32px; }
.manual-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c5282;
    border-left: 4px solid #2c5282;
    padding-left: 10px;
    margin-bottom: 16px;
}
.manual-step { margin-bottom: 24px; }
.manual-step-num {
    display: inline-block;
    background: #2c5282;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    margin-right: 8px;
    flex-shrink: 0;
}
.manual-step-header { display: flex; align-items: center; margin-bottom: 6px; font-weight: 600; color: #333; }
.manual-step-desc { color: #555; font-size: 14px; margin-bottom: 10px; margin-left: 32px; }
.manual-step-img {
    display: block;
    max-width: 100%;
    border: 1px solid #dde2e8;
    border-radius: 6px;
    margin-left: 32px;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.manual-img-caption {
    display: block;
    font-size: 12px;
    color: #888;
    margin-left: 32px;
    margin-top: 4px;
    font-style: italic;
}
.manual-note {
    background: #eaf3fb;
    border-left: 4px solid #3182ce;
    padding: 10px 14px;
    border-radius: 0 4px 4px 0;
    font-size: 13px;
    color: #2c5282;
    margin-left: 32px;
    margin-top: 8px;
}

@media (max-width: 767px) {
    .manual-step-img { margin-left: 0; }
    .manual-step-desc { margin-left: 0; }
    .manual-img-caption { margin-left: 0; }
    .manual-note { margin-left: 0; }
}

/* ============================================================
   Select2 — igualar altura a form-control Bootstrap 3 (34px)
   ============================================================ */
.select2-container--default .select2-selection--single {
    height: 34px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 32px;
    padding-left: 10px;
    padding-right: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 32px;
    top: 0;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    line-height: 32px;
}


/* ============================================================
   Header — info de último acceso
   ============================================================ */
.ms-header-user-info { display: flex; flex-direction: column; line-height: 1.25; }
.ms-last-access { font-size: 10px; opacity: 0.72; font-weight: normal; }
