/* File: assets/css/lelib-list.css */

/* =========================================
   GRID SYSTEM (Responsive)
   ========================================= */
.tv-grid {
    display: grid;
    gap: 24px;
    padding: 0 !important;
}

.tv-grid.tv-latest-grid.tv-grid--three {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.tv-layout.is-collapsed .tv-grid.tv-latest-grid.tv-grid--three {
    grid-template-columns: repeat(4, 1fr);
}

@media (min-width: 769px) and (max-width: 1024px) {
    .tv-grid.tv-latest-grid.tv-grid--three {
        grid-template-columns: repeat(2, 1fr);
    }

    .tv-layout.is-collapsed .tv-grid.tv-latest-grid.tv-grid--three {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .tv-grid.tv-latest-grid.tv-grid--three {
        grid-template-columns: repeat(2, 1fr);
    }

    .tv-layout.is-collapsed .tv-grid.tv-latest-grid.tv-grid--three {
        grid-template-columns: repeat(2, 1fr);
    }

    .tv-toggle-open {
        display: inline-flex !important;
    }
}

@media (max-width: 599px) {

    .tv-grid.tv-latest-grid.tv-grid--three,
    .tv-layout.is-collapsed .tv-grid.tv-latest-grid.tv-grid--three {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   TOOLBAR (Top: Pagination + Sort + Filter Toggle)
   ========================================= */
.tv-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
    flex-wrap: wrap;
    gap: 12px;
}

.tv-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tv-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Nút mở Filter (Mobile) - Gọn gàng */
.tv-toggle-open {
    display: none;
    height: 32px;
    padding: 0 12px;
    border-radius: 99px;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 0.8rem;
    color: #4b5563;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

/* Hover: Nền xanh - Chữ trắng */
.tv-toggle-open:hover {
    background-color: var(--tv-accent);
    border-color: var(--tv-accent);
    color: #ffffff;
}

.tv-layout.is-collapsed .tv-toggle-open {
    display: inline-flex;
}

/* Sort Label & Select (Compact) */
.tv-sort-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    white-space: nowrap;
}

.tv-toolbar-right .tv-select--sm {
    height: 32px;
    font-size: 0.85rem;
    padding: 0 28px 0 10px;
    border-radius: 6px;
}

/* =========================================
   BOTTOM PAGINATION
   ========================================= */
.tv-pager--bottom {
    margin-top: 40px;
    justify-content: center;
    padding-top: 24px;
    border-top: 1px solid #f3f4f6;
}

/* =========================================
   LOADER (Fix z-index)
   ========================================= */
.tv-overlay-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);

    /* [CẬP NHẬT] Tăng z-index lên 200 để đè lên mọi element trong card (popup/nav) */
    z-index: 200;

    display: flex;
    justify-content: center;
    padding-top: 100px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
    pointer-events: none;
    backdrop-filter: blur(2px);
}

.tv-overlay-loader.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* =========================================
   TTS PLAY BUTTON (Global Search Popup)
   ========================================= */
.tv-match-play-tts {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    border: none;
    /* Living English Green Gradient */
    background: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
    color: #ffffff !important;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 1px;
    box-shadow: 0 4px 6px -1px rgba(22, 163, 74, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 0;
    outline: none;
}

.tv-match-play-tts:hover {
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 10px 15px -3px rgba(22, 163, 74, 0.3);
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
}

.tv-match-play-tts:active {
    transform: translateY(0) scale(0.95);
}

.tv-match-play-tts svg {
    width: 18px;
    height: 18px;
    margin-left: 2px;
    /* Visual centering for triangle */
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

.tv-match-play-tts.is-playing {
    background: #ef4444 !important;
    /* Clearly visible stop state */
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
    animation: thx-ec-lib-pulse-tts 1.5s infinite;
}

@keyframes thx-ec-lib-pulse-tts {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0px rgba(239, 68, 68, 0.4);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0px rgba(239, 68, 68, 0);
    }
}

/* Mobile Tweak */
@media (max-width: 640px) {
    .tv-match-content-row {
        gap: 8px !important;
    }

    .tv-match-play-tts {
        width: 36px;
        height: 36px;
    }
}