/* ─────────────────────────────────────────────
   COLORES
───────────────────────────────────────────── */
.app-videoteca {
    --primary-color: #143765;
    --primary-light: #4d7ab0;
    --secondary-color: #0098ff;
    --secondary-light: #a8b5c8;
    --text-color: #071c36;
    --text-muted: #6e82a0;
    --surface-color: #ffffff;
    --surface-alt-color: #f4f6fa;
    --hover-background-color: #e8eef7;
    --border-color: #d0d8e4;
    --border-light: #edf0f5;
    --shadow-sm: 0 1px 3px 0 rgba(7, 28, 54, 0.1), 0 1px 2px -1px rgba(7, 28, 54, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(7, 28, 54, 0.1), 0 2px 4px -2px rgba(7, 28, 54, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(7, 28, 54, 0.1), 0 4px 6px -4px rgba(7, 28, 54, 0.1);
}



/* ─────────────────────────────────────────────
   LAYOUT PRINCIPAL
───────────────────────────────────────────── */
.app-videoteca {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    align-items: start;
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.5rem;
}

.app-videoteca__year-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--hover-background-color);
    color: var(--secondary-color) !important;
    font-size: 0.7rem;
    font-weight: 700;
}

.app-videoteca__loading,
.app-videoteca__error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* ─────────────────────────────────────────────
   SIDEBAR
───────────────────────────────────────────── */
.app-videoteca__sidebar-inner {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
}

.app-videoteca__sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding: 0 0.5rem;
}

.app-videoteca__sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.app-videoteca__sidebar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}

.app-videoteca__sidebar-item:hover {
    background: var(--hover-background-color);
}

.app-videoteca__sidebar-item--active {
    background: var(--secondary-color);
    color: #fff;
}

.app-videoteca__sidebar-item--active .app-videoteca__year-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff !important;
}

/* ─────────────────────────────────────────────
   ÁREA PRINCIPAL
───────────────────────────────────────────── */
.app-videoteca__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header */
.app-videoteca__header {
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-color);
    border-radius: 0.75rem 0.75rem 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.app-videoteca__overline {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.5rem;
}

.app-videoteca__overline::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--secondary-color);
    box-shadow: 0 0 8px var(--secondary-color);
    display: block;
}

.app-videoteca__page-title {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.2;
}

.app-videoteca__page-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* ─────────────────────────────────────────────
   PLAYER ACTIVO
───────────────────────────────────────────── */
.app-videoteca__player-wrap {
    background: var(--primary-color);
    border-radius: 0.75rem;
    margin-top: 1rem;
    overflow: hidden;
}

.app-videoteca__player-wrap--hidden {
    display: none;
}

.app-videoteca__player-inner {
    padding: 1.5rem;
}

.app-videoteca__player-iframe-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #000;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.25rem;
}

.app-videoteca__player-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.app-videoteca__player-meta {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    align-items: start;
}

.app-videoteca__player-badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--secondary-light);
    margin-bottom: 0.6rem;
}

.app-videoteca__player-title {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 0.6rem;
}

.app-videoteca__player-desc {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    max-width: 580px;
}

.app-videoteca__player-desc--hidden {
    display: none;
}

.app-videoteca__player-close {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 0.5rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    cursor: pointer;
}

.app-videoteca__player-close:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.app-videoteca__player-close svg {
    width: 14px;
    height: 14px;
}

/* ─────────────────────────────────────────────
   CONTENIDO
───────────────────────────────────────────── */
.app-videoteca__content {
    padding: 1.5rem 0;
}

.app-videoteca__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.1rem;
}

/* ─────────────────────────────────────────────
   VIDEO CARD
───────────────────────────────────────────── */
.app-videoteca__card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: border-color 0.25s, box-shadow 0.3s, transform 0.25s;
    text-decoration: none;
    color: inherit;
}

.app-videoteca__card:hover {
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.app-videoteca__card--active {
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-md);
}

.app-videoteca__card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.app-videoteca__card-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #143765;
}

.app-videoteca__card-thumb-placeholder::before {
    content: '';
    position: absolute;
    right: -30px;
    top: -30px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(77, 122, 176, 0.15);
    pointer-events: none;
}

.app-videoteca__card-thumb-placeholder::after {
    content: '';
    position: absolute;
    left: -20px;
    bottom: -40px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(0, 152, 255, 0.08);
    pointer-events: none;
}

.app-videoteca__card-ph-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 1;
}

.app-videoteca__card-ph-skip {
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-videoteca__card-ph-skip svg {
    width: 24px;
    height: 24px;
    color: rgba(255, 255, 255, 0.25);
}

.app-videoteca__card-ph-logo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    opacity: 0.5;
    z-index: 1;
}

.app-videoteca__card-ph-title {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 12px;
    text-align: center;
    padding: 0 1.5rem;
    max-width: 90%;
    line-height: 1.4;
    z-index: 1;
    color: rgba(255, 255, 255, 0.4);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-videoteca__card-ph-sub {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 4px;
    z-index: 1;
}

.app-videoteca__card-ph-corner {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1;
}

.app-videoteca__card-ph-corner span {
    display: block;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 3px;
}

.app-videoteca__card-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 26, 51, 0.35);
    opacity: 0;
    transition: opacity 0.25s;
}

.app-videoteca__card:hover .app-videoteca__card-play,
.app-videoteca__card--active .app-videoteca__card-play {
    opacity: 1;
}

.app-videoteca__card-play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--secondary-color);
    box-shadow: 0 0 0 8px rgba(0, 152, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.app-videoteca__card:hover .app-videoteca__card-play-btn {
    transform: scale(1.08);
}

.app-videoteca__card-play-btn svg {
    width: 16px;
    height: 16px;
    color: #fff;
    margin-left: 2px;
}

.app-videoteca__card-now-playing {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    background: var(--secondary-color);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    display: none;
    align-items: center;
    gap: 0.3rem;
}

.app-videoteca__card--active .app-videoteca__card-now-playing {
    display: flex;
}

.app-videoteca__card-body {
    padding: 1rem 1.1rem 1.1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.app-videoteca__card-session {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--secondary-color);
    margin-bottom: 0.35rem;
}

.app-videoteca__card-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.35;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-videoteca__card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.app-videoteca__card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
}

.app-videoteca__card-year {
    font-size: 0.75rem;
    color: var(--text-muted) !important;
    font-weight: 600;
}

.app-videoteca__card-cta {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary-color) !important;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.app-videoteca__card-cta svg {
    width: 12px;
    height: 12px;
}

/* ─────────────────────────────────────────────
   EMPTY STATE
───────────────────────────────────────────── */
.app-videoteca__empty {
    padding: 4rem 2rem;
    text-align: center;
}

.app-videoteca__empty--hidden {
    display: none;
}

.app-videoteca__empty svg {
    width: 48px;
    height: 48px;
    color: var(--border-color);
    margin: 0 auto 1rem;
}

.app-videoteca__empty p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ─────────────────────────────────────────────
   PAGINACIÓN
───────────────────────────────────────────── */
.app-videoteca__pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin-top: 2rem;
}

.app-videoteca__pagination-group {
    display: inline-flex;
    align-items: center;
    border-radius: 0.65rem;
    overflow: hidden;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.app-videoteca__pagination-btn {
    width: 2.8rem;
    height: 2.8rem;
    border: none;
    background: var(--surface-color);
    color: var(--primary-color);
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.app-videoteca__pagination-btn:hover {
    background: var(--hover-background-color);
}

.app-videoteca__pagination-btn--disabled {
    color: var(--border-color);
    cursor: default;
    pointer-events: none;
}

.app-videoteca__pagination-btn svg {
    pointer-events: none;
}

.app-videoteca__pagination-current {
    height: 2.8rem;
    padding: 0 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 0.06em;
    user-select: none;
    white-space: nowrap;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.app-videoteca__pagination-info {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.04em;
}

@media (max-width: 768px) {
    .app-videoteca__pagination-btn {
        width: 2.5rem;
        height: 2.5rem;
    }

    .app-videoteca__pagination-current {
        height: 2.5rem;
        padding: 0 1rem;
        font-size: 0.8rem;
    }
}

/* ─────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .app-videoteca {
        grid-template-columns: 220px 1fr;
    }
}

@media (max-width: 768px) {
    .app-videoteca {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }

    .app-videoteca__header {
        padding: 1.25rem 1rem 1rem;
        align-items: flex-start;
    }

    .app-videoteca__grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .app-videoteca__sidebar-inner {
        border-radius: 0.5rem;
    }

    .app-videoteca__sidebar-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .app-videoteca__sidebar-item {
        padding: 0.4rem 0.65rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .app-videoteca__grid {
        grid-template-columns: 1fr;
    }
}