﻿/* ============================================================
   COMPONENTES INSTITUCIONALES — PUEBLA DIGITAL 2024–2030
   ============================================================ */
:root {
    --ep-primary: #f55;
    --ep-error: #ff4d4d;
    --ep-border: #ddd;
    --ep-bg: #fff;
    --ep-bg-hover: #f2f2f2;
    --ep-bg-error: #ffecec;
    --ep-disabled: #f5f5f5;
    --ep-accent: #d11c3d;
    --ep-error-text: #d32f2f;
}

/* ------------------------------------------------------------
   BOTONES
   ------------------------------------------------------------ */

/* Botón base */
.ep-btn {
    font-family: inherit;
    font-size: .8rem;
    padding: .6rem .6rem;
    border-radius: 8px 2px;
    border: none;
    cursor: pointer;
    transition: background .2s ease, box-shadow .2s ease;
    font-weight: 300;
    display: inline-flex;
    align-items: center;
    gap: .1rem;
}

/* Tamaño pequeño */
.ep-btn-sm {
    font-size: .7rem;
    padding: .35rem .5rem;
    border-radius: 6px 2px;
}

/* Tamaño mediano (default) */
.ep-btn-md {
    font-size: .8rem;
    padding: .6rem .8rem;
}

/* Tamaño grande */
.ep-btn-lg {
    font-size: 1rem;
    font-weight: 600;
    padding: .8rem 1rem;
    border-radius: 10px 3px;
}


    .ep-btn:focus {
        outline: none;
    }

/* Primario (Guinda medio) */
.ep-btn-primary {
    background: var(--puebla-guinda);
    color: #fff;
}

    .ep-btn-primary:hover {
        background: var(--puebla-guinda-light);
    }

    .ep-btn-primary:active {
        background: var(--puebla-guinda-dark);
    }

    .ep-btn-primary:focus {
        background: var(--puebla-guinda-light);
    }

/* Secundario (Verde medio) */
.ep-btn-secondary {
    background: var(--puebla-green);
    color: var(--text-light);
}

    .ep-btn-secondary:hover {
        background: var(--puebla-green-light);
    }

    .ep-btn-secondary:active {
        background: var(--puebla-green-dark);
    }

    .ep-btn-secondary:focus {
        background: var(--puebla-green-light);
    }

/* Alterno (Ocre) */
.ep-btn-alt {
    background: var(--puebla-ocre);
    color: var(--text-light);
}

    .ep-btn-alt:hover {
        background: var(--puebla-beige);
        color: var(--text-dark);
    }

    .ep-btn-alt:active {
        background: var(--puebla-guinda-dark);
        color: var(--text-light);
    }

    .ep-btn-alt:focus {
        background: var(--puebla-beige);
        color: var(--text-dark);
    }

/* Fantasma (Ghost) */
.ep-btn-ghost {
    background: #efefef55;
    border: 1px solid var(--puebla-guinda);
    color: var(--puebla-guinda);
}

    .ep-btn-ghost:hover {
        background: #af173211;
    }

    .ep-btn-ghost:active {
        background: #99173211;
    }

    .ep-btn-ghost:focus {
        background: #af173211;
    }

.ep-btn-borderless {
    background: transparent;
    color: #353535;
}
    .ep-btn-borderless:hover {
        background: #af173211;
    }

    .ep-btn-borderless:active {
        background: #99173211;
    }

    .ep-btn-borderless:focus {
        background: #af173211;
    }

/* Deshabilitado */
.ep-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ------------------------------------------------------------
   INPUTS
   ------------------------------------------------------------ */
/* ------------------------------------------------------------
   CONTENEDOR PRINCIPAL
   ------------------------------------------------------------ */
.ep-field-container {
    display: flex;
    flex-direction: column;
    gap: 0.1rem; /* Este controla la distancia exacta entre Label e Input */
    width: 100%;
}

    .ep-field-container.error {
        border-left: 3px solid var(--ep-error-text);
        padding-left: 6px;
    }

.ep-input-label {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 100;
    font-size: 1rem;
}

.ep-control-wrapper {
    position: relative;
    width: 100%;
    overflow: visible;
}

/* ------------------------------------------------------------
   ESTILOS BASE PARA TODOS LOS CONTROLES
   ------------------------------------------------------------ */
.ep-input,
.ep-textarea,
.ep-select,
.ep-date {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 400;
    font-size: .85rem;
    width: 100%;
    padding: .35rem .6rem;
    border-radius: 6px 6px 1px 1px;
    border: 1px solid var(--ep-border);
    background: var(--ep-bg);
    transition: all .2s ease;
    display: block;
    outline: none;
    box-sizing: border-box;
}

    /* Hover general */
    .ep-input:hover,
    .ep-textarea:hover,
    .ep-select:hover,
    .ep-date:hover {
        background: var(--ep-bg-hover);
    }

.ep-field-support {
    display: flex;
    justify-content: space-between; /* Empuja el error a la izquierda y contador a la derecha */
    align-items: flex-start;
}

.ep-text-counter {
    font-size: 0.75rem;
    color: #555;
    white-space: nowrap; /* Evita que el "50 / 500" se parta en dos líneas */
    font-family: monospace; /* Opcional: para que los números no bailen al cambiar */
}

.ep-input-error {
    color: var(--ep-error-text);
    font-size: 0.80rem;
    flex: 1; /* Permite que el error tome el espacio necesario */
    padding-right: 10px;
}

/* ------------------------------------------------------------
   ANIMACIÓN DEL UNDERLINE (Común para todos)
   ------------------------------------------------------------ */
.ep-control-wrapper::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 0%;
    height: 3px;
    background-color: var(--ep-accent);
    transform: translateX(-50%);
    transition: width .3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 2;
}

/* Activación por Focus en cualquier hijo */
.ep-control-wrapper:focus-within::after {
    width: 100%;
}

/* ------------------------------------------------------------
   ESTADOS ESPECIALES (Error y Disabled)
   ------------------------------------------------------------ */

/* Error */
.ep-control-wrapper.error .ep-input,
.ep-control-wrapper.error .ep-textarea,
.ep-control-wrapper.error .ep-select,
.ep-control-wrapper.error .ep-date {
    border-color: var(--ep-error);
    background: var(--ep-bg-error);
}

/* Disabled */
.ep-control-wrapper.disabled .ep-input,
.ep-control-wrapper.disabled .ep-textarea,
.ep-control-wrapper.disabled .ep-select,
.ep-control-wrapper.disabled .ep-date {
    background: var(--ep-disabled);
    cursor: not-allowed;
    opacity: 0.7;
}

/* ------------------------------------------------------------
   REGLAS ESPECÍFICAS POR TIPO
   ------------------------------------------------------------ */
.ep-textarea {
    min-height: 100px;
    resize: vertical;
}

.ep-select {
    appearance: none;
    cursor: pointer;
}

.ep-input-toggle {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    opacity: .6;
    font-size: 1rem;
}

    .ep-input-toggle:hover {
        opacity: 1;
    }

/* Edge / IE */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

/* Chrome / Edge Chromium */
input[type="password"]::-webkit-textfield-decoration-container {
    display: none;
}

input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none;
}



/* ------------------------------------------------------------
   SWITCH
   ------------------------------------------------------------ */

.ep-switch {
    position: relative;
    width: 42px;
    height: 22px;
}

    .ep-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.ep-switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--puebla-gray);
    border-radius: 22px;
    transition: .2s;
}

    .ep-switch-slider:before {
        content: "";
        position: absolute;
        height: 18px;
        width: 18px;
        left: 2px;
        bottom: 2px;
        background: white;
        border-radius: 50%;
        transition: .2s;
    }

.ep-switch input:checked + .ep-switch-slider {
    background: var(--puebla-green);
}

    .ep-switch input:checked + .ep-switch-slider:before {
        transform: translateX(20px);
    }

/* ------------------------------------------------------------
   CARDS
   ------------------------------------------------------------ */

.ep-card {
    background: #a883;
    backdrop-filter: blur(2px);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,.1);
    border: 1px solid var(--puebla-gray-light);
    height: 100%;
    display: flex;
    flex-direction: column;
    height: 100%; /* o un alto fijo si lo necesitas */
}

.ep-card-content {
    flex: 1; /* ocupa todo el espacio disponible */
}

.ep-card-header {
    font-weight: 700;
    margin-bottom: .5rem;
}

.ep-card-footer {
    margin-top: 1rem;
    text-align: right;
    flex-shrink: 0; /* evita que el footer se comprima */
}

/* ------------------------------------------------------------
   MODALES
   ------------------------------------------------------------ */

.ep-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.ep-modal {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    width: min(500px, 90%);
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
}

.ep-modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* ------------------------------------------------------------
   TABS
   ------------------------------------------------------------ */

.tabs-container {
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI';
}

.tabs-header {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #ddd;
}

.tab-button {
    position: relative;
    padding: 10px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 500;
    color: #555;
    transition: color .2s ease;
}

    .tab-button:hover {
        color: #000;
    }

    .tab-button::after {
        content: "";
        position: absolute;
        left: 50%;
        bottom: 0;
        height: 3px;
        width: 0%;
        background-color: #f559;
        transform: translateX(-50%);
        transition: width .25s ease;
    }

    .tab-button.active {
        color: crimson;
    }

        .tab-button.active::after {
            width: 100%;
        }

.tabs-content {
    padding: 16px 4px;
}

/* ------------------------------------------------------------
   BADGES
   ------------------------------------------------------------ */

.ep-badge {
    display: inline-block;
    padding: .25rem .6rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    color: white;
}

.ep-badge-info {
    background: var(--puebla-green);
}

.ep-badge-warn {
    background: var(--puebla-ocre);
}

.ep-badge-danger {
    background: var(--puebla-guinda-light);
}

/* ------------------------------------------------------------
   CHIPS
   ------------------------------------------------------------ */

.ep-chip {
    display: inline-flex;
    align-items: center;
    padding: .25rem .75rem;
    border-radius: 20px;
    background: var(--puebla-gray-light);
    color: var(--text-dark);
    font-size: .85rem;
}

/* ------------------------------------------------------------
   TOOLTIP
   ------------------------------------------------------------ */

.ep-tooltip {
    position: relative;
}

    .ep-tooltip:hover .ep-tooltip-content {
        opacity: 1;
        transform: translateY(-6px);
    }

.ep-tooltip-content {
    position: absolute;
    background: var(--puebla-gray-dark);
    color: white;
    padding: .4rem .6rem;
    border-radius: 6px;
    font-size: .75rem;
    opacity: 0;
    transition: .2s;
    white-space: nowrap;
    bottom: 120%;
}

/* ------------------------------------------------------------
   LOADER
   ------------------------------------------------------------ */

.ep-loader {
    width: 128px;
    height: 128px;
    border: 8px solid var(--puebla-gray-light);
    border-top-color: var(--puebla-guinda);
    border-radius: 50%;
    animation: ep-spin 1.3s linear infinite;
}

@keyframes ep-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================
   PROFILE CARD — PUEBLA DIGITAL 2024–2030
   ============================================================ */
/* ------------------------------------------------------------
   HEADER
   ------------------------------------------------------------ */

.ep-profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ep-profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--puebla-guinda);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    border: 3px solid var(--puebla-guinda-dark);
}

.ep-profile-header-info {
    display: flex;
    flex-direction: column;
    gap: 0; /* elimina cualquier espacio */
}

.ep-profile-fullname {
    font-size: 1.1rem;
    font-weight: 700;
}

.ep-profile-expediente {
    opacity: .85;
    font-size: .9rem;
}

/* ------------------------------------------------------------
   BODY
   ------------------------------------------------------------ */

.ep-profile-body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ------------------------------------------------------------
   SECTIONS
   ------------------------------------------------------------ */

.ep-profile-section-title {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: .75rem;
    color: var(--puebla-green-dark);
}

.ep-profile-section {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--puebla-gray-light);
}

/* ------------------------------------------------------------
   GRID
   ------------------------------------------------------------ */

.ep-profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 2rem;
}

/* ------------------------------------------------------------
   LABELS & VALUES
   ------------------------------------------------------------ */

.ep-profile-label {
    font-size: .75rem;
    font-weight: 500;
    color: var(--puebla-gray-dark);
    margin-bottom: .25rem;
}

.ep-profile-value {
    font-size: .8rem;
    font-weight: 100;
    color: var(--text-dark);
    white-space: pre-line;
}

.ep-icon {
    width: 22px;
    height: 22px;
    stroke: var(--puebla-guinda-dark);
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

.ep-profile-flag {
    font-size: .75rem;
    font-weight: 300;
    color: var(--puebla-gray-dark);
    margin-bottom: .25rem;
    user-select: none;
}

.ep-grid {
    width: 100%;
}

@media (max-width: 768px) {
    .ep-grid-item {
        grid-column: span 12 !important;
    }
}

/* ------------------------------------------------------------
   DRAWER
   ------------------------------------------------------------ */
.ep-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(2px);
    z-index: 998;
}

.ep-drawer {
    color: #222;
    text-shadow: 0 0 4px rgba(255,255,255,0.6), 0 0 8px rgba(255,255,255,0.4), 0 0 12px rgba(255,255,255,0.2);
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100vh;
    backdrop-filter: blur(3px);
    box-shadow: -2px 0 8px rgba(0,0,0,0.2);
    z-index: 999;
    display: flex;
    flex-direction: column;
    animation: ep-drawer-slide 0.25s ease-out;
}

@keyframes ep-drawer-slide {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.ep-drawer-header {
    padding: 16px;
    font-size: 1.1rem;
    font-weight: bold;
    border-bottom: 1px solid #ddd5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.ep-drawer-close {
    color: #222;
    text-shadow: 0 0 4px rgba(255,255,255,0.6), 0 0 8px rgba(255,255,255,0.4), 0 0 12px rgba(255,255,255,0.2);
    background: none;
    border: none;
    font-size: 1.5rem;
    font-weight: 900;
    cursor: pointer;
}

.ep-drawer-body {
    padding: 16px;
    overflow-y: auto;
}
