/* ============================================================
 *  TicoShopping — Global Uygulama Stilleri
 *  Skylearn Tasarım Sistemi • Tailwind Tamamlayıcısı
 *  ------------------------------------------------------------
 *  Bu dosya, Tailwind CSS'in karşılamadığı %5'lik ihtiyacı
 *  karşılar: özel gradient'ler, keyframe animasyonlar,
 *  scrollbar, print ve erişilebilirlik stilleri.
 *
 *  Sürüm: 1.1.0
 *  Font: Nunito / Atkinson Hyperlegible / JetBrains Mono
 *  Palet: Sky #3B82F6 · Sun #FBBF24 · Leaf #22C55E · Coral #F87171 · Berry #A855F7
 * ============================================================ */

/* ============================================================
 *  1) KÖK DEĞİŞKENLER
 * ============================================================ */
:root {
    /* Layout ölçüleri */
    --nav-height: 72px;
    --sidebar-width: 260px;

    /* Skylearn renk paleti — JS ve SVG fallback için */
    --color-sky:        #3B82F6;
    --color-sky-bright: #60A5FA;
    --color-sky-deep:   #1D4ED8;
    --color-sky-soft:   #DBEAFE;
    --color-sun:        #FBBF24;
    --color-sun-bright: #FCD34D;
    --color-leaf:       #22C55E;
    --color-leaf-soft:  #DCFCE7;
    --color-coral:      #F87171;
    --color-coral-soft: #FEE2E2;
    --color-berry:      #A855F7;
    --color-ink:        #0F172A;
    --color-ink-muted:  #475569;
    --color-surface:    #F8FAFC;
    --color-surface-sunken: #F1F5F9;
    --color-outline:    #E2E8F0;

    /* Odak halkası */
    --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* ============================================================
 *  2) TEMEL RESET & TİPOGRAFİ
 * ============================================================ */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-size: 16px;
    letter-spacing: 0.01em;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Blog ve CMS okuma paragrafları için ferah satır aralığı */
.prose p,
.prose li {
    line-height: 1.8;
    letter-spacing: 0.01em;
}

/* ============================================================
 *  3) SEÇİM RENGİ (::selection)
 * ============================================================ */
::selection {
    background: #DBEAFE;
    color: #1D4ED8;
}

::-moz-selection {
    background: #DBEAFE;
    color: #1D4ED8;
}

/* ============================================================
 *  4) SCROLLBAR (Chrome, Edge, Safari, Firefox)
 * ============================================================ */
.scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: #E2E8F0 transparent;
}

.scrollbar-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: #E2E8F0;
    border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: #CBD5E1;
}

/* Global scrollbar (site geneli) — daha yumuşak ton */
html::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html::-webkit-scrollbar-track {
    background: #F8FAFC;
}

html::-webkit-scrollbar-thumb {
    background: #E2E8F0;
    border-radius: 10px;
    border: 2px solid #F8FAFC;
}

html::-webkit-scrollbar-thumb:hover {
    background: #CBD5E1;
}

/* ============================================================
 *  5) NAVBAR SCROLL EFEKTİ
 * ============================================================ */
.nav-scrolled {
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    background-color: rgba(255, 255, 255, 0.9);
}

/* ============================================================
 *  6) DOKUNMA OPTİMİZASYONU
 * ============================================================ */
.btn-touch {
    min-height: 56px;
}

/* iOS 300ms tıklama gecikmesini kaldır */
button,
a,
input[type="submit"],
[role="button"] {
    touch-action: manipulation;
}

/* ============================================================
 *  7) LINE CLAMP (Tailwind'de var ama eski tarayıcı fallback'i)
 * ============================================================ */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
 *  8) GRADIENT & DEKORATİF ARKA PLANLAR
 * ============================================================ */

/* Ana sayfa hero alanı */
.gradient-hero {
    background:
        radial-gradient(circle at 20% 20%, rgba(96, 165, 250, 0.18) 0%, transparent 45%),
        radial-gradient(circle at 80% 60%, rgba(168, 85, 247, 0.12) 0%, transparent 45%),
        linear-gradient(135deg, #F8FAFC 0%, #FFFFFF 100%);
}

/* Bakım modu ekranı arka planı */
.bg-decor {
    background:
        radial-gradient(circle at 15% 20%, rgba(96, 165, 250, 0.15) 0%, transparent 42%),
        radial-gradient(circle at 85% 70%, rgba(168, 85, 247, 0.12) 0%, transparent 45%),
        linear-gradient(135deg, #F8FAFC 0%, #FFFFFF 55%, #F1F5F9 100%);
}

/* Kart arka planı (subtle kartlı tasarımlar için) */
.bg-card-subtle {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
}

/* ============================================================
 *  9) ANİMASYONLAR
 * ============================================================ */

/* Yumuşak yüzme efekti (bakım ekranı ikonu) */
.float-slow {
    animation: floatY 6s ease-in-out infinite;
}

@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

/* Nabız halkası (bakım ekranı, canlı badge) */
.pulse-ring {
    animation: pulseRing 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseRing {
    0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    70%  { box-shadow: 0 0 0 18px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* Yumuşak giriş */
.fade-in {
    animation: fadeIn 0.35s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Dönen yükleme */
.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Toast giriş/çıkış animasyonu */
.toast-enter {
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0)    scale(1); }
}

/* ============================================================
 * 10) ÜRÜN KARTI HOVER
 * ============================================================ */
.product-card-hover {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    will-change: transform, box-shadow;
}

.product-card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -12px rgba(59, 130, 246, 0.18);
}

/* Görsel zoom efekti (ürün kartı kapakları) */
.img-zoom {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

.group:hover .img-zoom {
    transform: scale(1.05);
}

/* ============================================================
 * 11) FORM İYİLEŞTİRMELERİ
 * ============================================================ */

/* Native checkbox/radio rengi */
input[type="checkbox"],
input[type="radio"] {
    accent-color: #3B82F6;
}

input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* Native select okunu gizle (kendi ikonumuzu kullanırız) */
select.appearance-none {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none;
}

/* Placeholder rengi */
input::placeholder,
textarea::placeholder {
    color: #94A3B8;
    opacity: 1;
}

/* Focus outline kaldırma — kendi ring'imiz var */
button:focus,
input:focus,
select:focus,
textarea:focus,
a:focus {
    outline: none;
}

/* Disabled durumu */
button:disabled,
input:disabled,
select:disabled,
textarea:disabled,
a[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Autofill sarısını bastır (Chrome) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-text-fill-color: #0F172A;
    -webkit-box-shadow: 0 0 0 1000px #F8FAFC inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Dosya input'ları için tutarlı stil */
input[type="file"] {
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    cursor: pointer;
}

/* ============================================================
 * 12) PROSE / İÇERİK LİNKLERİ (Blog & CMS okuma)
 * ============================================================ */
.prose a {
    color: #1D4ED8;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color 0.15s ease;
}

.prose a:hover {
    color: #3B82F6;
    text-decoration-thickness: 2px;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
    font-family: 'Nunito', system-ui, sans-serif;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #0F172A;
}

.prose code {
    font-family: 'JetBrains Mono', monospace;
    background: #F1F5F9;
    padding: 0.15em 0.35em;
    border-radius: 4px;
    font-size: 0.9em;
}

.prose pre {
    background: #0F172A;
    color: #E2E8F0;
    padding: 1.25rem;
    border-radius: 16px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

.prose pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.prose blockquote {
    border-left: 4px solid #3B82F6;
    padding-left: 1rem;
    font-style: italic;
    color: #475569;
    margin: 1.5rem 0;
}

.prose img {
    border-radius: 16px;
    box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.1);
}

.prose ul,
.prose ol {
    padding-left: 1.5rem;
}

.prose li {
    margin-bottom: 0.5rem;
}

/* ============================================================
 * 13) RESPONSIVE İNCE AYARLAR
 * ============================================================ */

/* Mobilde font boyutu 16 → 15 */
@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    .btn-touch {
        min-height: 52px;
    }
}

/* Çok küçük ekranlar (eski telefonlar) */
@media (max-width: 360px) {
    body {
        font-size: 14px;
    }
}

/* Retina ekran optimizasyonu (isteğe bağlı) */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    .retina-2x {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Yatay telefon (landscape) — sabit yükseklikleri azalt */
@media (orientation: landscape) and (max-height: 500px) {
    :root {
        --nav-height: 60px;
    }

    .float-slow {
        animation-duration: 8s;
    }
}

/* ============================================================
 * 14) PRINT STİLLERİ (Sipariş / Fatura yazdırma)
 * ============================================================ */
@media print {
    /* Navigasyon ve kontrol öğelerini gizle */
    nav,
    header,
    footer,
    aside,
    #site-navbar,
    #admin-sidebar,
    #back-to-top,
    #cookie-bar,
    #notif-dropdown-wrap,
    #search-modal,
    #admin-search-modal,
    #purge-modal,
    #context-modal,
    #category-modal,
    #admin-user-menu,
    .no-print,
    .flash-close,
    .admin-flash {
        display: none !important;
    }

    /* Sayfa ayarları */
    @page {
        margin: 1.5cm;
    }

    body {
        background: #FFFFFF !important;
        color: #000000 !important;
        font-size: 12pt;
        line-height: 1.4;
    }

    /* Yazdırılabilir alanlar için arka plan */
    .print-bg-white,
    .bg-white {
        background: #FFFFFF !important;
    }

    /* Link görünürlüğü */
    a {
        color: #000000 !important;
        text-decoration: underline !important;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }

    /* Yazdırma yardımcıları */
    .print-break {
        page-break-before: always;
    }

    .print-avoid-break {
        page-break-inside: avoid;
    }

    /* Grafikler ve görseller */
    img,
    svg,
    canvas {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    /* Tablolar için */
    table {
        page-break-inside: auto;
        border-collapse: collapse !important;
    }

    tr {
        page-break-inside: avoid;
    }

    thead {
        display: table-header-group;
    }

    /* Arka planları bastır (mürekkep tasarrufu) */
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ============================================================
 * 15) ERİŞİLEBİLİRLİK
 * ============================================================ */

/* Ekran okuyucu için gizli */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Ekran okuyucu için gizli ama focus ile görünür (skip-link) */
.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus visible — yalnızca klavye gezintisinde */
:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
    border-radius: 8px;
}

/* Fare tıklamasında outline gösterme (focus-visible zaten yapar) */
:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================================
 * 16) HAREKET AZALTMA TERCİHİ (Motion Reduction)
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .float-slow,
    .pulse-ring,
    .fade-in,
    .spin,
    .toast-enter {
        animation: none !important;
    }
}

/* ============================================================
 * 17) YÜKSEK KONTRAST MODU (High Contrast)
 * ============================================================ */
@media (prefers-contrast: more) {
    :root {
        --color-outline: #94A3B8;
        --color-ink-muted: #334155;
    }

    .product-card-hover:hover {
        box-shadow: 0 0 0 3px #3B82F6, 0 20px 40px -12px rgba(59, 130, 246, 0.3);
    }
}

/* ============================================================
 * 18) YARDIMCI SINIFLAR
 * ============================================================ */

/* Yatay kaydırma (mobil tablolar için) */
.scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Sabit oran koruma */
.aspect-square {
    aspect-ratio: 1 / 1;
}

.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-wide {
    aspect-ratio: 21 / 9;
}

/* Nesne sığdırma */
.object-cover-center {
    object-fit: cover;
    object-position: center;
}

/* Metin kesme (tek satır) */
.truncate-1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Görsel yükleme iskeleti */
.skeleton {
    background: linear-gradient(
        90deg,
        #F1F5F9 0%,
        #E2E8F0 50%,
        #F1F5F9 100%
    );
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
 * 19) DARK MODE (Gelecekte aktifleştirilebilir)
 * ============================================================
 * Şu an devre dışı. Admin panelinden "Dark Mode" ayarı açıldığında
 * aşağıdaki bloğu aktif hale getirmek yeterlidir. Tüm renk tokenları
 * CSS değişkenlerine bağlı olduğu için override kolay olur.
 * ============================================================ */
/*
@media (prefers-color-scheme: dark) {
    :root {
        --color-ink: #F8FAFC;
        --color-ink-muted: #CBD5E1;
        --color-surface: #0F172A;
        --color-surface-sunken: #1E293B;
        --color-outline: #334155;
    }

    body {
        background: #0F172A;
        color: #F8FAFC;
    }

    .bg-white { background-color: #1E293B; }
    .border-outline { border-color: #334155; }
    .bg-surface { background-color: #1E293B; }
    .bg-surface-sunken { background-color: #0F172A; }

    ::selection {
        background: #1E40AF;
        color: #DBEAFE;
    }
}
*/

/* ============================================================
 * 20) YÜKSEK DPI / RETINA RESİMLER
 * ============================================================ */
picture img,
.source-retina {
    image-rendering: auto;
}

/* SVG ikonları netleştir */
svg {
    shape-rendering: geometricPrecision;
}

/* ============================================================
 * 21) CANLI DESTEK (CHAT) SİSTEMİ
 * ============================================================
 * Chat view'ları için ince scrollbar, mesaj balonu giriş
 * animasyonu, "yazıyor..." göstergesi ve mobil optimizasyonlar.
 * ============================================================ */

/* Mesajların scroll alanı — ince ve zarif scrollbar */
#chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #E2E8F0 transparent;
    scrollbar-gutter: stable;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #E2E8F0;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #CBD5E1;
}

/* Dark mode scrollbar */
html.dark #chat-messages {
    scrollbar-color: #334155 transparent;
}

html.dark #chat-messages::-webkit-scrollbar-thumb {
    background: #334155;
}

html.dark #chat-messages::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Mesaj balonu giriş animasyonu */
.chat-bubble-enter {
    animation: chatBubbleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
}

@keyframes chatBubbleIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* "Yazıyor..." göstergesi — 3 nokta */
.chat-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #94A3B8;
    animation: chatTypingBounce 1.2s infinite ease-in-out;
}

.chat-typing-dot:nth-child(1) { animation-delay: 0ms; }
.chat-typing-dot:nth-child(2) { animation-delay: 150ms; }
.chat-typing-dot:nth-child(3) { animation-delay: 300ms; }

@keyframes chatTypingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Sidebar chat badge için hafif nabız */
.chat-badge-pulse {
    animation: chatBadgePulse 2s ease-in-out infinite;
}

@keyframes chatBadgePulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}

/* Uzun kelimelerin mesaj balonundan taşmasını engelle */
#chat-messages .whitespace-pre-wrap {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Mesaj input textarea scrollbar */
#chat-input {
    scrollbar-width: thin;
    scrollbar-color: #E2E8F0 transparent;
}

#chat-input::-webkit-scrollbar {
    width: 4px;
}

#chat-input::-webkit-scrollbar-thumb {
    background: #E2E8F0;
    border-radius: 2px;
}

html.dark #chat-input::-webkit-scrollbar-thumb {
    background: #334155;
}

/* Mobil optimize — chat container yükseklik ayarı */
@media (max-width: 768px) {
    #chat-messages {
        /* Mobilde daha az yer kaplasın, klavye açıldığında sorun olmasın */
        padding: 1rem;
    }
}

/* Hareket azaltma tercihine saygı */
@media (prefers-reduced-motion: reduce) {
    .chat-bubble-enter,
    .chat-typing-dot,
    .chat-badge-pulse {
        animation: none !important;
    }
}

/* ============================================================
 * SON — TicoShopping app.css v1.1.0
 * + Canlı Destek (Chat) stilleri eklendi
 * ============================================================ */