/* ===== HEADER ===== */

.itaka-header {
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-bottom: 1px solid #7e7979;
    padding-top: 25px;
    padding-bottom: 25px;
}

.itaka-header-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
}

/* Logo escala suavemente con el viewport */
.itaka-header-logo {
    height: clamp(80px, 8vw, 150px);
    width: auto;
}

.itaka-header-text h5 {
    color: #000;
    font-size: clamp(1.8rem, 2.8vw, 3.5rem);
    font-weight: bold;
    text-shadow: 1px 1px 1px #801b1b;
    margin: 0;
}

.itaka-header-text span {
    display: block;
    font-size: 1rem;
    font-weight: bold;
    color: #000000;
}

/* ===== LAYOUT GENERAL ===== */

p, ul {
    line-height: 1.6;
    text-align: justify;
}

h1, h2, h3, h4 {
    font-weight: bold !important;
    color: #A62424 !important;
}

/* Usar mejor el espacio horizontal en pantallas grandes */
.container,
.container-lg,
.container-xl,
.container-xxl {
    max-width: min(92vw, 1500px) !important;
}

/* ===== NAVBAR ===== */

.navbar {
    position: relative;
    z-index: 10000;
}

.navbar-itaka {
    background-color: #A62424;
}

a.nav-link, a.navbar-brand {
    color: white;
    font-weight: bold;
    font-size: 1rem;
}

/* Centrar los ítems y dejar que escalen */
.navbar-itaka .navbar-collapse .navbar-nav {
    width: 100%;
    justify-content: center;
    flex-wrap: nowrap;
}

/* Tamaño base de los nav-link en desktop (≥ 1200 px) */
.navbar-nav .nav-link {
    white-space: nowrap;
    padding-left: clamp(4px, 0.6vw, 14px) !important;
    padding-right: clamp(4px, 0.6vw, 14px) !important;
    font-size: clamp(0.78rem, 0.85vw, 0.97rem);
}

/* Hover dropdown */
.itaka-hover-dropdown:hover .dropdown-menu {
    display: block;
    margin-top: 0;
}

/* ===== CARDS ===== */
.card {
    border: 1px solid #A62424;
    border-radius: 8px;
    box-shadow: 0 4px 7px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.card-img, .card-logo {
    width: 100%;
    padding: 10px;
    text-align: center;
}

.card-logo img {
    width: 100%;
    max-width: 200px;
    max-height: 150px;
    object-fit: contain;
}

.card-img img {
    max-width: 100%;
    height: auto;
    display: block;
}

.card-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #A62424;
}

.card-header a {
    color: #A62424;
    text-decoration: none;
    transition: color 0.3s ease;
}

.card-header a:hover {
    text-decoration: underline;
    color: #801b1b;
}

.card-body {
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: justify;
    color: #333;
}

/* ===== TABLES ===== */

.itaka-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 7px rgba(0,0,0,0.1);
    overflow: hidden;
}

.itaka-table thead {
    background-color: #A62424;
    color: #ffffff;
}

.itaka-table th {
    padding: 15px;
    text-align: left;
    font-weight: bold;
    font-size: 1.1rem;
}

.itaka-table td {
    padding: 12px 15px;
    color: #333;
}

.itaka-table th:not(:last-child) {
    border-right: 1px solid #801b1b;
}

.itaka-table td:not(:last-child) {
    border-right: 1px solid #e5e5e5;
}

.itaka-table tbody tr:not(:last-child) td {
    border-bottom: 1px solid #e5e5e5;
}

.itaka-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.itaka-table a.itaka-table-link {
    color: #A62424;
    text-decoration: underline;
}

/* ===== PAGINATION ===== */

.pagination .page-link {
    color: #A62424;
    border-color: #dee2e6;
}

.pagination .page-link:hover {
    color: #801b1b;
    background-color: #fceaea;
    border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: #A62424;
    border-color: #A62424;
    color: #ffffff;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(166, 36, 36, 0.2);
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #fff;
    border-color: #dee2e6;
}

/* ===== TABS ===== */

.nav-pills {
    gap: 10px;
    flex-wrap: wrap;
}

.nav-pills .nav-link {
    color: #A62424;
    background-color: #ffffff;
    border: 1px solid #A62424;
    border-radius: 6px;
    font-weight: bold;
    transition: all 0.3s ease;
    padding: 10px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.nav-pills .nav-link:hover {
    background-color: #fceaea;
    color: #801b1b;
}

.nav-pills .nav-link.active {
    background-color: #A62424 !important;
    color: #ffffff !important;
    border-color: #A62424;
    box-shadow: 0 4px 8px rgba(166, 36, 36, 0.2);
}

/* ===== NEWS ===== */

/* Panel lateral en desktop: sin altura fija, sin scroll */
.itaka-news {
    background-color: #ffffff;
    border-left: 4px solid #A62424;
    overflow: hidden;
}

.itaka-news > div {
    flex: 1;
    overflow: visible;
}

/* Carousel: contener todo dentro, sin scrollbar */
#newsCarousel {
    overflow: hidden;
    max-width: 100%;
}

#newsCarousel .carousel-inner {
    overflow: hidden;
}

/* Dots: tamaño via CSS, sin inline styles */
.carousel-indicators button {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    margin: 0 4px !important;
    padding: 0 !important;
    flex-shrink: 0;
}

/* Fila de controles del carousel */
.carousel-controls-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    overflow: hidden;
}

.carousel-controls-row .carousel-indicators {
    position: static;
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}

.carousel-ctrl-btn {
    text-decoration: none;
    flex-shrink: 0;
}

.carousel-ctrl-icon {
    font-size: 1.1rem;
    font-weight: bold;
}

.itaka-news h4 {
    color: #A62424;
}

/* ===== FOOTER ===== */

.footer {
    border-top: 1px solid #e5e5e5;
    padding: 15px 0;
    font-size: 13px;
    color: #777;
    background-color: #fff;
    width: 100%;
}

.footer div {
    padding: 0 15px;
    text-align: right;
}

/* ===== MEMBERS ===== */

.itaka-members-sidebar {
    top: 70px !important;
    background-color: #ffffff;
    z-index: 2;
    padding: 15px;
    border: 1px solid #e5e5e5;
    transition: top 0.3s ease;
}

.itaka-members .nav-link {
    color: #333 !important;
    font-weight: 500;
    padding: 10px 15px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.itaka-members .nav-link:hover {
    color: #A62424 !important;
    background-color: #f8f9fa;
    border-left: 3px solid #A62424;
}

.itaka-members .nav-link.active {
    color: #A62424 !important;
    font-weight: bold;
    border-left: 3px solid #A62424;
    background-color: #fff5f5;
}

.member-section {
    scroll-margin-top: 50px;
}

.coordinator-name {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0;
}

.coordinator-link {
    color: #000000;
    text-decoration: none;
    transition: color 0.3s ease;
}

.coordinator-link:hover {
    color: #801b1b;
}

.compact-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
}

.compact-avatar i {
    font-size: 1.2rem;
}

.compact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-links {
    gap: 12px;
}

.link-icon {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.academic-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.link-icon:hover {
    transform: scale(1.1);
}

.link-icon-gray img {
    width: 18px;
    height: 18px;
    filter: grayscale(1);
    transition: all 0.3s ease;
}

/* ===== THESIS ===== */

.thesis-card {
    border-left: 4px solid #A62424;
    background-color: #f8f9fa;
}

/* ===== HIGHLIGHT ===== */

.itaka-high {
    color: #801b1b !important;
    text-decoration: none;
    transition: color 0.3s ease;
}

a.itaka-high:hover {
    color: #A62424 !important;
    text-decoration: underline;
}

/* ===== BUTTONS ===== */

.btn-itaka {
    background-color: #A62424 !important;
    color: #ffffff !important;
    font-weight: bold;
}

.btn-itaka:hover {
    background-color: #801b1b !important;
    color: #ffffff !important;
    outline: none;
    box-shadow: none;
}

/* ===== IFRAME ===== */

.iframe-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
}

.iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ===== SCROLL UP ===== */
#btn-scroll-top {
    position: fixed;
    bottom: 30px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: rgba(166, 36, 36, 0.3);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#btn-scroll-top:hover {
    background-color: rgba(166, 36, 36, 0.9);
    transform: scale(1.1);
}

#btn-scroll-top.show {
    opacity: 1;
    visibility: visible;
}

/* ===== PUBLICATIONS ===== */

#filter-section {
    transition: all 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
    width: 100%;
}

.filter-initial {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    background: radial-gradient(circle at top, #ffffff 0%, #ffffff 100%);
    border-radius: 1rem;
    padding: 2rem 1rem 2.5rem;
    text-align: left;
}

.filter-initial .hero-badge {
    background-color: #ffffff;
    color: #A62424;
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    display: inline-block;
    border: 1px solid rgba(166, 36, 36, 0.15);
}

.filter-initial .filter-card {
    border: none;
    border-top: 5px solid #A62424;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.06), 0 5px 15px rgba(166,36,36,0.04) !important;
    width: 100%;
    margin-top: 1.5rem;
    text-align: left;
}

.filter-initial .filter-card .card-body {
    padding: 2.8rem !important;
}

.filter-initial .filter-label-text {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #2c3e50 !important;
}

.filter-initial #btn-search {
    font-size: 1.1rem;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
}

.filter-active {
    min-height: auto;
    display: block;
    margin-top: 0;
    background: transparent;
    padding: 0;
    text-align: left;
}

.filter-active .hero-badge,
.filter-active .hero-subtitle {
    display: none !important;
}

.filter-active .filter-card {
    border: 1px solid #eaeaea;
    border-left: 4px solid #A62424;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04) !important;
    margin-bottom: 1.6rem;
}

.filter-active .filter-card .card-body {
    padding: 0.85rem 1.2rem !important;
}

.filter-active #filter-title {
    display: none !important;
}

.filter-active .row.g-4 {
    --bs-gutter-y: 0.5rem;
}

.custom-square-checkbox {
    display: flex;
    align-items: center;
}

.custom-square-checkbox .form-check-input {
    border-radius: 4px !important;
    border: 2px solid #A62424;
    width: 1.3rem;
    height: 1.3rem;
    margin-top: 0;
    cursor: pointer;
    box-shadow: none !important;
}

.custom-square-checkbox .form-check-input:checked {
    background-color: #A62424;
    border-color: #A62424;
}

.custom-square-checkbox .form-check-label {
    cursor: pointer;
    color: #333;
    margin-left: 0.4rem;
    font-size: 0.95rem;
}

.tag-dropdown-menu {
    min-width: 280px;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}

#tag-options-container {
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
    margin-bottom: 5px;
}

.tag-option-item {
    padding: 8px 10px !important;
    border-radius: 4px;
    transition: background 0.15s;
    align-items: flex-start !important;
    min-height: fit-content;
}

.tag-option-item:hover { background-color: #fceaea; }

.tag-option-item .tag-checkbox {
    margin-top: 0.25rem;
    margin-left: 0 !important;
    flex-shrink: 0 !important;
    width: 1.1em;
    height: 1.1em;
}

.tag-label-text {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal !important;
    line-height: 1.4;
    display: block;
    width: 100%;
}

.tag-checkbox:checked + .tag-label-text {
    color: #A62424;
    font-weight: bold;
}

.active-tag-badge {
    background-color: #fceaea;
    color: #A62424;
    border: 1px solid #A62424;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    user-select: none;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    text-align: left;
    line-height: 1.3;
}

.active-tag-badge .btn-close-tag {
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    line-height: 1;
    color: #A62424;
    flex-shrink: 0;
}

#active-tags-container:empty {
    display: none !important;
}

#results-section {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.pub-card {
    border-left: 3px solid #A62424;
    box-shadow: 0 4px 16px rgba(166,36,36,0.08) !important;
}

.pub-tag-chip {
    background: #fceaea;
    color: #A62424;
    border: 1px solid #f0b8b8;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    cursor: default;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
    display: inline-block;
}

.pub-card .card-body p {
    text-align: justify;
}

.pub-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    background: #A62424;
    color: #ffffff;
    margin-bottom: 1.25rem;
    user-select: none;
    transition: background-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(166, 36, 36, 0.2);
}

.pub-category-header:hover {
    background: #801b1b;
    box-shadow: 0 6px 14px rgba(166, 36, 36, 0.3);
}

.pub-category-title {
    font-weight: 700;
    font-size: 1.6rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    letter-spacing: -0.01em;
}

.pub-category-title i {
    font-size: 1.5rem;
    opacity: 0.9;
}

.pub-category-count {
    font-size: 0.85rem;
    background: #ffffff;
    color: #A62424;
    border-radius: 20px;
    padding: 3px 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.pub-category-chevron {
    font-size: 1.3rem;
    color: #ffffff;
    opacity: 0.9;
    transition: transform 0.25s ease;
}

.pub-category-header.collapsed .pub-category-chevron {
    transform: rotate(-90deg);
}

.pub-category-body {
    margin-bottom: 1.75rem;
}

#empty-state {
    display: none;
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
}

/* ============================================================ */
/*  RESPONSIVE — mobile/tablet  (< 1200 px = hamburger)        */
/* ============================================================ */

@media (max-width: 1199px) {

    /* Header logo se oculta (Bootstrap d-none d-xl-block ya lo hace,
       pero lo dejamos aquí de respaldo) */
    .itaka-header {
        display: none !important;
    }

    /* Marca móvil en la navbar */
    .navbar-brand-mobile {
        display: block !important;
        white-space: normal;
        font-size: 1.1rem;
        line-height: 1.2;
        max-width: calc(100% - 70px);
        word-wrap: break-word;
    }

    /* Nav-links en menú desplegable: tamaño legible */
    .navbar-nav .nav-link {
        font-size: 1rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        white-space: normal;
    }

    /* Cards */
    .card-logo img {
        max-width: 150px;
        max-height: 125px;
    }

    /* Tablas scrollables en horizontal */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 30px;
        border-radius: 8px;
    }

    .table-responsive .itaka-table {
        margin-bottom: 0;
    }

    /* Botón flotante para abrir el panel de noticias */
    #btn-toggle-news {
        display: flex !important;
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        background-color: #A62424;
        color: white;
        border: none;
        border-radius: 8px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.3);
        font-size: 24px;
        z-index: 1050;
        cursor: pointer;
        justify-content: center;
        align-items: center;
        padding: 0;
    }

    /* Panel de noticias: drawer lateral con scroll interno */
    .itaka-news {
        position: fixed !important;
        top: 0;
        right: -100%;
        width: 320px;
        max-width: 85vw;
        height: 100vh !important;
        overflow-y: auto !important;   /* scroll dentro del drawer */
        overflow-x: hidden;
        z-index: 1040;
        transition: right 0.4s ease-in-out;
        box-shadow: -4px 0 15px rgba(0,0,0,0.2);
    }

    .itaka-news.open {
        right: 0 !important;
    }

    /* Iframe ocupa todo el ancho */
    .iframe-container {
        width: 100%;
    }

    /* Botón scroll-up sube para no tapar el botón de noticias */
    #btn-scroll-top {
        bottom: 85px !important;
        width: 35px;
        height: 35px;
        font-size: 1rem;
        background-color: rgba(166, 36, 36, 0.5);
    }

    /* Publicaciones: título de categoría más compacto */
    .pub-category-title {
        font-size: 1.2rem;
    }
}

/* ============================================================ */
/*  Tablets en landscape / pantallas medianas (768 – 1199 px)   */
/* ============================================================ */

@media (min-width: 768px) and (max-width: 1199px) {
    .container,
    .container-md,
    .container-lg {
        max-width: 96vw !important;
    }
}

/* ============================================================ */
/*  Móviles pequeños (< 576 px)                                 */
/* ============================================================ */

@media (max-width: 575px) {
    /* Texto de tabs más compacto */
    .nav-pills .nav-link {
        padding: 8px 12px;
        font-size: 0.88rem;
    }

    /* Paginación compacta */
    .pagination .page-link {
        padding: 0.3rem 0.55rem;
        font-size: 0.85rem;
    }

    /* Encabezados de publicaciones */
    .pub-category-title {
        font-size: 1rem;
        gap: 0.4rem;
    }

    .pub-category-header {
        padding: 0.75rem 1rem;
    }
}

/* ===== THESIS BADGES (TFM / TFG / PFC-CST / PFC-CSH) ===== */

.thesis-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-tfm {
    background-color: #fceaea;
    color: #A62424;
    border: 1px solid #f0b8b8;
}

.badge-tfg {
    background-color: #e8f0fe;
    color: #1a56a0;
    border: 1px solid #b3c9f5;
}

/* CSH — Higher degree (EI, 5y): amber/gold */
.badge-pfc-csh {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* CST — Technical degree (ETIS/ETIG, 3y): neutral grey */
.badge-pfc-cst {
    background-color: #f3f4f6;
    color: #555;
    border: 1px solid #d1d5db;
}

.thesis-legend {
    font-size: 0.9rem;
    color: #555;
    line-height: 2;
}

.thesis-table-caption {
    caption-side: top;
    font-weight: 700;
    color: #A62424;
    font-size: 1rem;
    padding: 0.5rem 0 0.4rem;
    text-align: left;
}