/* =============================================
   AirShopi – YouTube Shorts Player – Frontend
   ============================================= */

:root {
    --ysp-radius:     12px;
    --ysp-radius-sm:  8px;
    --ysp-gap:        14px;
    --ysp-nav-size:   44px;
    --ysp-card-bg:    #111;
    --ysp-text:       #fff;
    --ysp-accent:     #ff0000;
    --ysp-transition: 0.2s ease;
}

/* Wrapper */
.ysp-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* Header */
.ysp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 0 2px;
}

.ysp-title {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.ysp-see-all-header {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ysp-accent);
    text-decoration: none;
    white-space: nowrap;
    transition: opacity var(--ysp-transition);
}

.ysp-see-all-header:hover {
    opacity: 0.8;
    text-decoration: none;
}

/* Outer z nawigacją */
.ysp-slider-outer {
    position: relative;
    display: flex;
    align-items: center;
}

/* Track */
.ysp-slider-track {
    display: flex;
    gap: var(--ysp-gap);
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    padding: 6px 4px 12px;
    cursor: grab;
    user-select: none;
    flex: 1;
}

.ysp-slider-track::-webkit-scrollbar { display: none; }

.ysp-slider-track.is-dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

/* Slajd – szerokości wg breakpointów */
.ysp-slide {
    flex: 0 0 calc( (100% - var(--ysp-gap) * 1.3) / 1.3 );
    scroll-snap-align: start;
    min-width: 0;
    display: flex;         /* wyrównaj wysokość kart */
    align-items: stretch;
}

@media (min-width: 480px) {
    .ysp-slide { flex: 0 0 calc( (100% - var(--ysp-gap) * 2.3) / 2.3 ); }
}

@media (min-width: 768px) {
    .ysp-slide { flex: 0 0 calc( (100% - var(--ysp-gap) * 3.7) / 3.7 ); }
}

@media (min-width: 1200px) {
    .ysp-slide { flex: 0 0 calc( (100% - var(--ysp-gap) * 4.2) / 4.2 ); }
}

/* Karta – button reset */
.ysp-card {
    display: flex;
    flex-direction: column;
    background: var(--ysp-card-bg);
    border-radius: var(--ysp-radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--ysp-text);
    width: 100%;
    height: 100%;          /* wypełnij wysokość slide */
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    transition: opacity var(--ysp-transition);
}

.ysp-card:hover {
    opacity: 0.92;
    text-decoration: none;
    color: var(--ysp-text);
}

.ysp-card:focus-visible {
    outline: 2px solid var(--ysp-accent);
    outline-offset: 2px;
}

/* Thumbnail */
.ysp-thumb-wrap {
    position: relative;
    aspect-ratio: 9/16;
    background: #1a1a1a;
    overflow: hidden;
}

.ysp-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    pointer-events: none;
}

/* Play button overlay */
.ysp-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0);
    transition: background var(--ysp-transition);
    pointer-events: none;
}

.ysp-play-btn svg {
    width: 52px;
    height: 52px;
    color: #fff;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
    opacity: 0;
    transition: opacity var(--ysp-transition);
}

.ysp-card:hover .ysp-play-btn { background: rgba(0,0,0,0.3); }
.ysp-card:hover .ysp-play-btn svg { opacity: 1; }

/* Shorts badge */
.ysp-shorts-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--ysp-accent);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 7px 3px 5px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    pointer-events: none;
}

/* Views */
.ysp-views {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.65);
    color: rgba(255,255,255,0.9);
    font-size: 0.62rem;
    font-weight: 500;
    padding: 3px 7px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

/* Card body */
.ysp-card-body {
    padding: 10px 12px 12px;
}

.ysp-card-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: rgba(255,255,255,0.9);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* CTA card */
.ysp-card-cta {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a0a0a 100%);
    border: 2px dashed rgba(255,0,0,0.3) !important;
    align-items: center;
    justify-content: center;
    aspect-ratio: 9/16;
    transition: border-color var(--ysp-transition), opacity var(--ysp-transition);
    cursor: pointer;
}

.ysp-card-cta:hover {
    opacity: 1;
    border-color: var(--ysp-accent) !important;
}

.ysp-cta-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 16px;
    gap: 10px;
    height: 100%;
}

.ysp-cta-icon {
    width: 56px;
    height: 56px;
    background: var(--ysp-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ysp-cta-icon svg {
    width: 28px;
    height: 28px;
    color: #fff;
}

.ysp-cta-text {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
}

.ysp-cta-sub {
    margin: 0;
    font-size: 0.75rem;
    color: var(--ysp-accent);
    font-weight: 600;
}

/* Nawigacja */
.ysp-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: var(--ysp-nav-size);
    height: var(--ysp-nav-size);
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #111;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--ysp-transition);
    opacity: 0.9;
    padding: 0;
    flex-shrink: 0;
}

.ysp-nav:hover { opacity: 1; }
.ysp-nav:disabled { opacity: 0.25; cursor: default; pointer-events: none; }
.ysp-nav-prev { left: -18px; }
.ysp-nav-next { right: -18px; }

@media (max-width: 599px) {
    .ysp-nav { display: none; }
}

/* =============================================
   Modal Player
   ============================================= */

.ysp-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ysp-modal[hidden] { display: none; }

.ysp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    cursor: pointer;
}

.ysp-modal-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 400px;
}

.ysp-modal-close {
    position: absolute;
    top: -48px;
    right: 0;
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--ysp-transition);
    z-index: 2;
}

.ysp-modal-close:hover {
    background: rgba(255,255,255,0.3);
}

.ysp-modal-frame-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16;
    background: #000;
    border-radius: var(--ysp-radius);
    overflow: hidden;
    max-height: 85vh;
}

/* Utrzymaj 9:16 proporcje też w max-height */
@media (max-height: 700px) {
    .ysp-modal-inner { max-width: 280px; }
}

.ysp-modal-frame-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Error */
.ysp-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--ysp-radius-sm);
    padding: 12px 16px;
    font-size: 0.875rem;
    color: #664d03;
}

.ysp-error a { color: #664d03; font-weight: 600; }
