/* ====== AUTORIDADES - ESTILOS COMPLETOS ====== */

/* Variables de color consistentes */
:root {
    --primary-teal: #00bec6ff;
    --primary-teal-dark: #009aa0;
    --primary-blue: #004063ff;
    --primary-blue-light: #e8f4f8;
    --bg-light: #f8f9fa;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 15px 40px rgba(0, 0, 0, 0.15);
    --border-radius: 14px;
    --border-radius-sm: 10px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====== HERO SECTION ====== */
.authorities-hero {
    background: linear-gradient(135deg, rgba(0, 64, 99, 0.88), rgba(0, 190, 198, 0.85)), 
                url('/static/images/autoridades/hero-bg.jpg');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 100px 0 70px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.authorities-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.authorities-hero h1 {
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
    font-size: 2.8rem;
    animation: fadeInDown 0.8s ease;
}

.authorities-hero p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
    animation: fadeInUp 0.8s ease 0.2s both;
    opacity: 0.95;
}

/* ====== ANIMACIONES ====== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ====== ORGANIGRAMA ====== */
.org-chart {
    padding: 60px 0 80px;
    background: var(--bg-light);
}

.org-chart .container {
    max-width: 1300px;
}

/* Título del organigrama */
.org-title {
    text-align: center;
    margin-bottom: 50px;
}

.org-title h2 {
    color: var(--primary-blue);
    font-weight: 700;
    font-size: 2rem;
    position: relative;
    display: inline-block;
}

.org-title h2::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-teal), var(--primary-blue));
    margin: 12px auto 0;
    border-radius: 2px;
}

.org-title p {
    color: #6c757d;
    font-size: 1rem;
    margin-top: 10px;
}

/* ====== NIVELES DEL ORGANIGRAMA ====== */
.org-level {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    position: relative;
}

/* Línea conectora entre niveles */
.org-connector {
    width: 2px;
    height: 35px;
    background: linear-gradient(180deg, var(--primary-teal), var(--primary-blue));
    margin: 5px auto 30px;
    position: relative;
}

.org-connector::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: var(--primary-teal);
    border-radius: 50%;
}

.org-connector::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: var(--primary-blue);
    border-radius: 50%;
}

/* ====== TARJETAS DE AUTORIDADES ====== */
.authority-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px 20px 20px;
    width: 210px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    text-align: center;
    border: 1px solid rgba(0,0,0,0.03);
    position: relative;
    overflow: hidden;
}

.authority-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-teal), var(--primary-blue));
    opacity: 0;
    transition: var(--transition);
}

.authority-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-teal);
}

.authority-card:hover::before {
    opacity: 1;
}

/* Nivel de jerarquía - diferentes colores */
.org-level:nth-child(1) .authority-card {
    border-top: 3px solid #ffd700;
}

.org-level:nth-child(3) .authority-card {
    border-top: 3px solid var(--primary-teal);
}

.org-level:nth-child(5) .authority-card {
    border-top: 3px solid var(--primary-blue);
}

.org-level:nth-child(7) .authority-card {
    border-top: 3px solid #6c757d;
}

/* ====== FOTO ====== */
.authority-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-light);
    margin: 0 auto 15px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: block;
}

.authority-card:hover .authority-photo {
    border-color: var(--primary-teal);
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 190, 198, 0.25);
}

/* ====== NOMBRE ====== */
.authority-name {
    color: var(--primary-blue);
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 1rem;
    line-height: 1.3;
}

/* ====== CARGO ====== */
.authority-position {
    color: #6c757d;
    font-size: 0.85rem;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    line-height: 1.4;
    padding: 0 5px;
}

/* ====== BADGE DE NIVEL ====== */
.authority-level-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 12px;
    border-radius: 20px;
    background: var(--bg-light);
    color: var(--primary-blue);
    margin-bottom: 10px;
}

/* ====== RESPONSIVE ====== */

/* Tablets grandes */
@media (max-width: 1200px) {
    .authority-card {
        width: 190px;
        padding: 20px 15px 18px;
    }
    
    .authority-photo {
        width: 100px;
        height: 100px;
    }
    
    .authority-name {
        font-size: 0.9rem;
    }
    
    .authority-position {
        font-size: 0.8rem;
        min-height: 45px;
    }
}

/* Tablets */
@media (max-width: 992px) {
    .authorities-hero {
        padding: 80px 0 60px;
    }
    
    .authorities-hero h1 {
        font-size: 2.3rem;
    }
    
    .authorities-hero p {
        font-size: 1rem;
    }
    
    .org-chart {
        padding: 40px 0 60px;
    }
    
    .org-title h2 {
        font-size: 1.7rem;
    }
    
    .org-level {
        gap: 15px;
        margin-bottom: 25px;
    }
    
    .authority-card {
        width: 180px;
        padding: 18px 12px 15px;
    }
    
    .authority-photo {
        width: 90px;
        height: 90px;
        margin-bottom: 12px;
    }
    
    .authority-name {
        font-size: 0.85rem;
    }
    
    .authority-position {
        font-size: 0.75rem;
        min-height: 40px;
    }
}

/* Móviles grandes */
@media (max-width: 768px) {
    .authorities-hero {
        padding: 60px 0 50px;
    }
    
    .authorities-hero h1 {
        font-size: 1.8rem;
    }
    
    .authorities-hero p {
        font-size: 0.95rem;
        padding: 0 15px;
    }
    
    .org-chart {
        padding: 30px 0 50px;
    }
    
    .org-title h2 {
        font-size: 1.5rem;
    }
    
    .org-title p {
        font-size: 0.9rem;
    }
    
    .org-level {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .org-connector {
        width: 2px;
        height: 25px;
        margin: 0 auto 20px;
    }
    
    .authority-card {
        width: 85%;
        max-width: 260px;
        padding: 20px 15px 18px;
    }
    
    .authority-photo {
        width: 110px;
        height: 110px;
        margin-bottom: 12px;
    }
    
    .authority-name {
        font-size: 0.95rem;
    }
    
    .authority-position {
        font-size: 0.8rem;
        min-height: 40px;
    }
}

/* Móviles pequeños */
@media (max-width: 576px) {
    .authorities-hero {
        padding: 50px 0 40px;
    }
    
    .authorities-hero h1 {
        font-size: 1.5rem;
    }
    
    .authorities-hero p {
        font-size: 0.85rem;
    }
    
    .org-chart {
        padding: 20px 0 40px;
    }
    
    .org-title h2 {
        font-size: 1.3rem;
    }
    
    .org-title p {
        font-size: 0.8rem;
    }
    
    .org-level {
        gap: 10px;
        margin-bottom: 12px;
    }
    
    .org-connector {
        height: 20px;
        margin: 0 auto 15px;
    }
    
    .authority-card {
        width: 92%;
        max-width: 230px;
        padding: 16px 12px 14px;
        border-radius: var(--border-radius-sm);
    }
    
    .authority-photo {
        width: 90px;
        height: 90px;
        border-width: 3px;
        margin-bottom: 10px;
    }
    
    .authority-name {
        font-size: 0.85rem;
    }
    
    .authority-position {
        font-size: 0.7rem;
        min-height: 35px;
    }
    
    .authority-level-badge {
        font-size: 0.5rem;
        padding: 1px 10px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 400px) {
    .authority-card {
        width: 95%;
        max-width: 200px;
        padding: 14px 10px 12px;
    }
    
    .authority-photo {
        width: 75px;
        height: 75px;
    }
    
    .authority-name {
        font-size: 0.8rem;
    }
    
    .authority-position {
        font-size: 0.65rem;
        min-height: 30px;
    }
}

/* ====== RESPONSIVE PARA EL ORGANIGRAMA EN ESCRITORIO ====== */
@media (min-width: 769px) {
    /* Niveles con múltiples tarjetas: distribución horizontal */
    .org-level {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 25px;
    }
    
    /* Ajuste para 5 tarjetas en una fila */
    .org-level .authority-card {
        flex: 0 0 auto;
    }
}

/* ====== RESPONSIVE PARA TABLETS EN HORIZONTAL ====== */
@media (min-width: 769px) and (max-width: 992px) {
    .org-level {
        gap: 18px;
    }
    
    .authority-card {
        width: 170px;
    }
}

/* ====== ESTILO PARA LAS LÍNEAS CONECTORAS HORIZONTALES ====== */
@media (min-width: 769px) {
    .org-level-horizontal {
        display: flex;
        justify-content: center;
        align-items: stretch;
        gap: 30px;
        flex-wrap: wrap;
    }
}