/* ============================================================
   iAdsterra Safelink - Styles
   ============================================================ */

:root {
    --accent:       #6c63ff;
    --accent-hover: #574fd6;
    --radius:       14px;
    --transition:   0.25s ease;
}

/* Dark Theme */
body.dark {
    --bg:         #0f0f13;
    --bg2:        #1a1a24;
    --card:       #1e1e2e;
    --border:     #2e2e42;
    --text:       #e2e2f0;
    --text-muted: #888aa8;
    --input-bg:   #14141e;
}

/* Light Theme */
body.light {
    --bg:         #f4f4f8;
    --bg2:        #ffffff;
    --card:       #ffffff;
    --border:     #e0e0ec;
    --text:       #1a1a2e;
    --text-muted: #6b6b8a;
    --input-bg:   #f9f9fc;
}

/* ─── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─────────────────────────────────────────── */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 0 16px;
    width: 100%;
}

/* ─── Header ─────────────────────────────────────────── */
.site-header {
    display: flex;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.5px;
    text-decoration: none;
}

/* ─── Footer ─────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 20px 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ─── Card ────────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
    width: 100%;
    max-width: 560px;
    text-align: center;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.4px;
}

.card-sub {
    color: var(--text-muted);
    font-size: 0.93rem;
    margin-bottom: 28px;
}

/* ─── Shield Icon ────────────────────────────────────── */
.icon-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.shield-icon {
    width: 52px;
    height: 52px;
    color: var(--accent);
    filter: drop-shadow(0 0 16px color-mix(in srgb, var(--accent) 40%, transparent));
}

/* ─── Countdown Ring ─────────────────────────────────── */
.countdown-wrap {
    position: relative;
    width: 130px;
    height: 130px;
    margin: 0 auto 20px;
}

.ring {
    width: 130px;
    height: 130px;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 8;
}

.ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.countdown-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text);
}

/* ─── Status Text ─────────────────────────────────────── */
.status-text {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 24px;
    min-height: 20px;
    transition: opacity var(--transition);
}

/* ─── Proceed Button ──────────────────────────────────── */
.btn-proceed {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #22c55e;
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    padding: 14px 32px;
    border-radius: 50px;
    text-decoration: none;
    transition: background var(--transition), transform var(--transition),
                box-shadow var(--transition), opacity var(--transition);
    box-shadow: 0 4px 24px rgba(34,197,94,0.35);
    margin-bottom: 12px;
}

.btn-proceed svg {
    width: 20px;
    height: 20px;
}

.btn-proceed:hover {
    background: #16a34a;
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(34,197,94,0.45);
    text-decoration: none;
}

.btn-proceed.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.btn-proceed.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Pulse animation when button appears */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 4px 24px rgba(34,197,94,0.35); }
    50%       { box-shadow: 0 4px 40px rgba(34,197,94,0.60); }
}

.btn-proceed.visible {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ─── Disclaimer ──────────────────────────────────────── */
.disclaimer {
    font-size: 0.76rem;
    color: var(--text-muted);
    max-width: 380px;
    margin: 0 auto;
}

/* ─── Ad Banners ──────────────────────────────────────── */
.ad-banner {
    text-align: center;
    margin: 4px auto;
}

.ad-728 { max-width: 728px; overflow: hidden; }
.ad-300 { max-width: 300px; overflow: hidden; }

.ad-sidebar {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

/* ─── Home Page ───────────────────────────────────────── */
.home-main {
    padding-top: 20px;
}

.hero {
    text-align: center;
    padding: 40px 0 8px;
}

.hero-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.hero-icon svg {
    width: 60px;
    height: 60px;
    color: var(--accent);
    filter: drop-shadow(0 0 20px color-mix(in srgb, var(--accent) 40%, transparent));
}

.hero h1 {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 10px;
}

.hero-sub {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Encoder Card */
.encoder-card {
    max-width: 620px;
    text-align: left;
}

.encoder-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.95rem;
    color: var(--text);
    font-family: inherit;
    transition: border-color var(--transition);
    width: 100%;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.btn-generate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.97rem;
    padding: 13px 28px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition), transform var(--transition);
}

.btn-generate svg {
    width: 18px;
    height: 18px;
}

.btn-generate:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.error-msg {
    color: #f87171;
    font-size: 0.87rem;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
}

/* Result Box */
.result-box {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-box label {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-url-wrap {
    display: flex;
    gap: 8px;
}

.result-url-wrap input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--accent);
    font-family: monospace;
    min-width: 0;
}

.btn-copy {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background var(--transition);
}

.btn-copy:hover { background: var(--accent-hover); }

.test-link {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.test-link:hover { color: var(--accent); }

/* How it works */
.how-card {
    max-width: 620px;
    text-align: left;
}

.steps {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 4px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.step-num {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.step-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.step-text strong {
    font-size: 0.95rem;
    color: var(--text);
}

.step-text span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ─── Inline Ad Blocks ───────────────────────────────── */
.ad-block {
    width: 100%;
    max-width: 1100px;
    margin: 12px auto;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}
.ad-block > * { margin: 0 auto; }
.ad-728-wrap { min-height: 90px; }
.ad-300-wrap { min-height: 250px; }

/* ─── Popular Videos Section ─────────────────────────── */
.popular-videos {
    width: 100%;
    max-width: 1100px;
    margin: 4px auto 0;
    padding: 0 16px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.video-card {
    display: block;
    position: relative;
    text-decoration: none;
    border-radius: 0;
    overflow: hidden;
    background: var(--bg2);
    border: 1px solid var(--border);
    aspect-ratio: 16/9;
    transition: transform var(--transition), box-shadow var(--transition);
}

.video-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}

/* Thumb fills entire card */
.video-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

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

.video-card:hover .video-thumb img {
    transform: scale(1.07);
}

.thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg2);
    color: var(--text-muted);
}

.thumb-placeholder svg { width: 40px; height: 40px; opacity: 0.4; }

/* Play icon overlay on hover */
.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
    z-index: 2;
}

.play-overlay svg {
    width: 44px;
    height: 44px;
    fill: #fff;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
}

.video-card:hover .play-overlay { opacity: 1; }

/* Title text overlay at bottom — no background */
.video-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3;
    padding: 10px 10px 9px;
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: #F2AB07;
    background: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    line-height: 1.35;
    text-shadow: 0 1px 6px rgba(0,0,0,0.9), 0 0 12px rgba(0,0,0,0.7);
    -webkit-text-stroke: 0.4px #000000;
    paint-order: stroke fill;
}

/* ─── Responsive ─────────────────────────────────────── */

/* Large desktop */
@media (min-width: 1024px) {
    .page-wrapper { padding: 0 32px; }
    .video-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
}

/* Tablet */
@media (max-width: 1023px) and (min-width: 601px) {
    .video-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .ad-728-wrap { overflow: hidden; }
}

/* Mobile */
@media (max-width: 600px) {
    .page-wrapper { padding: 0 12px; }
    .card { padding: 24px 16px; }
    .card-title { font-size: 1.2rem; }
    .countdown-wrap { width: 110px; height: 110px; }
    .ring { width: 110px; height: 110px; }
    .countdown-num { font-size: 2rem; }
    .btn-proceed { font-size: 0.95rem; padding: 13px 24px; width: 100%; justify-content: center; }
    .ad-728-wrap { display: none; }
    .ad-300-wrap { width: 100%; }
    .video-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .video-title { font-size: 0.70rem; padding: 20px 7px 7px; }
    .popular-videos { padding: 0 4px; }
    .section-title { font-size: 1rem; }
    .ad-block { padding: 0 4px; }
    .site-footer { font-size: 0.75rem; }
}

/* Very small mobile */
@media (max-width: 360px) {
    .video-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .card { padding: 20px 12px; }
}
