/* ==========================================================================
   Work Bots — Ortak Tasarım Sistemi
   - 3 site teması (Nebula, Aurora, Ember): html[data-theme="..."]
   - Sayfa ve bölüm geçişleri (View Transitions + yedek animasyonlar)
   - Tüm sayfalarda ortak bileşenler (toast, tema seçici, yükleme çubuğu)
   Tema admin panelinden seçilir; /js/core.js tüm ziyaretçilere canlı uygular.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TEMALAR
   -------------------------------------------------------------------------- */
html:not([data-theme]),
html[data-theme="nebula"] {
    color-scheme: dark;
    --bg-dark: #0b0718;
    --bg-deep: #140c2b;
    --bg-rgb: 11, 7, 24;
    --surface: #160f2a;
    --surface-rgb: 22, 15, 42;
    --surface-2: #1d1536;

    --primary: #7c3aed;
    --primary-rgb: 124, 58, 237;
    --primary-bright: #a78bfa;
    --primary-bright-rgb: 167, 139, 250;
    --primary-deep: #5b21b6;
    --primary-deep-rgb: 91, 33, 182;
    --secondary: #ddd6fe;
    --accent: #6366f1;
    --accent-rgb: 99, 102, 241;
    --theme-accent: #6366f1;
    --pink: #ec4899;
    --pink-rgb: 236, 72, 153;

    --text-light: #f5f3ff;
    --text-rgb: 245, 243, 255;
    --text-muted: #a59cc4;
    --on-primary: #ffffff;

    --grad-brand: linear-gradient(135deg, #7c3aed 0%, #6366f1 55%, #ec4899 100%);
    --grad-text: linear-gradient(120deg, #c4b5fd 0%, #a78bfa 40%, #f0abfc 100%);
    --mesh-1: rgba(124, 58, 237, 0.30);
    --mesh-2: rgba(99, 102, 241, 0.22);
    --mesh-3: rgba(236, 72, 153, 0.16);
}

html[data-theme="aurora"] {
    color-scheme: dark;
    --bg-dark: #03111a;
    --bg-deep: #062130;
    --bg-rgb: 3, 17, 26;
    --surface: #0a1f2c;
    --surface-rgb: 10, 31, 44;
    --surface-2: #0f2a3a;

    --primary: #0891b2;
    --primary-rgb: 8, 145, 178;
    --primary-bright: #22d3ee;
    --primary-bright-rgb: 34, 211, 238;
    --primary-deep: #0e7490;
    --primary-deep-rgb: 14, 116, 144;
    --secondary: #a5f3fc;
    --accent: #10b981;
    --accent-rgb: 16, 185, 129;
    --theme-accent: #10b981;
    --pink: #818cf8;
    --pink-rgb: 129, 140, 248;

    --text-light: #ecfeff;
    --text-rgb: 236, 254, 255;
    --text-muted: #8fb3c0;
    --on-primary: #ffffff;

    --grad-brand: linear-gradient(135deg, #0891b2 0%, #10b981 60%, #22d3ee 100%);
    --grad-text: linear-gradient(120deg, #a5f3fc 0%, #22d3ee 45%, #6ee7b7 100%);
    --mesh-1: rgba(8, 145, 178, 0.30);
    --mesh-2: rgba(16, 185, 129, 0.20);
    --mesh-3: rgba(129, 140, 248, 0.14);
}

html[data-theme="ember"] {
    color-scheme: dark;
    --bg-dark: #120a07;
    --bg-deep: #22120b;
    --bg-rgb: 18, 10, 7;
    --surface: #24150f;
    --surface-rgb: 36, 21, 15;
    --surface-2: #2e1b13;

    --primary: #ea580c;
    --primary-rgb: 234, 88, 12;
    --primary-bright: #fb923c;
    --primary-bright-rgb: 251, 146, 60;
    --primary-deep: #c2410c;
    --primary-deep-rgb: 194, 65, 12;
    --secondary: #fed7aa;
    --accent: #f59e0b;
    --accent-rgb: 245, 158, 11;
    --theme-accent: #f59e0b;
    --pink: #f43f5e;
    --pink-rgb: 244, 63, 94;

    --text-light: #fff7ed;
    --text-rgb: 255, 247, 237;
    --text-muted: #c2a596;
    --on-primary: #ffffff;

    --grad-brand: linear-gradient(135deg, #ea580c 0%, #f59e0b 55%, #f43f5e 100%);
    --grad-text: linear-gradient(120deg, #fed7aa 0%, #fb923c 45%, #fda4af 100%);
    --mesh-1: rgba(234, 88, 12, 0.28);
    --mesh-2: rgba(245, 158, 11, 0.18);
    --mesh-3: rgba(244, 63, 94, 0.16);
}

html[data-theme="midnight"] {
    color-scheme: dark;
    --bg-dark: #070b14;
    --bg-deep: #0d1424;
    --bg-rgb: 7, 11, 20;
    --surface: #0f1729;
    --surface-rgb: 15, 23, 41;
    --surface-2: #152038;

    --primary: #2563eb;
    --primary-rgb: 37, 99, 235;
    --primary-bright: #60a5fa;
    --primary-bright-rgb: 96, 165, 250;
    --primary-deep: #1d4ed8;
    --primary-deep-rgb: 29, 78, 216;
    --secondary: #bfdbfe;
    --accent: #818cf8;
    --accent-rgb: 129, 140, 248;
    --theme-accent: #818cf8;
    --pink: #38bdf8;
    --pink-rgb: 56, 189, 248;

    --text-light: #eff6ff;
    --text-rgb: 239, 246, 255;
    --text-muted: #94a3b8;
    --on-primary: #ffffff;

    --grad-brand: linear-gradient(135deg, #2563eb 0%, #4f46e5 60%, #38bdf8 100%);
    --grad-text: linear-gradient(120deg, #bfdbfe 0%, #60a5fa 45%, #a5b4fc 100%);
    --mesh-1: rgba(37, 99, 235, 0.28);
    --mesh-2: rgba(129, 140, 248, 0.18);
    --mesh-3: rgba(56, 189, 248, 0.14);
}

html[data-theme="sakura"] {
    color-scheme: dark;
    --bg-dark: #150a12;
    --bg-deep: #22101d;
    --bg-rgb: 21, 10, 18;
    --surface: #26121f;
    --surface-rgb: 38, 18, 31;
    --surface-2: #301828;

    --primary: #db2777;
    --primary-rgb: 219, 39, 119;
    --primary-bright: #f472b6;
    --primary-bright-rgb: 244, 114, 182;
    --primary-deep: #be185d;
    --primary-deep-rgb: 190, 24, 93;
    --secondary: #fbcfe8;
    --accent: #c084fc;
    --accent-rgb: 192, 132, 252;
    --theme-accent: #c084fc;
    --pink: #fb7185;
    --pink-rgb: 251, 113, 133;

    --text-light: #fdf2f8;
    --text-rgb: 253, 242, 248;
    --text-muted: #c49cb3;
    --on-primary: #ffffff;

    --grad-brand: linear-gradient(135deg, #db2777 0%, #c026d3 55%, #fb7185 100%);
    --grad-text: linear-gradient(120deg, #fbcfe8 0%, #f472b6 45%, #d8b4fe 100%);
    --mesh-1: rgba(219, 39, 119, 0.28);
    --mesh-2: rgba(192, 132, 252, 0.18);
    --mesh-3: rgba(251, 113, 133, 0.16);
}

html[data-theme="forest"] {
    color-scheme: dark;
    --bg-dark: #06110b;
    --bg-deep: #0b1d13;
    --bg-rgb: 6, 17, 11;
    --surface: #0e2117;
    --surface-rgb: 14, 33, 23;
    --surface-2: #142b1e;

    --primary: #15803d;
    --primary-rgb: 21, 128, 61;
    --primary-bright: #4ade80;
    --primary-bright-rgb: 74, 222, 128;
    --primary-deep: #166534;
    --primary-deep-rgb: 22, 101, 52;
    --secondary: #bbf7d0;
    --accent: #84cc16;
    --accent-rgb: 132, 204, 22;
    --theme-accent: #84cc16;
    --pink: #2dd4bf;
    --pink-rgb: 45, 212, 191;

    --text-light: #f0fdf4;
    --text-rgb: 240, 253, 244;
    --text-muted: #8fb59d;
    --on-primary: #ffffff;

    --grad-brand: linear-gradient(135deg, #15803d 0%, #65a30d 55%, #14b8a6 100%);
    --grad-text: linear-gradient(120deg, #bbf7d0 0%, #4ade80 45%, #bef264 100%);
    --mesh-1: rgba(21, 128, 61, 0.30);
    --mesh-2: rgba(132, 204, 22, 0.16);
    --mesh-3: rgba(45, 212, 191, 0.14);
}

html[data-theme="crimson"] {
    color-scheme: dark;
    --bg-dark: #110607;
    --bg-deep: #1e0b0d;
    --bg-rgb: 17, 6, 7;
    --surface: #231012;
    --surface-rgb: 35, 16, 18;
    --surface-2: #2d1517;

    --primary: #dc2626;
    --primary-rgb: 220, 38, 38;
    --primary-bright: #f87171;
    --primary-bright-rgb: 248, 113, 113;
    --primary-deep: #b91c1c;
    --primary-deep-rgb: 185, 28, 28;
    --secondary: #fecaca;
    --accent: #f97316;
    --accent-rgb: 249, 115, 22;
    --theme-accent: #f97316;
    --pink: #fb7185;
    --pink-rgb: 251, 113, 133;

    --text-light: #fef2f2;
    --text-rgb: 254, 242, 242;
    --text-muted: #c39a9a;
    --on-primary: #ffffff;

    --grad-brand: linear-gradient(135deg, #dc2626 0%, #9f1239 55%, #f97316 100%);
    --grad-text: linear-gradient(120deg, #fecaca 0%, #f87171 45%, #fda4af 100%);
    --mesh-1: rgba(220, 38, 38, 0.28);
    --mesh-2: rgba(159, 18, 57, 0.22);
    --mesh-3: rgba(249, 115, 22, 0.12);
}

html[data-theme="royal"] {
    color-scheme: dark;
    --bg-dark: #0a0b1a;
    --bg-deep: #111332;
    --bg-rgb: 10, 11, 26;
    --surface: #14163a;
    --surface-rgb: 20, 22, 58;
    --surface-2: #1b1e48;

    --primary: #a16207;
    --primary-rgb: 161, 98, 7;
    --primary-bright: #facc15;
    --primary-bright-rgb: 250, 204, 21;
    --primary-deep: #854d0e;
    --primary-deep-rgb: 133, 77, 14;
    --secondary: #fef08a;
    --accent: #8b5cf6;
    --accent-rgb: 139, 92, 246;
    --theme-accent: #8b5cf6;
    --pink: #a78bfa;
    --pink-rgb: 167, 139, 250;

    --text-light: #fefce8;
    --text-rgb: 254, 252, 232;
    --text-muted: #a8a6c7;
    --on-primary: #ffffff;

    --grad-brand: linear-gradient(135deg, #ca8a04 0%, #a16207 45%, #7c3aed 100%);
    --grad-text: linear-gradient(120deg, #fef08a 0%, #facc15 45%, #c4b5fd 100%);
    --mesh-1: rgba(202, 138, 4, 0.22);
    --mesh-2: rgba(124, 58, 237, 0.24);
    --mesh-3: rgba(167, 139, 250, 0.12);
}

/* Eski dosyaların kullandığı değişken adları -> tema değerleri */
html {
    --primary-glow: rgba(var(--primary-rgb), 0.42);
    --accent-glow: rgba(var(--accent-rgb), 0.35);
    --accent-pink: var(--pink);
    --accent-pink-glow: rgba(var(--pink-rgb), 0.35);
    --card-bg: rgba(var(--surface-rgb), 0.6);
    --card-border: rgba(var(--primary-rgb), 0.16);
    --card-border-hover: rgba(var(--primary-rgb), 0.45);

    --discord: #5865f2;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --font-display: 'Outfit', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

    background-color: var(--bg-dark);
}

[hidden] { display: none !important; }

/* Discord markalı butonlar her temada Discord renginde kalır */
.btn-discord,
a[href^="/api/auth/discord"].btn,
#btnHeaderDiscordLogin {
    background: var(--discord) !important;
    border-color: var(--discord) !important;
    color: #fff !important;
}

/* --------------------------------------------------------------------------
   2. SAYFA GEÇİŞLERİ
   -------------------------------------------------------------------------- */

/* Sayfalar arası (aynı site içi) gezinmede tarayıcının yerel geçişi */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: wb-vt-out 260ms var(--ease-out) both;
}
::view-transition-new(root) {
    animation: wb-vt-in 420ms var(--ease-out) both;
}

@keyframes wb-vt-out {
    to { opacity: 0; transform: scale(0.985); filter: blur(4px); }
}
@keyframes wb-vt-in {
    from { opacity: 0; transform: translateY(14px) scale(1.01); filter: blur(6px); }
}

/* Tema değişiminde dairesel açılma efekti (core.js --wb-reveal-x/y ayarlar) */
html.wb-theme-reveal::view-transition-old(root) {
    animation: none;
}
html.wb-theme-reveal::view-transition-new(root) {
    animation: wb-reveal 700ms var(--ease-out) both;
}
@keyframes wb-reveal {
    from { clip-path: circle(0 at var(--wb-reveal-x, 50%) var(--wb-reveal-y, 50%)); }
    to   { clip-path: circle(150vmax at var(--wb-reveal-x, 50%) var(--wb-reveal-y, 50%)); }
}

/* View Transitions desteklemeyen tarayıcılar için giriş / çıkış animasyonu */
html.wb-no-vt body {
    animation: wb-page-in 480ms var(--ease-out) both;
}
html.wb-leaving body {
    animation: wb-page-out 220ms ease-in both;
    pointer-events: none;
}
@keyframes wb-page-in {
    from { opacity: 0; transform: translateY(10px); }
}
@keyframes wb-page-out {
    to { opacity: 0; transform: translateY(-6px); }
}

/* Dashboard bölüm (sekme) geçişi */
.wb-section-enter {
    animation: wb-section-in 420ms var(--ease-out) both;
}
@keyframes wb-section-in {
    from { opacity: 0; transform: translateY(12px); filter: blur(3px); }
}

/* Gezinme sırasında üstte ince yükleme çizgisi */
.wb-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    z-index: 100000;
    background: var(--grad-brand);
    box-shadow: 0 0 12px var(--primary-glow);
    opacity: 0;
    transition: width 600ms var(--ease-out), opacity 200ms ease;
    pointer-events: none;
}
.wb-progress.is-active {
    opacity: 1;
    width: 72%;
}

/* Kaydırınca beliren öğeler */
[data-reveal] {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) { animation: none !important; }
    html.wb-no-vt body,
    html.wb-leaving body,
    .wb-section-enter { animation: none !important; }
    [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* --------------------------------------------------------------------------
   3. TOAST BİLDİRİMLERİ
   -------------------------------------------------------------------------- */
.wb-toast-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 100001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.wb-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 240px;
    max-width: min(380px, calc(100vw - 40px));
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(var(--surface-rgb), 0.92);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    color: var(--text-light);
    font: 500 0.9rem/1.4 var(--font-body);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px);
    animation: wb-toast-in 380ms var(--ease-out) both;
    pointer-events: auto;
}
.wb-toast i { color: var(--primary-bright); }
.wb-toast.is-success i { color: var(--success); }
.wb-toast.is-error i { color: var(--danger); }
.wb-toast.is-leaving { animation: wb-toast-out 260ms ease-in both; }
@keyframes wb-toast-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
@keyframes wb-toast-out { to { opacity: 0; transform: translateX(20px); } }

/* --------------------------------------------------------------------------
   4. TEMA SEÇİCİ KARTLARI (dashboard "Site Teması" bölümü)
   -------------------------------------------------------------------------- */
.wb-theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}
.wb-theme-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius);
    background: rgba(var(--surface-rgb), 0.55);
    border: 1px solid rgba(var(--text-rgb), 0.08);
    color: var(--text-light);
    text-align: left;
    cursor: pointer;
    font: inherit;
    transition: transform 300ms var(--ease-out), border-color 200ms ease, box-shadow 300ms ease;
}
.wb-theme-card:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--primary-rgb), 0.45);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.wb-theme-card:focus-visible {
    outline: 2px solid var(--primary-bright);
    outline-offset: 3px;
}
.wb-theme-card.is-active {
    border-color: var(--primary-bright);
    box-shadow: 0 0 0 1px var(--primary-bright), 0 18px 44px rgba(var(--primary-rgb), 0.25);
}
.wb-theme-card[aria-busy="true"] { opacity: 0.6; pointer-events: none; }

.wb-theme-preview {
    position: relative;
    height: 128px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--p0);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.wb-theme-preview::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120px 90px at 18% 20%, color-mix(in srgb, var(--p1) 55%, transparent), transparent 70%),
        radial-gradient(140px 100px at 85% 85%, color-mix(in srgb, var(--p2) 45%, transparent), transparent 70%),
        radial-gradient(90px 80px at 80% 10%, color-mix(in srgb, var(--p3) 40%, transparent), transparent 70%);
}
.wb-theme-preview .pv-bar {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 12px;
    height: 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
}
.wb-theme-preview .pv-side {
    position: absolute;
    left: 12px;
    top: 32px;
    bottom: 12px;
    width: 28%;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}
.wb-theme-preview .pv-card {
    position: absolute;
    left: calc(28% + 20px);
    right: 12px;
    top: 32px;
    height: 44px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid color-mix(in srgb, var(--p1) 45%, transparent);
}
.wb-theme-preview .pv-btn {
    position: absolute;
    left: calc(28% + 20px);
    bottom: 12px;
    width: 46%;
    height: 22px;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--p1), var(--p2));
}
.wb-theme-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wb-theme-meta strong { font: 700 1.05rem/1.2 var(--font-display); }
.wb-theme-meta p { margin: 4px 0 0; font-size: 0.8rem; color: var(--text-muted); line-height: 1.45; }
.wb-theme-dots { display: flex; gap: 5px; flex-shrink: 0; }
.wb-theme-dots span { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.15); }
.wb-theme-check {
    position: absolute;
    top: 22px;
    right: 22px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-bright);
    color: var(--bg-dark);
    font-size: 0.8rem;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 200ms ease, transform 300ms var(--ease-out);
}
.wb-theme-card.is-active .wb-theme-check { opacity: 1; transform: none; }
.wb-theme-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.wb-theme-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}
