/* ==========================================================================
   UCALP Unified Internal Subnavigation Stylesheet
   Supports both horizontal and sidebar layouts, mobile drawer, and dynamic colors.
   ========================================================================== */

.ucalp-internal-subnav-wrapper,
.ucalp-carrera-subnav-wrapper {
    position: sticky;
    top: 0;
    z-index: 9999 !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02), 0 2px 4px -1px rgba(0,0,0,0.02);
    width: 100%;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --subnav-color: var(--faculty-color, var(--faculty-accent-color, #005EB8));
}

.ucalp-internal-subnav-wrapper--sidebar,
.ucalp-carrera-subnav-wrapper--sidebar {
    position: sticky !important;
    top: 110px !important;
    z-index: 20 !important;
    background: transparent !important;
    border: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    box-sizing: border-box;
}

.admin-bar .ucalp-internal-subnav-wrapper--sidebar,
.admin-bar .ucalp-carrera-subnav-wrapper--sidebar {
    top: 142px !important;
}

@media (max-width: 782px) {
    .admin-bar .ucalp-internal-subnav-wrapper--sidebar,
    .admin-bar .ucalp-carrera-subnav-wrapper--sidebar {
        top: 156px !important;
    }
}

.admin-bar .ucalp-internal-subnav-wrapper,
.admin-bar .ucalp-carrera-subnav-wrapper {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .ucalp-internal-subnav-wrapper,
    .admin-bar .ucalp-carrera-subnav-wrapper {
        top: 46px;
    }
}

.ucalp-internal-subnav,
.ucalp-carrera-subnav {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-sizing: border-box;
    background: #ffffff !important;
}

.ucalp-internal-subnav--sidebar,
.ucalp-carrera-subnav--sidebar {
    display: grid;
    gap: 20px;
    height: auto;
    max-width: none;
    padding: 0 !important;
    align-items: stretch;
    justify-content: stretch;
    background: transparent !important;
}

.ucalp-subnav-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 160px;
    max-width: 320px;
    flex: 1 1 auto;
}

.ucalp-subnav-dot {
    width: 8px;
    height: 8px;
    background-color: var(--subnav-color, #005EB8);
    border-radius: 50%;
    flex-shrink: 0;
}

.ucalp-subnav-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    letter-spacing: -0.01em;
}

.ucalp-internal-subnav-sidebar-head,
.ucalp-carrera-subnav-sidebar-head {
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.ucalp-internal-subnav-sidebar-kicker,
.ucalp-carrera-subnav-sidebar-kicker {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
}

.ucalp-subnav-center {
    background: #f1f5f9;
    padding: 4px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
    flex: 0 1 auto;
}

.ucalp-subnav-center--sidebar {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    display: block;
}

.ucalp-subnav-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2px;
}

.ucalp-subnav-list--sidebar,
.ucalp-subnav-list--drawer {
    display: grid;
    gap: 8px;
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ucalp-subnav-list--sidebar::before,
.ucalp-subnav-list--drawer::before {
    content: "";
    position: absolute;
    left: 21px;
    top: 16px;
    bottom: 16px;
    width: 1.5px;
    background: #e2e8f0;
    z-index: 1;
}

.ucalp-subnav-list li {
    margin: 0;
    padding: 0;
}

.ucalp-subnav-list a {
    display: inline-block;
    padding: 8px 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    border-radius: 9999px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    line-height: 1.25;
}

.ucalp-subnav-list--sidebar a,
.ucalp-subnav-list--drawer a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 38px;
    padding: 6px 8px;
    border-radius: 8px;
    color: #475569;
    white-space: normal;
    position: relative;
    z-index: 2;
    box-sizing: border-box;
    font-weight: 500;
    font-size: 13.5px;
    background: transparent;
    text-decoration: none;
    transition: all 0.2s ease;
}

.ucalp-subnav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    color: #94a3b8;
    transition: all 0.2s ease;
    z-index: 2;
    box-sizing: border-box;
    flex-shrink: 0;
}

.ucalp-subnav-icon svg {
    display: block;
    flex-shrink: 0;
    width: 14px !important;
    height: 14px !important;
}

.ucalp-subnav-list a:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.4);
}

.ucalp-subnav-list--sidebar a:hover,
.ucalp-subnav-list--drawer a:hover {
    background: #f8fafc;
    color: #0f172a;
}

.ucalp-subnav-list--sidebar a:hover .ucalp-subnav-icon,
.ucalp-subnav-list--drawer a:hover .ucalp-subnav-icon {
    border-color: #cbd5e1;
    color: #64748b;
}

.ucalp-subnav-list li.active a,
.ucalp-subnav-list li.current-menu-item a,
.ucalp-subnav-list li.current-post-parent a {
    background: var(--subnav-color, #005EB8) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.ucalp-subnav-list--sidebar li.active a,
.ucalp-subnav-list--drawer li.active a,
.ucalp-subnav-list--sidebar li.current-menu-item a,
.ucalp-subnav-list--drawer li.current-menu-item a {
    background: transparent !important;
    color: var(--subnav-color, #005EB8) !important;
    font-weight: 700 !important;
    box-shadow: none;
}

.ucalp-subnav-list--sidebar li.active .ucalp-subnav-icon,
.ucalp-subnav-list--drawer li.active .ucalp-subnav-icon,
.ucalp-subnav-list--sidebar li.current-menu-item .ucalp-subnav-icon,
.ucalp-subnav-list--drawer li.current-menu-item .ucalp-subnav-icon {
    background: var(--subnav-color, #005EB8) !important;
    border-color: var(--subnav-color, #005EB8) !important;
    color: #ffffff !important;
}

.ucalp-subnav-right {
    display: flex;
    justify-content: flex-end;
    min-width: 120px;
    flex: 0 1 auto;
}

.ucalp-subnav-right--sidebar {
    display: block;
    min-width: 0;
}

.ucalp-subnav-cta-card {
    display: grid;
    gap: 12px;
    padding: 20px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    box-sizing: border-box;
}

.ucalp-subnav-cta-card-icon {
    color: var(--subnav-color, #005EB8);
    background: rgba(0, 94, 184, 0.08);
    background: color-mix(in srgb, var(--subnav-color, #005EB8) 10%, transparent);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
    box-sizing: border-box;
}

.ucalp-subnav-cta-card strong {
    color: #0f172a;
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.25;
    display: block;
}

.ucalp-subnav-cta-card p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.4;
}

.ucalp-subnav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #ffffff !important;
    color: var(--subnav-color, #005EB8) !important;
    border: 1.5px solid var(--subnav-color, #005EB8) !important;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: none;
    margin-top: 8px;
    box-sizing: border-box;
}

.ucalp-subnav-btn:hover {
    background: var(--subnav-color, #005EB8) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--subnav-color, #005EB8) 20%, transparent);
}

.ucalp-subnav-btn svg {
    flex-shrink: 0;
}

.ucalp-internal-subnav-mobile-trigger-bar,
.ucalp-carrera-subnav-mobile-trigger-bar {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 9999px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
    height: 48px;
    padding: 0 4px;
    align-items: center;
    gap: 0;
    box-sizing: border-box;
    width: auto;
    max-width: 92%;
}

.ucalp-subnav-mobile-trigger-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px 0 16px;
    font-family: inherit;
    overflow: hidden;
    white-space: nowrap;
}

.ucalp-subnav-mobile-active-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    margin-top: 1px;
}

.ucalp-subnav-mobile-trigger-content .active-sec {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
    display: inline-block;
}

.ucalp-subnav-mobile-separator {
    width: 1px;
    height: 20px;
    background: #e2e8f0;
    flex-shrink: 0;
}

.ucalp-subnav-mobile-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent !important;
    border: none !important;
    color: var(--subnav-color, #005EB8) !important;
    padding: 0 16px 0 12px !important;
    height: 100%;
    font-size: 13px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    box-shadow: none !important;
    flex-shrink: 0;
    border-radius: 0 !important;
}

.ucalp-internal-subnav-mobile-drawer,
.ucalp-carrera-subnav-mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999 !important;
    visibility: hidden;
    pointer-events: none;
}

.ucalp-internal-subnav-mobile-drawer-backdrop,
.ucalp-carrera-subnav-mobile-drawer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.ucalp-internal-subnav-mobile-drawer-content,
.ucalp-carrera-subnav-mobile-drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 310px;
    height: 100%;
    background: #ffffff;
    box-shadow: -10px 0 30px rgba(15, 23, 42, 0.1);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.ucalp-internal-subnav-mobile-drawer-header,
.ucalp-carrera-subnav-mobile-drawer-header {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.ucalp-internal-subnav-mobile-drawer-header .title,
.ucalp-carrera-subnav-mobile-drawer-header .title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.ucalp-internal-subnav-mobile-drawer-header .close-btn,
.ucalp-carrera-subnav-mobile-drawer-header .close-btn {
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    cursor: pointer !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px !important;
    border-radius: 50% !important;
    box-shadow: none !important;
}

.ucalp-internal-subnav-mobile-drawer-header .close-btn:hover,
.ucalp-carrera-subnav-mobile-drawer-header .close-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

.ucalp-internal-subnav-mobile-drawer-body,
.ucalp-carrera-subnav-mobile-drawer-body {
    padding: 20px 16px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-sizing: border-box;
}

.ucalp-internal-subnav-mobile-drawer.is-open,
.ucalp-carrera-subnav-mobile-drawer.is-open {
    visibility: visible;
    pointer-events: auto;
}

.ucalp-internal-subnav-mobile-drawer.is-open .ucalp-internal-subnav-mobile-drawer-backdrop,
.ucalp-carrera-subnav-mobile-drawer.is-open .ucalp-carrera-subnav-mobile-drawer-backdrop {
    opacity: 1;
}

.ucalp-internal-subnav-mobile-drawer.is-open .ucalp-internal-subnav-mobile-drawer-content,
.ucalp-carrera-subnav-mobile-drawer.is-open .ucalp-carrera-subnav-mobile-drawer-content {
    transform: translateX(0);
}

.ucalp-subnav-list--drawer li {
    position: relative;
    z-index: 2;
}

.ucalp-subnav-mobile-drawer-cta {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

@media (max-width: 1024px) {
    .ucalp-subnav-left {
        display: none;
    }

    .ucalp-internal-subnav,
    .ucalp-carrera-subnav {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .ucalp-internal-subnav-wrapper--sidebar,
    .ucalp-carrera-subnav-wrapper--sidebar {
        position: static !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        margin: 0 !important;
        width: auto !important;
        height: auto !important;
    }

    .ucalp-internal-subnav--sidebar,
    .ucalp-carrera-subnav--sidebar {
        display: none !important;
    }

    .ucalp-internal-subnav-mobile-trigger-bar,
    .ucalp-carrera-subnav-mobile-trigger-bar {
        display: flex !important;
    }
}

/* Faculty layout specific scrolling (horizontal subnav without full wrappers) */
.ucalp-facultad-subnav-wrapper {
    background: #ffffff;
    border-bottom: 1px solid #d1d1c7;
    position: sticky;
    top: 72px;
    z-index: 10;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.admin-bar .ucalp-facultad-subnav-wrapper {
    top: 104px;
}

@media (max-width: 782px) {
    .admin-bar .ucalp-facultad-subnav-wrapper {
        top: 118px;
    }
}

.ucalp-subnav-shell {
    max-width: 1280px;
    margin-inline: auto;
    padding-inline: clamp(16px, 4vw, 48px);
}

.ucalp-subnav-facultad-container {
    display: block;
}

.ucalp-subnav-facultad {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 52px;
    gap: clamp(1rem, 2.5vw, 2.5rem);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ucalp-subnav-facultad::-webkit-scrollbar {
    display: none;
}

.ucalp-subnav-facultad li {
    height: 100%;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.ucalp-subnav-facultad a {
    display: inline-flex;
    align-items: center;
    height: 100%;
    padding-inline: 4px;
    color: #555555;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    position: relative;
    transition: color 150ms cubic-bezier(.16, 1, .3, 1);
    white-space: nowrap;
}

.ucalp-subnav-facultad a:hover {
    color: var(--faculty-accent-color, #005EB8);
}

.ucalp-subnav-facultad li.current-menu-item a,
.ucalp-subnav-facultad li.current-post-parent a,
.ucalp-subnav-facultad a.is-active {
    color: var(--faculty-accent-color, #005EB8);
    font-weight: 700;
}

.ucalp-subnav-facultad li.current-menu-item a::after,
.ucalp-subnav-facultad li.current-post-parent a::after,
.ucalp-subnav-facultad a.is-active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--faculty-accent-color, #005EB8);
    border-radius: 3px 3px 0 0;
}
