/* ── WebStory Pro Frontend Styles ── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
    --wsp-primary: #E63946;
    --wsp-accent:  #F4A261;
    --wsp-dark:    #0d0d0d;
    --wsp-radius:  14px;
}

.wsp-plugin-wrap * { box-sizing: border-box; }
.wsp-plugin-wrap { font-family: 'Poppins', sans-serif; }

/* ── TICKER ── */
.wsp-ticker {
    background: var(--wsp-primary);
    padding: 8px 16px;
    display: flex; align-items: center; gap: 12px;
    font-size: 13px; color: #fff; overflow: hidden;
    margin-bottom: 20px; border-radius: 8px;
}
.wsp-ticker-badge {
    background: #fff; color: var(--wsp-primary);
    font-weight: 800; font-size: 10px;
    padding: 2px 8px; border-radius: 4px; flex-shrink: 0; letter-spacing: 0.06em;
}
.wsp-ticker-inner { flex: 1; overflow: hidden; }
.wsp-ticker-text {
    white-space: nowrap; display: inline-block;
    animation: wsp-ticker 22s linear infinite;
}
@keyframes wsp-ticker { from { transform: translateX(100%); } to { transform: translateX(-100%); } }

/* ── GRID ── */
.wsp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}
.wsp-layout-list { grid-template-columns: 1fr; }
.wsp-layout-list .wsp-card { flex-direction: row; aspect-ratio: auto; }
.wsp-layout-list .wsp-card-thumb { width: 120px; min-height: 160px; flex-shrink: 0; }

/* ── CARD ── */
.wsp-card {
    position: relative; border-radius: var(--wsp-radius);
    overflow: hidden; cursor: pointer;
    background: var(--card-color, #1a1a1a);
    aspect-ratio: 9/16;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex; flex-direction: column;
}
.wsp-card:hover { transform: translateY(-5px); box-shadow: 0 16px 40px rgba(0,0,0,0.4); }
.wsp-card-live { animation: wsp-live-border 2.5s ease-in-out infinite; }
@keyframes wsp-live-border {
    0%,100% { box-shadow: 0 0 0 2px var(--wsp-primary); }
    50%      { box-shadow: 0 0 0 2px var(--wsp-accent); }
}
.wsp-card-thumb {
    flex: 1; background-size: cover; background-position: center;
    background-color: var(--card-color, #333);
    position: relative; min-height: 0;
}
.wsp-card-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
}
.wsp-cat-badge {
    position: absolute; top: 10px; left: 10px;
    background: var(--wsp-primary); color: #fff;
    font-size: 9px; font-weight: 700;
    padding: 3px 8px; border-radius: 4px;
    letter-spacing: 0.06em; text-transform: uppercase;
}
.wsp-status-badge {
    position: absolute; top: 10px; right: 10px;
    font-size: 9px; font-weight: 700;
    padding: 3px 7px; border-radius: 4px;
}
.wsp-live      { background: rgba(46,204,113,0.2); color: #2ecc71; }
.wsp-draft     { background: rgba(255,193,7,0.2);  color: #ffc107; }
.wsp-scheduled { background: rgba(52,152,219,0.2); color: #3498db; }

.wsp-card-body { padding: 10px; background: rgba(0,0,0,0.85); }
.wsp-card-title {
    font-size: 12px; font-weight: 600; color: #fff; line-height: 1.4; margin: 0 0 6px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.wsp-card-meta {
    font-size: 10px; color: rgba(255,255,255,0.55);
    display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 8px;
}

/* ── PLAY BUTTON ── */
.wsp-play-btn {
    width: 100%; background: var(--wsp-primary); color: #fff;
    border: none; border-radius: 7px; padding: 7px 0;
    font-size: 11px; font-weight: 700; cursor: pointer;
    font-family: inherit; display: flex; align-items: center;
    justify-content: center; gap: 7px;
    transition: background 0.15s, transform 0.1s;
}
.wsp-play-btn:hover { background: #c0232f; transform: scale(1.02); }
.wsp-play-icon {
    width: 0; height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid #fff; flex-shrink: 0;
}

/* ── MODAL ── */
.wsp-modal {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
}
.wsp-modal.wsp-open { opacity: 1; pointer-events: all; }
.wsp-modal-bg {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.92);
}

/* ── VIEWER ── */
.wsp-viewer {
    position: relative; z-index: 2;
    width: min(360px, 92vw);
    height: min(640px, 92vh);
    background: #000; border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 40px 80px rgba(0,0,0,0.9);
}
#wsp-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wsp-viewer-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.35) 100%);
}

/* Progress bars */
.wsp-progress-bar {
    position: absolute; top: 12px; left: 12px; right: 12px;
    display: flex; gap: 4px; z-index: 10;
}
.wsp-prog-seg { flex: 1; height: 3px; background: rgba(255,255,255,0.25); border-radius: 2px; overflow: hidden; }
.wsp-prog-fill { height: 100%; background: #fff; border-radius: 2px; width: 0; transition: width 0.1s linear; }

/* Viewer top bar */
.wsp-viewer-top {
    position: absolute; top: 28px; left: 14px; right: 14px;
    display: flex; align-items: center; gap: 10px; z-index: 10;
}
.wsp-viewer-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--wsp-primary), var(--wsp-accent));
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.6);
}
.wsp-viewer-source { font-size: 13px; font-weight: 600; color: #fff; }
.wsp-viewer-time   { font-size: 11px; color: rgba(255,255,255,0.6); }
.wsp-close-btn {
    margin-left: auto; width: 32px; height: 32px;
    background: rgba(255,255,255,0.15); border: none;
    border-radius: 50%; color: #fff; font-size: 18px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s; line-height: 1;
}
.wsp-close-btn:hover { background: rgba(255,255,255,0.3); }

/* Nav arrows */
.wsp-viewer-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 100%; display: flex; justify-content: space-between;
    padding: 0 12px; z-index: 10;
}
.wsp-nav-arrow {
    width: 34px; height: 34px; background: rgba(255,255,255,0.15);
    border: none; border-radius: 50%; color: #fff; font-size: 20px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s; line-height: 1;
}
.wsp-nav-arrow:hover { background: rgba(255,255,255,0.3); }

/* Viewer content */
.wsp-viewer-content {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 18px 16px; z-index: 10;
}
.wsp-viewer-cat   { font-size: 10px; font-weight: 700; color: var(--wsp-primary); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 7px; }
.wsp-viewer-title { font-size: 18px; font-weight: 700; color: #fff; line-height: 1.35; margin-bottom: 7px; }
.wsp-viewer-desc  { font-size: 12px; color: rgba(255,255,255,0.75); line-height: 1.6; margin-bottom: 12px; }
.wsp-cta-btn {
    width: 100%; background: var(--wsp-primary); color: #fff;
    border: none; border-radius: 8px; padding: 11px 0;
    font-size: 13px; font-weight: 700; cursor: pointer;
    font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: background 0.15s;
}
.wsp-cta-btn:hover { background: #c0232f; }
.wsp-newtab-btn {
    width: 100%; margin-top: 8px;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
    color: #fff; border-radius: 8px; padding: 9px 0;
    font-size: 12px; font-weight: 600; cursor: pointer;
    font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: background 0.15s;
}
.wsp-newtab-btn:hover { background: rgba(255,255,255,0.2); }

/* ── CATEGORY GRID ── */
.wsp-cat-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr));
    gap: 14px;
}
.wsp-cat-card {
    background: #1e1e1e; border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px; padding: 16px 12px;
    text-align: center; text-decoration: none;
    border-top: 3px solid var(--cc, #E63946);
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.wsp-cat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.wsp-cat-emoji { font-size: 26px; }
.wsp-cat-name  { font-size: 13px; font-weight: 600; color: #fff; }
.wsp-cat-count { font-size: 11px; color: #888; }

/* ── EMPTY ── */
.wsp-empty { text-align: center; padding: 40px; color: #888; font-size: 14px; }
.wsp-empty a { color: var(--wsp-primary); }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
    .wsp-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .wsp-cat-grid { grid-template-columns: repeat(3, 1fr); }
}
