/* ==============================================================
   ESTILOS GENERALES Y RESET
   SIPARES - Sistema de Información | Fundación Paz & Reconciliación (PARES)
   ============================================================== */
:root {
    --color-fondo: #fefefe; /* Color exacto del fondo de logo-sipares.png */
    --color-turquesa: #009ca6;
    --color-texto: #111111;
    --font-primary: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Montserrat', Roboto, Arial, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    background-color: var(--color-fondo);
    color: var(--color-texto);
    font-family: var(--font-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ==============================================================
   CABECERA SUPERIOR (TOP-BAR)
   ============================================================== */
.top-bar {
    width: 100%;
    padding: 20px 45px 0 45px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--color-fondo);
}

.top-bar-left {
    display: flex;
    align-items: center;
}

.logo-pares {
    height: 70px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
    display: block;
}

/* ==============================================================
   CONTENEDOR PRINCIPAL
   ============================================================== */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 0 30px 40px 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    background-color: var(--color-fondo);
}

/* ==============================================================
   HERO / LOGO CENTRAL SIPARES
   ============================================================== */
.hero-section {
    text-align: center;
    margin-top: -15px;
    margin-bottom: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.logo-sipares {
    max-width: 720px;
    width: 95%;
    height: auto;
    display: block;
    margin: 0 auto;
    /* Fusión perfecta e invisible del fondo del PNG con el fondo del sitio */
    mix-blend-mode: multiply;
}

/* ==============================================================
   GRID DE MÓDULOS (BOTONES CIRCULARES CON ARCOS)
   ============================================================== */
.modules-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 38px;
    width: 100%;
    max-width: 1250px;
}

.module-card {
    display: block;
    cursor: pointer;
    text-decoration: none;
    outline: none;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.module-circle-wrap {
    position: relative;
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Arcos en SVG superpuestos alrededor del círculo */
.module-arcs-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

/* Núcleo del Círculo Blanco */
.module-circle-core {
    position: relative;
    z-index: 2;
    width: 194px;
    height: 194px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 1.5px solid #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 18px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.module-title {
    color: #050505;
    font-size: 0.84rem;
    font-weight: 900;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    user-select: none;
}

/* Efectos Hover */
.module-card:hover {
    transform: translateY(-6px) scale(1.025);
}

.module-card:hover .module-circle-core {
    background-color: #fafafa;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.module-card:active {
    transform: translateY(-1px) scale(0.99);
}

/* ==============================================================
   FOOTER DISCRETO
   ============================================================== */
.app-footer {
    text-align: center;
    padding: 15px;
    font-size: 0.78rem;
    color: #94a3b8;
    background-color: var(--color-fondo);
}

/* ==============================================================
   VISTA DE LOGIN OCULTO (/login)
   ============================================================== */
.login-body {
    background: var(--color-fondo);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: #ffffff;
    border-radius: 14px;
    padding: 40px 35px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    text-align: center;
}

.login-logo {
    max-width: 320px;
    width: 85%;
    height: auto;
    margin-bottom: 25px;
    mix-blend-mode: multiply;
}

.login-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 0.88rem;
    color: #64748b;
    margin-bottom: 25px;
}

.form-group {
    text-align: left;
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background-color: #ffffff;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: var(--color-turquesa);
    box-shadow: 0 0 0 3px rgba(0, 156, 166, 0.15);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: var(--color-turquesa);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.btn-primary:hover {
    opacity: 0.9;
}

.login-back-link {
    display: inline-block;
    margin-top: 20px;
    font-size: 0.85rem;
    color: #64748b;
}

.login-back-link:hover {
    color: var(--color-turquesa);
}

/* ==============================================================
   PANEL DE ADMINISTRACIÓN (/admin)
   ============================================================== */
.admin-navbar {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 15px 35px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-nav-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-nav-logo {
    height: 48px;
    width: auto;
}

.admin-nav-tag {
    font-size: 0.78rem;
    font-weight: 700;
    background-color: #0f172a;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
}

.admin-nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-session-badge {
    padding: 6px 14px;
    border-radius: 20px;
    background-color: #e0f2fe;
    color: #0369a1;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-top-logout {
    padding: 6px 12px;
    border-radius: 6px;
    background-color: #fee2e2;
    color: #dc2626;
    font-size: 0.85rem;
    font-weight: 600;
}

.admin-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 25px;
    width: 100%;
}

.admin-header-title {
    margin-bottom: 25px;
}

.admin-header-title h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
}

.admin-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.admin-card-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.admin-table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 2px solid #e2e8f0;
}

.admin-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.color-swatch {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    vertical-align: middle;
    margin-right: 6px;
}

.btn-action-group {
    display: flex;
    gap: 6px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-edit {
    background-color: #e0f2fe;
    color: #0369a1;
}

.btn-edit:hover {
    background-color: #bae6fd;
}

.btn-delete {
    background-color: #fee2e2;
    color: #dc2626;
}

.btn-delete:hover {
    background-color: #fecaca;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #334155;
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-success {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.table-responsive {
    overflow-x: auto;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-input-wrapper input[type="color"] {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    width: 42px;
    height: 38px;
    cursor: pointer;
    padding: 2px;
    background: #fff;
}

/* Layouts en Grid para el Panel de Administración */
.admin-grid-2col {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 30px;
    align-items: start;
}

.admin-users-layout {
    grid-template-columns: 1.2fr 1.8fr;
}

/* ==============================================================
   MODAL DE CONFIRMACIÓN ELEGANTE
   ============================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: modalFadeIn 0.15s ease-out;
}

.modal-card {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 430px;
    padding: 30px 28px;
    text-align: center;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.08);
    animation: modalZoomIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-icon-danger {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background-color: #fee2e2;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px auto;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 8px;
}

.modal-text {
    font-size: 0.92rem;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 22px;
}

.modal-text strong {
    color: #1e293b;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-modal-cancel {
    flex: 1;
    padding: 11px 16px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
    color: #334155;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-cancel:hover {
    background-color: #f1f5f9;
}

.btn-modal-delete {
    flex: 1;
    padding: 11px 16px;
    border-radius: 8px;
    border: none;
    background-color: #dc2626;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-delete:hover {
    background-color: #b91c1c;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalZoomIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

/* ==============================================================
   RESPONSIVIDAD (HOME Y PANEL DE ADMINISTRACIÓN)
   ============================================================== */
@media (max-width: 992px) {
    /* Home */
    .modules-grid {
        gap: 25px;
    }
    .module-circle-wrap {
        width: 195px;
        height: 195px;
    }
    .module-circle-core {
        width: 172px;
        height: 172px;
    }
    .module-title {
        font-size: 0.76rem;
    }

    /* Admin */
    .admin-grid-2col,
    .admin-users-layout {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .preview-box {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    /* Home */
    .top-bar {
        padding: 15px 20px;
        justify-content: center;
    }
    .logo-pares {
        height: 52px;
    }
    .hero-section {
        margin-bottom: 35px;
    }
    .logo-sipares {
        max-width: 460px;
    }
    .module-circle-wrap {
        width: 175px;
        height: 175px;
    }
    .module-circle-core {
        width: 154px;
        height: 154px;
        padding: 14px 10px;
    }
    .module-title {
        font-size: 0.7rem;
    }

    /* Admin Navbar */
    .admin-navbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px 18px;
        text-align: center;
    }
    .admin-nav-left {
        justify-content: center;
        width: 100%;
    }
    .admin-nav-right {
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Admin Layout & Cards */
    .admin-container {
        padding: 0 12px;
        margin: 18px auto;
    }
    .admin-header-title h1 {
        font-size: 1.3rem;
        text-align: center;
    }
    .admin-card {
        padding: 18px 14px;
        border-radius: 10px;
        margin-bottom: 20px;
    }
    .admin-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .admin-card-header h2 {
        font-size: 1.05rem;
    }

    /* Tablas y Formularios */
    .form-grid {
        grid-template-columns: 1fr;
    }
    .admin-table {
        min-width: 580px; /* Asegura scroll táctil suave sin comprimir columnas */
    }
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 12px;
        border: 1px solid #f1f5f9;
        border-radius: 8px;
    }
    .admin-table th,
    .admin-table td {
        padding: 10px 8px;
        font-size: 0.82rem;
    }
    .btn-action-group {
        flex-wrap: wrap;
    }
    .btn-primary {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .admin-nav-right {
        flex-direction: column;
        width: 100%;
    }
    .admin-nav-right .btn-sm,
    .admin-nav-right .btn-top-logout,
    .admin-nav-right .admin-session-badge {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    .modal-card {
        padding: 24px 16px;
    }
    .modal-actions {
        flex-direction: column;
    }
}
