/* ========================================================================
   secondsim2-paywall — Design tokens + global stilleri
   Tema: dark + royal-blue accent (SecondSim brand mavisi).
   ======================================================================== */

:root {
    /* Surfaces — 3 elevation */
    --bg-0: #08101F;
    --bg-1: #0F1A2E;
    --bg-2: #18253D;
    --bg-3: #223352;

    /* Glass / borders */
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --border-accent: rgba(59, 130, 246, 0.45);

    /* Text — hepsi dark bg üstünde WCAG AA */
    --fg: #F5F8FF;
    --fg-2: #C5D2E6;
    --fg-3: #87A0BD;
    --fg-on-accent: #FFFFFF;

    /* Accents — royal blue → deep blue gradient */
    --accent: #3B82F6;
    --accent-hi: #60A5FA;
    --accent-2: #1D4ED8;
    --accent-glow: rgba(59, 130, 246, 0.45);
    --accent-soft: rgba(59, 130, 246, 0.12);

    /* Semantic */
    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.14);
    --danger: #F87171;
    --danger-bg: rgba(248, 113, 113, 0.14);
    --warn: #F59E0B;

    /* Shape */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 8px 32px rgba(59, 130, 246, 0.3);

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
    background: var(--bg-0);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overscroll-behavior: none;
    font-feature-settings: 'cv11', 'ss01', 'tnum';
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

button { font: inherit; color: inherit; }

/* Background ambient glow — sayfanın üst tarafında subtle aura */
body::before {
    content: '';
    position: fixed;
    inset: -10% -10% auto -10%;
    height: 60vh;
    background:
        radial-gradient(ellipse 60% 50% at 30% 0%, rgba(139, 92, 246, 0.18), transparent 60%),
        radial-gradient(ellipse 50% 40% at 80% 10%, rgba(99, 102, 241, 0.14), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ----- Layout ----- */
.page {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
}

.hidden { display: none !important; }

/* ----- Brand ----- */
.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 28px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--fg);
}

.brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.brand-icon svg { display: block; }

.brand-name {
    background: linear-gradient(135deg, #FFFFFF 0%, #C9C9DC 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.015em;
}

/* ----- Typography ----- */
.title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin: 0 0 8px;
    text-align: center;
    color: var(--fg);
}

.subtitle {
    color: var(--fg-2);
    text-align: center;
    margin: 0 0 28px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.45;
}

/* ----- Plans ----- */
.plans {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.plan-card {
    position: relative;
    background: var(--bg-1);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px 18px;
    cursor: pointer;
    transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out), transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    overflow: hidden;
    text-align: left;
    color: inherit;
}

.plan-card.has-badge { padding-top: 30px; }

.plan-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent-soft), transparent 60%);
    opacity: 0;
    transition: opacity 0.25s var(--ease-out);
    pointer-events: none;
}

.plan-card:active { transform: scale(0.985); }

.plan-card.selected {
    border-color: var(--border-accent);
    background: var(--bg-2);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.2), 0 8px 24px rgba(139, 92, 246, 0.15);
}

.plan-card.selected::before { opacity: 1; }

.plan-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.plan-radio {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s;
}

.plan-card.selected .plan-radio {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.plan-radio svg {
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.2s var(--ease-spring), transform 0.25s var(--ease-spring);
}

.plan-card.selected .plan-radio svg {
    opacity: 1;
    transform: scale(1);
}

.plan-info {
    flex: 1 1 auto;
    min-width: 0;
}

.plan-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--fg);
    letter-spacing: -0.01em;
}

.plan-meta {
    margin-top: 2px;
    font-size: 13px;
    color: var(--fg-3);
    font-weight: 500;
}

.plan-price {
    text-align: right;
    flex-shrink: 0;
}

.plan-price-main {
    font-size: 19px;
    font-weight: 800;
    color: var(--fg);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.plan-price-sub {
    margin-top: 2px;
    font-size: 11px;
    color: var(--fg-3);
    font-weight: 500;
}

.plan-badge {
    position: absolute;
    top: 8px;
    left: 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--fg-on-accent);
    font-size: 10px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    line-height: 1.4;
}

.plan-badge.badge-best {
    background: linear-gradient(135deg, var(--success), #059669);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* ----- Buttons ----- */
.btn {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: var(--r-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s, transform 0.1s ease, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: -0.01em;
    user-select: none;
}

.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--fg-on-accent);
    box-shadow: var(--shadow-accent);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
    transform: translateX(-100%);
    animation: shimmer 3s ease-in-out infinite;
    pointer-events: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--fg);
    border: 1px solid var(--border);
}

.btn-secondary:active { background: rgba(255, 255, 255, 0.1); }

.btn-ghost {
    background: transparent;
    color: var(--fg-2);
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
}

.btn-ghost:active { color: var(--fg); }

.cta-wrap {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.terms {
    color: var(--fg-3);
    font-size: 12px;
    text-align: center;
    margin: 14px 0 0;
    line-height: 1.55;
    font-weight: 500;
}

/* ----- Spinner ----- */
.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--accent-hi);
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
    margin: 0 auto;
}

.spinner-sm {
    width: 22px;
    height: 22px;
    border-width: 2px;
}

/* ----- Center block (loading / error) ----- */
.center-block {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    padding: 32px 20px;
}

.status-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    color: var(--fg);
    letter-spacing: -0.02em;
}

.status-sub {
    color: var(--fg-2);
    font-size: 15px;
    margin: 0;
    max-width: 320px;
    line-height: 1.5;
    font-weight: 500;
}

/* ----- Bottom Sheet ----- */
.sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(8, 8, 26, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease-out);
}

.sheet-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    z-index: 201;
    width: 100%;
    max-width: 480px;
    transform: translateX(-50%) translateY(100%);
    background: var(--bg-1);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    border-top: 1px solid var(--border);
    transition: transform 0.4s var(--ease-out);
    display: flex;
    flex-direction: column;
    max-height: 92vh;
    max-height: 92dvh;
    overflow: hidden;
}

.sheet-overlay.visible .sheet {
    transform: translateX(-50%) translateY(0);
}

.sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 4px;
    flex-shrink: 0;
}

.sheet-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--fg);
    letter-spacing: -0.02em;
}

.sheet-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: var(--fg-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, color 0.15s;
}

.sheet-close:active { background: rgba(255, 255, 255, 0.15); color: var(--fg); }

.sheet-plan {
    padding: 0 20px;
    font-size: 14px;
    color: var(--fg-2);
    font-weight: 600;
}

.sheet-plan strong { color: var(--fg); font-weight: 800; font-variant-numeric: tabular-nums; }

.sheet-body {
    padding: 16px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
}

/* Sheet -> SBP full-screen takeover */
.sheet.sbp-mode {
    max-height: 100vh;
    max-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border-top: none;
}

.sheet.sbp-mode .sheet-handle,
.sheet.sbp-mode .sheet-header,
.sheet.sbp-mode .sheet-plan {
    display: none;
}

.sheet.sbp-mode .sheet-body {
    padding: calc(8px + env(safe-area-inset-top, 0px)) 16px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 0;
}

/* ----- Payment-method buttons (sheet içinde) ----- */
.pm-btn {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-2);
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    text-align: left;
}

.pm-btn:active {
    transform: scale(0.985);
    background: var(--bg-3);
    border-color: var(--border-strong);
}

.pm-btn-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--fg);
}

.pm-btn-icon.pm-sbp {
    background: linear-gradient(135deg, #FF6B00, #E91E63);
    color: #fff;
}

.pm-btn-label {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 16px;
    font-weight: 700;
    color: var(--fg);
    letter-spacing: -0.01em;
    min-width: 0;
}

.pm-btn-sub {
    display: block;
    font-size: 12px;
    color: var(--fg-3);
    font-weight: 500;
    letter-spacing: 0;
}

.pm-btn-arrow {
    flex-shrink: 0;
    color: var(--fg-3);
}

/* ----- Payment status overlay (waiting/success/timeout) ----- */
.po-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(8, 8, 26, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.po-content {
    text-align: center;
    color: var(--fg);
    max-width: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.po-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.po-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--accent-hi);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.po-check {
    display: none;
    width: 80px;
    height: 80px;
}

.po-overlay.po-success .po-spinner { display: none; }
.po-overlay.po-success .po-check { display: block; }

.po-check-circle {
    fill: none;
    stroke: var(--success);
    stroke-width: 4;
    stroke-dasharray: 251;
    stroke-dashoffset: 251;
    animation: draw-circle 0.5s var(--ease-out) forwards;
}

.po-check-mark {
    fill: none;
    stroke: var(--success);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: draw-mark 0.35s var(--ease-out) 0.45s forwards;
}

.po-warn {
    display: none;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--danger-bg);
    color: var(--danger);
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 800;
}

.po-overlay.po-timeout .po-spinner { display: none; }
.po-overlay.po-timeout .po-warn { display: flex; }

.po-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--fg);
}

.po-sub {
    font-size: 14px;
    color: var(--fg-2);
    margin: 0;
    line-height: 1.5;
    max-width: 320px;
}

.po-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 280px;
}

.po-actions { display: none; }
.po-overlay.po-timeout .po-actions { display: flex; }

/* ----- Status icons (success.html / fail.html) ----- */
.success-icon {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--success-bg);
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 60px rgba(16, 185, 129, 0.25);
    animation: pop-in 0.5s var(--ease-spring);
}

.fail-icon {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--danger-bg);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    font-weight: 800;
    box-shadow: 0 0 60px rgba(248, 113, 113, 0.2);
    animation: pop-in 0.5s var(--ease-spring);
}

.credit-box {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px 18px;
    margin-top: 4px;
    font-size: 14px;
    color: var(--fg-2);
    font-weight: 500;
}

.credit-box strong {
    color: var(--fg);
    font-weight: 800;
    font-size: 18px;
    margin-left: 6px;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, var(--accent-hi), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ----- Animations ----- */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    50%, 100% { transform: translateX(100%); }
}

@keyframes draw-circle {
    to { stroke-dashoffset: 0; }
}

@keyframes draw-mark {
    to { stroke-dashoffset: 0; }
}

@keyframes pop-in {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fade-up 0.4s var(--ease-out) both; }
.fade-up-d1 { animation-delay: 0.05s; }
.fade-up-d2 { animation-delay: 0.10s; }
.fade-up-d3 { animation-delay: 0.15s; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
