*{margin: 0; padding: 0;}
body{
    background-color: #20537D;
    background-image: url(https://kamcit.com/public/about/background.png);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}
.btn-yellow { background-color: rgba(255, 234, 0, 1); color: #000000; border: 1px solid rgba(255, 234, 0, 1); }
.btn-yellow:hover{background-color: #016fa1; color: #FFFFFF; border: 1px solid #016fa1;}

.header{
    padding: 15px 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
    backdrop-filter: blur(1px);
}

/* Accordion */
.departments {
    display: flex;
    height: 100vh;
    overflow: hidden;
}
.dept-panel {
    flex: 1;
    position: relative;
    background-size: cover;
    background-position: center;
    border-right: 1px solid rgba(255,255,255,0.8);
    transition: flex 0.45s ease;
    cursor: pointer;
    overflow: hidden;
}
.dept-panel:last-child { border-right: none; }
.dept-panel:hover { flex: 5; }

.dept-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
    transition: background 0.3s, backdrop-filter 0.3s;
}
.dept-panel:hover .dept-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.7) 70%, rgba(0,0,0,0.35) 100%);
    backdrop-filter: blur(0px);
}
.departments:has(.dept-panel:hover) .dept-panel:not(:hover) .dept-overlay {
    backdrop-filter: blur(5px);
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.3) 100%);
}

/* Título colapsado (visible cuando el panel está cerrado) */
.dept-title-sm {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    z-index: 0;
    opacity: 1;
    transition: opacity 0.2s;
}
.dept-panel:hover .dept-title-sm { opacity: 0; }

/* Contenido expandido */
.dept-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 100px 28px 30px;
    color: #fff;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease 0.15s;
}
.dept-panel:hover .dept-content {
    opacity: 1;
    pointer-events: all;
}

.dept-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0 0 20px 0;
    white-space: nowrap;
}

.dept-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-width: 560px;
}

.dept-item {
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.25);
}
.dept-item:last-child { border-bottom: none; }

.dept-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 10px 13px 0;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 1rem;
    white-space: nowrap;
    transition: background 0.15s, padding 0.15s, color 0.15s;
}
.dept-link:hover { color: #fff; }

.dept-item:hover > .dept-link.has-sub {
    background: rgba(0,90,130,0.40);
    padding-left: 10px;
    padding-right: 10px;
}

.dept-chevron {
    font-size: 1rem;
    margin-left: 16px;
    flex-shrink: 0;
}

.btn-logout {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 234, 0,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: #FFFFFF;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
    backdrop-filter: blur(10px);
}
.btn-logout:hover {background: rgba(0, 107, 154,0.3);color: #FFFFFF;}

/* Submenu flotante */
.dept-submenu {
    position: fixed;
    min-width: 280px;
    background: rgba(0, 90, 130, 0.85);
    list-style: none;
    padding: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
    backdrop-filter: blur(2px);
}
.dept-item:hover > .dept-submenu {
    opacity: 1;
    pointer-events: all;
}

.dept-sublink {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    white-space: nowrap;
    transition: background 0.15s;
}
.dept-submenu li:last-child .dept-sublink{ border-bottom: none; }
.dept-sublink::before {
    content: '●';
    font-size: 0.5rem;
    flex-shrink: 0;
}
.dept-sublink:hover { background: rgba(255,255,255,0.08); }

/* Título rotado en paneles colapsados cuando alguno está abierto (solo desktop) */
@media (min-width: 992px) {
    .departments:has(.dept-panel:hover) .dept-panel:not(:hover) .dept-title-sm {
        bottom: auto;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(-90deg);
        font-size: 2rem;
        transition: opacity 0.1s, font-size 0.1s, transform 0.1s;
    }
}

/* ── Responsive: tablet y móvil ── */
@media (max-width: 991px) {
    .header-logo{
        width: 120px;
        position: relative;
        right: 60px;
    }
    .departments {
        flex-direction: column;
        height: 100vh;
    }
    .dept-panel {
        flex: 1;
        min-height: 56px;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.8);
    }
    .departments:not(:has(.dept-panel:hover)) .dept-panel:first-child {
        min-height: 160px;
    }
    .dept-panel:last-child { border-bottom: none; }
    .dept-panel:hover { flex: 6; }

    .dept-overlay {
        background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
    }
    .dept-panel:hover .dept-overlay {
        background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 100%);
    }

    .dept-title-sm {
        bottom: auto;
        left: 24px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 0.95rem;
    }

    .dept-content {
        flex-direction: column;
        padding: 20px 24px;
        overflow-y: auto;
    }

    .dept-title {
        font-size: 1.5rem;
        margin: 0 0 16px 0;
    }

    .dept-menu {
        max-width: 100%;
    }

    .dept-link {
        font-size: 0.9rem;
        padding: 10px 10px 10px 0;
    }

    .dept-submenu {
        min-width: 220px;
    }
}
