/* =========================================
   BIBLIOTECA DE EJERCICIOS — V3 Card Grid
   ========================================= */

/* CONTENEDOR PRINCIPAL */
.biblioteca-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.biblioteca-container .content {
    flex: 1;
    padding: clamp(16px, 4vw, 20px);
    padding-bottom: calc(80px + clamp(16px, 4vw, 20px) + env(safe-area-inset-bottom));
}

/* ===== SEARCH BOX ===== */
.biblioteca-container .search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 18px;
    padding: clamp(12px, 3vw, 14px) clamp(16px, 4vw, 18px);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    transition: all 0.25s ease;
    margin-bottom: 16px;
}

.biblioteca-container .search-box:focus-within {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.20);
}

.biblioteca-container .search-box svg {
    flex-shrink: 0;
    stroke: rgba(255, 255, 255, 0.5) !important;
    transition: all 0.25s;
}

.biblioteca-container .search-box:focus-within svg {
    stroke: white !important;
}

.biblioteca-container .search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 500;
    color: white !important;
    background: transparent !important;
    padding: 0 !important;
    width: auto !important;
    border-radius: 0 !important;
}

.biblioteca-container .search-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
    font-weight: 400;
}

/* ===== TABS ===== */
.tabs-container {
    display: flex;
    gap: clamp(6px, 1.5vw, 8px);
    overflow-x: auto;
    padding: 4px 0;
    margin: 12px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs-container::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: clamp(10px, 2.5vw, 12px) clamp(14px, 3.5vw, 18px);
    background: rgba(255, 255, 255, 0.10);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.75);
    font-size: clamp(12px, 3vw, 13px);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.22);
    color: white;
    border-color: rgba(255, 255, 255, 0.45);
}

.tab-badge {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    font-size: clamp(10px, 2.5vw, 11px);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
}

.tab-btn.active .tab-badge {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* ===== LISTA / GRID DE EJERCICIOS ===== */
.ejercicios-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* ===== CARD DE EJERCICIO ===== */
.ejercicio-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s ease;
}

.ejercicio-card:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.18);
}

/* ===== IMAGEN DE LA CARD ===== */
.ejercicio-card-image {
    width: 100%;
    aspect-ratio: 4/3;
    background: rgba(0, 0, 0, 0.15);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ejercicio-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== PLAY BUTTON OVERLAY ===== */
.card-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(229, 57, 53, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-play-btn svg {
    width: 20px;
    height: 20px;
    margin-left: 2px;
}

/* ===== VIDEO ICON (non-YouTube) ===== */
.card-video-icon {
    width: 48px;
    height: 48px;
    background: rgba(229, 57, 53, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-video-icon svg {
    width: 24px;
    height: 24px;
    opacity: 0.7;
}

/* ===== NO MEDIA PLACEHOLDER ===== */
.card-no-media svg {
    width: 36px;
    height: 36px;
}

/* ===== CARD BODY ===== */
.ejercicio-card-body {
    padding: 12px;
}

.ejercicio-card-name {
    font-size: 13px;
    font-weight: 700;
    color: white;
    line-height: 1.3;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ejercicio-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ===== BADGES ===== */
.card-badge {
    background: rgba(74, 123, 167, 0.4);
    color: rgba(255, 255, 255, 0.85);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

.card-badge-alt {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.65);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

/* ===== EMPTY STATE ===== */
.biblioteca-container .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(40px, 10vw, 60px) clamp(20px, 5vw, 30px);
    text-align: center;
}

.biblioteca-container .empty-icon {
    width: clamp(70px, 18vw, 90px);
    height: clamp(70px, 18vw, 90px);
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: clamp(18px, 4.5vw, 24px);
}

.biblioteca-container .empty-icon svg {
    width: 40%;
    height: 40%;
    stroke: rgba(255, 255, 255, 0.6);
}

.biblioteca-container .empty-text {
    font-size: clamp(14px, 3.5vw, 15px);
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    max-width: 280px;
}

.biblioteca-container .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: clamp(16px, 4vw, 20px);
    padding: clamp(10px, 2.5vw, 12px) clamp(18px, 4.5vw, 22px);
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    color: white;
    font-size: clamp(13px, 3.2vw, 14px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.biblioteca-container .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.4);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 360px) {
    .tabs-container {
        gap: 4px;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 11px;
    }

    .ejercicio-card-name {
        font-size: 12px;
    }
}
