/**
 * WAW TikTok Frontend Styles
 * Proporcje 9:16, estetyka TikToka, responsywna siatka i Lightbox
 */

.waw-tiktok-container {
    width: 100%;
    margin: 28px 0 10px 0 !important;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.waw-tiktok-container p:empty,
.waw-tiktok-container br,
.waw-tiktok-grid > p,
.waw-tiktok-grid > br {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.waw-tiktok-header {
    margin-bottom: 8px;
    text-align: center;
}

.waw-tiktok-main-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: inherit;
}

/* SIATKA MINIATUR 9:16 */
.waw-tiktok-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: max-content;
    align-items: start;
    align-content: start;
    gap: 14px;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .waw-tiktok-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 10px;
    }
}

/* WERSJA MOBILNA: DOKŁADNIE 3 FILMY W JEDNYM RZĘDZIE */
@media (max-width: 640px) {
    .waw-tiktok-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }

    /* Ukrycie 4, 5 i kolejnych filmów na telefonach */
    .waw-tiktok-card:nth-child(n+4) {
        display: none !important;
    }

    .waw-tiktok-card-title {
        font-size: 0.75rem !important;
        -webkit-line-clamp: 2 !important;
    }

    .waw-tiktok-play-icon {
        width: 36px !important;
        height: 36px !important;
    }

    .waw-tiktok-play-icon svg {
        width: 24px !important;
        height: 24px !important;
    }
}

/* POJEDYNCZY KAFELEK 9:16 */
.waw-tiktok-card {
    position: relative;
    aspect-ratio: 9 / 16;
    border-radius: 12px;
    overflow: hidden;
    background-color: #121212;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
    user-select: none;
    outline: none;
}

.waw-tiktok-card:hover,
.waw-tiktok-card:focus-visible {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(254, 44, 85, 0.3);
}

.waw-tiktok-thumb-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.waw-tiktok-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.waw-tiktok-card:hover .waw-tiktok-thumb {
    transform: scale(1.05);
}

.waw-tiktok-placeholder-thumb {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #111 0%, #222 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-weight: 600;
}

/* OVERLAY Z IKONĄ PLAY I OPISEM */
.waw-tiktok-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.05) 0%,
        rgba(0, 0, 0, 0.2) 45%,
        rgba(0, 0, 0, 0.85) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    box-sizing: border-box;
}

.waw-tiktok-play-icon {
    align-self: center;
    margin-top: auto;
    margin-bottom: auto;
    color: #ffffff;
    opacity: 0.9;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.waw-tiktok-card:hover .waw-tiktok-play-icon {
    transform: scale(1.12);
    opacity: 1;
    background: rgba(254, 44, 85, 0.9);
}

.waw-tiktok-card-info {
    margin-top: auto;
    margin-bottom: 0;
    width: 100%;
}

.waw-tiktok-card-title {
    color: #ffffff !important;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 !important;
    padding: 0 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.waw-tiktok-author-tag {
    display: none !important;
}

/* ===================================================
   NOWOCZESNY, ELEGANCKI PRZYCISK OBSERWOWANIA (CTA)
   =================================================== */

.waw-tiktok-footer-cta {
    text-align: center;
    margin: 14px 0 0 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}

.waw-tiktok-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 20px;
    background: #15171e;
    color: #ffffff !important;
    font-weight: 600;
    font-size: 0.90rem;
    text-decoration: none !important;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
    transition: all 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap !important;
    max-width: 100%;
}

.waw-tiktok-cta-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(37, 244, 238, 0.12) 0%, rgba(254, 44, 85, 0.15) 100%);
    opacity: 0;
    transition: opacity 0.24s ease;
    border-radius: 50px;
}

.waw-tiktok-cta-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(254, 44, 85, 0.45);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), 0 0 12px rgba(254, 44, 85, 0.25);
    color: #ffffff !important;
}

.waw-tiktok-cta-btn:hover::before {
    opacity: 1;
}

.waw-tiktok-cta-icon {
    display: inline-flex;
    align-items: center;
    position: relative;
    z-index: 1;
    color: #fe2c55;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(254, 44, 85, 0.6));
}

.waw-tiktok-cta-text {
    position: relative;
    z-index: 1;
    letter-spacing: -0.01em;
    white-space: nowrap !important;
    line-height: 1.2;
}

.waw-tiktok-cta-badge {
    position: relative;
    z-index: 1;
    background: linear-gradient(90deg, #fe2c55, #ff0050);
    color: #fff;
    font-size: 0.70rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
    margin-left: 2px;
    box-shadow: 0 2px 6px rgba(254, 44, 85, 0.4);
    white-space: nowrap !important;
    flex-shrink: 0;
    line-height: 1.2;
}

@media (max-width: 640px) {
    .waw-tiktok-cta-btn {
        padding: 7px 14px !important;
        font-size: 0.78rem !important;
        gap: 6px !important;
    }

    .waw-tiktok-cta-text {
        font-size: 0.78rem !important;
    }

    .waw-tiktok-cta-badge {
        font-size: 0.65rem !important;
        padding: 2px 6px !important;
    }
}

/* ===================================================
   LIGHTBOX MODAL (TYLKO DLA DESKTOP)
   =================================================== */

.waw-tiktok-lightbox-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(10px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    box-sizing: border-box;
    padding: 20px;
}

.waw-tiktok-lightbox-backdrop.waw-active {
    opacity: 1;
    visibility: visible;
}

.waw-tiktok-modal {
    position: relative;
    background: #121212;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.waw-tiktok-lightbox-backdrop.waw-active .waw-tiktok-modal {
    transform: scale(1);
}

/* PRZYCISK ZAMKNIĘCIA */
.waw-tiktok-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s ease, transform 0.2s ease;
}

.waw-tiktok-modal-close:hover {
    background: #fe2c55;
    transform: rotate(90deg);
}

/* KONTENER WIDEO */
.waw-tiktok-modal-player-wrap {
    width: 100%;
    aspect-ratio: 9 / 16;
    max-height: 65vh;
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.waw-tiktok-modal-player-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* DOLNY PASEK MODALU */
.waw-tiktok-modal-footer {
    padding: 14px 18px;
    background: #181818;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.waw-tiktok-modal-title {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
}

.waw-tiktok-modal-actions {
    display: flex;
    gap: 10px;
}

.waw-tiktok-modal-cta-btn {
    flex: 1;
    text-align: center;
    background: linear-gradient(90deg, #fe2c55 0%, #ff0050 100%);
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 9px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.88rem;
    transition: opacity 0.2s;
}

.waw-tiktok-modal-cta-btn:hover {
    opacity: 0.92;
}

.waw-tiktok-modal-open-direct {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.2s;
}

.waw-tiktok-modal-open-direct:hover {
    background: rgba(255, 255, 255, 0.2);
}
