/* =========================================
   SISTEMA DE DISEÑO BASE - SOMOS
========================================= */

:root {
    --primario: #d10074;
    --primario-hover: #a3005a;
    --fondo-body: #f8f9fa;
    --fondo-card: #ffffff;
    --texto-principal: #333333;
    --texto-secundario: #666666;
    --borde: #e0e0e0;
    --borde-focus: rgba(209, 0, 116, 0.3);
    --rojo-error: #dc3545;
    --verde-exito: #0f5132;
    --fondo-exito: #d1e7dd;
    --sombra-card: 0 8px 30px rgba(0,0,0,0.04);
    --radio-card: 16px;
    --radio-input: 8px;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--fondo-body);
    color: var(--texto-principal);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* =========================================
   HEADER LIMPIO Y ESTRUCTURADO
========================================= */
.header-top {
    background-color: var(--fondo-card);
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--borde);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
}

.header-top img {
    height: 32px;
    margin-right: 20px;
}

.header-top .divisor {
    width: 1px;
    height: 24px;
    background-color: var(--borde);
    margin-right: 20px;
}

.header-top h1 {
    font-size: 14px;
    font-weight: 500;
    color: var(--texto-secundario);
    margin: 0;
}

.header-top h1 a {
    font-size: 14px;
    font-weight: 500;
    color: var(--texto-secundario);
    margin: 0;
}

.user-greeting {
    margin-right: 20px;
    color: var(--texto-secundario);
    font-size: 14px;
}

.user-greeting b { color: var(--texto-principal); }

.btn-logout {
    color: var(--primario);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.btn-logout:hover { color: var(--primario-hover); }

/* =========================================
   CONTENEDORES Y TARJETAS
========================================= */
.main-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 40px 20px;
    width: 100%;
    box-sizing: border-box;

    grid-template-columns: 350px 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 2rem auto;
    align-items: start; /* Evita que las tarjetas se estiren asimétricamente */

}

/* Variante para dashboards y formularios extensos */
.main-wrapper.dashboard-layout {
    align-items: flex-start;
    max-width: 1000px;
    margin: 0 auto;
}

.card-estandar {
    background-color: var(--fondo-card);
    padding: 40px;
    border-radius: var(--radio-card);
    box-shadow: var(--sombra-card);
    border: 1px solid rgba(0,0,0,0.05);

    display: block;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;

}

.card-centrada { max-width: 1200px;
  display: flex;}
.card-amplia { max-width: 500px; } /* Para registro inicial */

.card-estandar h2 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 24px;
    font-weight: 700;
}

/* Encabezados de secciones de formulario (Paso 1, Identificación, etc) */
.card-estandar h3 {
    margin-top: 30px;
    margin-bottom: 20px;
    font-size: 18px;
    border-bottom: 2px solid var(--primario);
    padding-bottom: 8px;
    color: var(--texto-principal);
}

.card-estandar p.subtitle {
    color: var(--texto-secundario);
    font-size: 14px;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* =====================================
    ANEXOS
======================================= */
/* Refinamiento unificado de las tarjetas */
        .dashboard-card {
            background: #ffffff;
            border-radius: 12px;
            padding: 2rem;
            box-shadow: 0 4px 15px rgba(0,0,0,0.04);
            border: 1px solid #eaeaea;
        }

        .dashboard-card h2 {
            font-size: 1.4rem;
            color: #333;
            margin-top: 0;
            margin-bottom: 1.5rem;
            border-bottom: 2px solid #f4f4f4;
            padding-bottom: 0.75rem;
        }

        /* Lista de anexos tipo bloque */
                .anexos-list {
                    list-style: none;
                    padding: 0;
                    margin: 1.5rem 0 0 0;
                }

                .anexos-list li {
                    margin-bottom: 0.8rem;
                    background: #fdfdfd;
                    border: 1px solid #f0f0f0;
                    border-radius: 8px;
                    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s;
                }

                .anexos-list li:hover {
                    background: #fff0f5;
                    border-color: #d80065;
                    transform: translateX(4px);
                }

                .anexos-list a {
                    display: flex;
                    align-items: center;
                    padding: 1rem 1.2rem;
                    color: #444;
                    text-decoration: none;
                    font-weight: 500;
                    font-size: 0.95rem;
                    line-height: 1.4;
                }

                /* SVG totalmente codificado y cargado como fondo para máxima compatibilidad */
                .anexos-list a::before {
                    content: "";
                    display: inline-block;
                    width: 22px;
                    height: 22px;
                    margin-right: 14px;
                    flex-shrink: 0;
                    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%23d80065' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'%3E%3C/path%3E%3Cpolyline points='14 2 14 8 20 8'%3E%3C/polyline%3E%3Cline x1='16' y1='13' x2='8' y2='13'%3E%3C/line%3E%3Cline x1='16' y1='17' x2='8' y2='17'%3E%3C/line%3E%3Cpolyline points='10 9 9 9 8 9'%3E%3C/polyline%3E%3C/svg%3E");
                    background-repeat: no-repeat;
                    background-position: center;
                }

        .mensaje-bienvenida {
            color: #555;
            line-height: 1.6;
            margin-bottom: 1.5rem;
        }

/* =========================================
   FORMULARIOS
========================================= */
.form-group { margin-bottom: 20px; text-align: left; }
.form-row { display: flex; gap: 20px; flex-wrap: wrap; }
.form-col { flex: 1; min-width: 250px; }

label {
    display: block;
    margin-bottom: 6px;
    color: var(--texto-principal);
    font-weight: 500;
    font-size: 14px;
}

label .asterisk { color: var(--primario); }

/* Se agregaron url, date y number del captura_datos */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--borde);
    border-radius: var(--radio-input);
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    color: var(--texto-principal);
    transition: all 0.2s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primario);
    box-shadow: 0 0 0 4px var(--borde-focus);
}

/* Campos de solo lectura (Nombre y Correo precargados) */
input:read-only, input:disabled, select:disabled {
    background-color: #f1f3f5;
    color: var(--texto-secundario);
    cursor: not-allowed;
}

/* =========================================
   BOTONES
========================================= */
.btn-submit, .btn-primary {
    display: inline-block;
    background-color: var(--primario);
    color: var(--fondo-card);
    padding: 14px 24px;
    border: none;
    border-radius: var(--radio-input);
    width: 100%;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s, transform 0.1s;
    box-sizing: border-box;
    margin-top: 10px;
}

.btn-primary.auto-width { width: auto; }

.btn-submit:hover, .btn-primary:hover { background-color: var(--primario-hover); }
.btn-submit:active, .btn-primary:active { transform: scale(0.98); }
.btn-submit:disabled, .btn-primary:disabled { background-color: #cccccc; cursor: not-allowed; transform: none; }

/* =========================================
   ALERTAS Y ETIQUETAS
========================================= */
.alerta, .alert {
    padding: 14px 16px;
    border-radius: var(--radio-input);
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
}
.alerta.error, .alert-error { background-color: #fef2f2; color: var(--rojo-error); border: 1px solid #fecaca; }
.alerta.exito, .alert-success { background-color: var(--fondo-exito); color: var(--verde-exito); border: 1px solid #badbcc; }

/* Mensajes de error inyectados por JavaScript (captura_datos) */
.error-msg {
    background-color: #fef2f2;
    color: var(--rojo-error);
    padding: 10px 14px;
    border-radius: var(--radio-input);
    margin-bottom: 20px;
    border: 1px solid #fecaca;
    font-size: 14px;
}

.status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    background-color: #fce4ec;
    color: var(--primario);
    margin-bottom: 25px;
    letter-spacing: 0.5px;
}

/* =========================================
   LAYOUT DE ADMINISTRACIÓN (SIDEBAR)
========================================= */
.admin-layout {
    display: flex;
    flex: 1;
    height: 100vh;
    overflow: hidden;
    background-color: var(--fondo-body);
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background-color: var(--fondo-card);
    border-right: 1px solid var(--borde);
    display: flex;
    flex-direction: column;
    padding-top: 24px;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 0 24px 24px;
    margin-bottom: 10px;
}
.sidebar-logo img { max-width: 130px; }

.nav-group { margin-bottom: 24px; }
.nav-title {
    font-size: 11px;
    font-weight: 700;
    color: #999999;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 24px;
    margin-bottom: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--texto-secundario);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-item:hover { color: var(--primario); background-color: #fcfcfc; }
.nav-item.active {
    background-color: #fce4ec;
    color: var(--primario);
    border-radius: 0 24px 24px 0;
    margin-right: 20px;
    font-weight: 600;
}

/* =========================================
   CONTENIDO PRINCIPAL ADMIN
========================================= */
.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 30px;
}

.admin-header h2 {
    margin: 0;
    font-size: 24px;
    color: var(--texto-principal);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.kpi-card {
    background: var(--fondo-card);
    padding: 24px;
    border-radius: var(--radio-card);
    box-shadow: var(--sombra-card);
    border: 1px solid rgba(0,0,0,0.03);
}

.kpi-card h3 { margin: 0; font-size: 13px; color: var(--texto-secundario); font-weight: 600; text-transform: uppercase; }
.kpi-card .number { font-size: 32px; font-weight: 700; color: var(--primario); margin-top: 12px; }

/* =========================================
   TABLAS MODERNAS
========================================= */
.table-header-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    align-items: center;
}

input.search-input {
    width: 300px;
    padding: 10px 16px 10px 40px;
    border-radius: 20px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>') no-repeat 14px center;
    background-color: var(--fondo-card);
}

.modern-table-container {
    background: var(--fondo-card);
    border-radius: var(--radio-card);
    box-shadow: var(--sombra-card);
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
}

.modern-table { width: 100%; border-collapse: collapse; text-align: left; }
.modern-table th {
    padding: 16px 24px;
    font-size: 13px;
    font-weight: 600;
    color: var(--texto-secundario);
    border-bottom: 1px solid var(--borde);
    background: #fafbfc;
}
.modern-table td {
    padding: 16px 24px;
    font-size: 14px;
    color: var(--texto-principal);
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.modern-table tr:last-child td { border-bottom: none; }
.modern-table tr:hover { background-color: #fdfdfd; }

/* BADGES PASTEL */
.badge-soft { padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-block; }
.badge-warning { background-color: #fff3cd; color: #856404; }
.badge-success { background-color: #d1e7dd; color: #0f5132; }
.badge-danger { background-color: #f8d7da; color: #842029; }
.badge-info { background-color: #e0f7fa; color: #006064; }
.badge-primary { background-color: #fce4ec; color: var(--primario); }


/* =========================================
   RESPONSIVE & MOBILE (SIDEBAR Y TABLAS)
========================================= */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 998;
    backdrop-filter: blur(2px);
}

.btn-open-sidebar {
    display: none;
    background: none;
    border: none;
    color: var(--texto-principal);
    cursor: pointer;
    padding: 5px;
    margin-right: 15px;
}

.btn-close-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--texto-secundario);
    line-height: 1;
}

.admin-header-left {
    display: flex;
    align-items: center;
}

/* Responsivo para móviles */
@media (max-width: 860px) {
  .main-wrapper {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 992px) {
    .btn-open-sidebar { display: block; }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 999;
        transition: left 0.3s ease;
        box-shadow: 4px 0 15px rgba(0,0,0,0.05);
    }

    .sidebar.active { left: 0; }
    .sidebar-overlay.active { display: block; }
    .btn-close-sidebar { display: block; }

    .sidebar-logo {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .card-centrada { max-width: 400px; } /* Para login, recuperar password */

    .user-greeting, .user-greeting span { text-align: left !important; }

    .table-header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .search-input { width: 100%; }
    .modern-table-container { overflow-x: auto; }
}
