/* ==========================================================================
   Varsayılan Durum - JS Yüklenmeden Önce Uygulanır
   Masaüstü modunda (992px+) menü varsayılan olarak KAPALI kabul edilir
   JS çalışırsa kullanıcının tercihine göre düzeltir
   ========================================================================== */
@media (min-width: 992px) {
    /* Varsayılan olarak menü AÇIK kabul et - JS class eklediğinde kapanır */
    .sidebar-left.closed {
        width: 70px !important;
    }
    .sidebar-left.closed .sidebar-menu a span,
    .sidebar-left.closed .sidebar-title {
        display: none !important;
    }
    .sidebar-left.closed .sidebar-menu a {
        justify-content: center;
        padding: 12px 0;
    }
    
    /* Varsayılan olarak chat AÇIK - JS class eklediğinde kapanır */
    .sidebar-right.closed {
        transform: translateX(100%);
    }
    
    /* Varsayılan olarak main wrapper normal margin */
    .main-wrapper.sidebar-left-closed {
        margin-left: 70px !important;
        margin-right: var(--chat-width) !important;
        width: calc(100% - 70px - var(--chat-width)) !important;
    }
    
    .main-wrapper.sidebar-right-closed {
        margin-left: var(--sidebar-width) !important;
        margin-right: 0 !important;
        width: calc(100% - var(--sidebar-width)) !important;
    }
    
    .main-wrapper.sidebar-left-closed.sidebar-right-closed {
        margin-left: 70px !important;
        margin-right: 0 !important;
        width: calc(100% - 70px) !important;
    }
    
    /* Footer da varsayılan normal */
    .site-footer.sidebar-left-closed {
        margin-left: 70px !important;
        margin-right: var(--chat-width) !important;
        width: calc(100% - 70px - var(--chat-width)) !important;
    }
    
    .site-footer.sidebar-right-closed {
        margin-left: var(--sidebar-width) !important;
        margin-right: 0 !important;
        width: calc(100% - var(--sidebar-width)) !important;
    }
    
    .site-footer.sidebar-left-closed.sidebar-right-closed {
        margin-left: 70px !important;
        margin-right: 0 !important;
        width: calc(100% - 70px) !important;
    }
}

/* JS çalıştığında bu class'lar ile açar */
@media (min-width: 992px) {
    /* Menü açık durumu - JS bunu ekleyecek */
    .sidebar-left:not(.closed) {
        width: var(--sidebar-width) !important;
    }
    .sidebar-left:not(.closed) .sidebar-menu a span,
    .sidebar-left:not(.closed) .sidebar-title {
        display: block !important;
    }
    .sidebar-left:not(.closed) .sidebar-menu a {
        justify-content: flex-start;
        padding: 12px 15px;
    }
    
    /* Chat açık durumu */
    .sidebar-right:not(.closed) {
        transform: translateX(0);
    }
    
    /* Main wrapper açık durumu */
    .main-wrapper:not(.sidebar-left-closed):not(.sidebar-right-closed) {
        margin-left: var(--sidebar-width) !important;
        margin-right: var(--chat-width) !important;
        width: calc(100% - var(--sidebar-width) - var(--chat-width)) !important;
    }
    
    .main-wrapper.sidebar-left-closed:not(.sidebar-right-closed) {
        margin-left: 70px !important;
        margin-right: var(--chat-width) !important;
        width: calc(100% - 70px - var(--chat-width)) !important;
    }
    
    .main-wrapper.sidebar-right-closed:not(.sidebar-left-closed) {
        margin-left: var(--sidebar-width) !important;
        margin-right: 0 !important;
        width: calc(100% - var(--sidebar-width)) !important;
    }
    
    /* Footer açık durumu */
    .site-footer:not(.sidebar-left-closed):not(.sidebar-right-closed) {
        margin-left: var(--sidebar-width) !important;
        margin-right: var(--chat-width) !important;
        width: calc(100% - var(--sidebar-width) - var(--chat-width)) !important;
    }
    
    .site-footer.sidebar-left-closed:not(.sidebar-right-closed) {
        margin-left: 70px !important;
        margin-right: var(--chat-width) !important;
        width: calc(100% - 70px - var(--chat-width)) !important;
    }
}

/* ==========================================================================
   Responsive Design - Casino Slot Theme
   Basit ve Çalışan Versiyon
   ========================================================================== */

/* CSS Değişkenleri */
:root {
    --sidebar-width: 260px;
    --chat-width: 320px;
    --header-height: 70px;
    --bg-body: #0f212e;
    --bg-card: #1a2c38;
    --bg-hover: #213743;
    --border: #2d3f4f;
    --text-main: #ffffff;
    --text-muted: #8b9bb4;
    --primary: #00e701;
    --radius-sm: 4px;
}

/* Varsayılan olarak mobil öğeleri gizle */
.mobile-only {
    display: none;
}

/* Mobilde (991px ve altı) göster */
@media (max-width: 991px) {
    .mobile-only {
        display: flex !important;
    }
    
    /* Mobilde ana içerik tam genişlik */
    .main-content {
        padding: 15px !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 767px) {
    :root {
        --header-height: 50px;
    }
    
    * {
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    body {
        font-size: 12px;
    }

    /* Header - Tam uyumlu */
    .site-header {
        padding: 0 8px;
        height: 50px;
        width: 100%;
        max-width: 100vw;
        overflow: hidden;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .header-left {
        flex: 1;
        min-width: 0;
    }

    .header-right {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
    }
    
    /* Logo */
    .logo {
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100px;
    }
    
    .logo-img {
        max-height: 24px;
        max-width: 80px;
    }
    
    /* Auth Buttons - Küçük ve sıkı */
    .auth-buttons {
        display: flex;
        gap: 4px;
    }
    
    .auth-buttons .btn {
        padding: 4px 8px;
        font-size: 10px;
        white-space: nowrap;
    }
    
    /* User Info Items */
    .user-info-item {
        padding: 3px 6px;
        font-size: 10px;
    }

    .user-name-display,
    .user-balance-display {
        font-size: 10px;
        white-space: nowrap;
    }
    
    .user-balance-display svg {
        width: 10px;
        height: 10px;
    }
    
    /* Mobile Header Buttons - %30 küçült */
    .mobile-header {
        width: 28px;
        height: 28px;
        padding: 4px;
        flex-shrink: 0;
    }
    
    .mobile-header svg {
        width: 16px;
        height: 16px;
    }

    /* Main Content */
    .main-content {
        padding: 8px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .section-title {
        font-size: 14px;
    }
    
    .games-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        width: 100%;
    }
    
    .game-card {
        aspect-ratio: 4 / 3;
        min-width: 0;
    }
    
    .game-info {
        padding: 6px;
    }
    
    .game-name {
        font-size: 10px;
    }
    
    .game-provider {
        font-size: 8px;
    }
    
    .play-btn {
        width: 24px;
        height: 24px;
    }
    
    .play-btn svg {
        width: 8px;
        height: 8px;
    }
    
    /* Footer */
    .site-footer {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* Sidebars */
    .sidebar-left, .sidebar-right {
        max-width: 100vw;
        overflow-x: hidden;
    }
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 1000;
}

/* ==========================================================================
   Sol Sidebar - Varsayılan AÇIK
   ========================================================================== */
.sidebar-left {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s ease, width 0.3s ease, margin 0.3s ease;
    transform: translateX(0);
}

/* Kapalı durumu - Sadece ikonları göster, menüyü gizleme */
.sidebar-left.closed {
    width: 70px !important;
    overflow: visible !important;
}

.sidebar-left.closed .sidebar-menu a span,
.sidebar-left.closed .sidebar-title {
    display: none;
}

.sidebar-left.closed .sidebar-menu a {
    justify-content: center;
    padding: 12px 0;
    position: relative;
}

/* Tooltip - hover durumunda menü adını göster */
.sidebar-left.closed .sidebar-menu a:hover::after {
    content: attr(data-menu-text);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    background: var(--bg-card);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    pointer-events: none;
}

/* ==========================================================================
   Ana İçerik
   ========================================================================== */
.main-wrapper {
    margin-top: var(--header-height);
    margin-left: var(--sidebar-width);
    margin-right: var(--chat-width);
    min-height: calc(100vh - var(--header-height));
    width: calc(100% - var(--sidebar-width) - var(--chat-width));
    max-width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: margin 0.3s ease, width 0.3s ease;
}

/* Sidebar kapalıysa - daraltılmış mod (sadece ikonlar) */
.main-wrapper.sidebar-left-closed {
    margin-left: 70px;
    width: calc(100% - 70px - var(--chat-width));
    max-width: 100%;
}

.main-wrapper.sidebar-right-closed {
    margin-right: 0;
    width: calc(100% - var(--sidebar-width));
    max-width: 100%;
}

.main-wrapper.sidebar-left-closed.sidebar-right-closed {
    margin-left: 70px;
    margin-right: 0;
    width: calc(100% - 70px);
    max-width: 100%;
}

.main-content {
    padding: 30px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex: 1;
}

/* ==========================================================================
   Sağ Sidebar - Varsayılan AÇIK
   ========================================================================== */
.sidebar-right {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: var(--chat-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 100;
    transition: transform 0.3s ease, width 0.3s ease, margin 0.3s ease;
    transform: translateX(0);
}

/* Kapalı durumu */
.sidebar-right.closed {
    transform: translateX(100%);
}

/* ==========================================================================
   Kapatma Butonları
   ========================================================================== */
.sidebar-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 101;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--text-main);
}

/* Mobilde kapatma butonu konumu */
@media (max-width: 991px) {
    .sidebar-close {
        display: flex;
        top: 15px;
        right: 15px;
    }
}

/* ==========================================================================
   Overlay
   ========================================================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* ==========================================================================
   Footer - Sidebar margin'lerine uyum
   ========================================================================== */
.site-footer {
    margin-top: auto;
    margin-left: var(--sidebar-width);
    margin-right: var(--chat-width);
    transition: margin 0.3s ease;
    width: calc(100% - var(--sidebar-width) - var(--chat-width));
}

.site-footer.sidebar-left-closed {
    margin-left: 70px;
    width: calc(100% - 70px - var(--chat-width));
}

.site-footer.sidebar-right-closed {
    margin-right: 0;
    width: calc(100% - var(--sidebar-width));
}

.site-footer.sidebar-left-closed.sidebar-right-closed {
    margin-left: 70px;
    margin-right: 0;
    width: calc(100% - 70px);
}

/* ==========================================================================
   Tablet (max-width: 1199px)
   ========================================================================== */
@media (max-width: 1199px) {
    :root {
        --sidebar-width: 220px;
        --chat-width: 280px;
    }
}

/* ==========================================================================
   Mobil (max-width: 991px)
   ========================================================================== */
@media (max-width: 991px) {
    :root {
        --sidebar-width: 280px;
        --chat-width: 320px;
    }

    /* Mobilde sidebar'lar gizli başlasın */
    .sidebar-left,
    .sidebar-right {
        transform: translateX(-100%);
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        top: 0 !important;
        z-index: 9999 !important;
    }
    
    .sidebar-right {
        transform: translateX(100%);
    }

    /* Mobilde aktif class - tam ekran */
    .sidebar-left.active,
    .sidebar-right.active {
        transform: translateX(0);
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        top: 0 !important;
        z-index: 9999 !important;
    }
    
    /* Mobilde sidebar açıkken arka plan scroll engelleme - sadece overflow:hidden */
    body.sidebar-mobile-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }
    
    /* Sayfa scroll bar'ını gizle */
    body.sidebar-mobile-open::-webkit-scrollbar {
        display: none !important;
    }
    
    body.sidebar-mobile-open {
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
    }
    
    /* Overlay tam ekran */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 9998 !important;
    }
    
    .sidebar-overlay.active {
        display: block;
    }

    /* Main wrapper margin'leri sıfırla */
    .main-wrapper {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }
    
    /* Footer da mobil modda margin sıfırlansın */
    .site-footer {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }

    /* Header */
    .site-header {
        padding: 0 15px;
    }

    .mobile-header {
        display: flex !important;
    }
    
    /* Mobilde kapatma butonunu göster */
    .mobile-only {
        display: flex !important;
    }
}

/* ==========================================================================
   Orta Boyutlu Tablet (max-width: 767px)
   ========================================================================== */
@media (max-width: 767px) {
    :root {
        --header-height: 60px;
    }

    body {
        font-size: 14px;
    }

    /* Sayfa genelinde overflow kontrolü */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    .site-header {
        padding: 0 12px;
        height: 60px;
    }

    .header-right {
        gap: 8px;
    }

    .logo {
        font-size: 14px;
    }

    .main-content {
        padding: 12px !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
}


/* ==========================================================================
   Mobil Footer - Daha Profesyonel Görünüm
   ========================================================================== */
@media (max-width: 767px) {
    .site-footer {
        padding: 30px 15px 20px;
    }

    .footer-content {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 15px;
    }

    .footer-legal {
        padding: 15px;
    }

    /* Legal links - 2x2 grid */
    .footer-links-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .footer-link-item {
        width: 100%;
        justify-content: center;
        padding: 12px 10px;
        font-size: 12px;
    }

    .footer-payments,
    .footer-providers {
        padding: 15px;
    }

    .footer-payments h4,
    .footer-providers h4 {
        margin-bottom: 15px;
    }

    .payment-placeholder,
    .provider-placeholder {
        padding: 15px 25px;
        font-size: 12px;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding-top: 15px;
    }

    /* Mobil: Telif hakkı üstte, lisans ve sosyal medya altta yan yana */
    .footer-top-row {
        display: flex;
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }

    .footer-copyright {
        order: 1;
        font-size: 11px;
        text-align: center;
        width: 100%;
    }

    .footer-license {
        order: 2;
        display: flex;
        justify-content: center;
    }

    .footer-license img {
        height: 40px;
    }

    .footer-socials {
        order: 3;
        display: flex;
        justify-content: center;
        gap: 10px;
    }

    .footer-socials a {
        width: 32px;
        height: 32px;
    }
}


/* ==========================================================================
   Mobilde Chat Tam Ekran
   ========================================================================== */
@media (max-width: 991px) {
    /* Chat tam ekran - %100 ekran ve flex yapısı */
    .sidebar-right {
        display: flex !important;
        flex-direction: column !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        min-height: 100dvh !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        position: fixed !important;
        overflow: hidden !important;
        z-index: 99999 !important;
    }
    
    /* Chat header - sabit */
    .sidebar-right .chat-header {
        flex-shrink: 0 !important;
        height: 60px !important;
        min-height: 60px !important;
        max-height: 60px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 10px 15px !important;
        background: var(--bg-card) !important;
        border-bottom: 1px solid var(--border) !important;
    }
    
    /* Chat mesajları - sadece bu alan scroll yapacak */
    .sidebar-right .chat-messages {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        min-height: 0 !important;
        max-height: calc(100dvh - 120px) !important;
        -webkit-overflow-scrolling: touch;
        padding: 10px;
    }
    
    /* Chat mesajları scrollbar stili */
    .sidebar-right .chat-messages::-webkit-scrollbar {
        width: 4px;
    }
    
    .sidebar-right .chat-messages::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .sidebar-right .chat-messages::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
    }
    
    /* Chat input alanı - sabit altta */
    .sidebar-right .chat-input-area {
        flex-shrink: 0 !important;
        height: auto !important;
        min-height: 60px !important;
        padding: 12px 15px !important;
        background: var(--bg-card) !important;
        border-top: 1px solid var(--border) !important;
    }
    
    /* Menü tam ekran - %100 ekran ve flex yapısı */
    .sidebar-left {
        display: flex !important;
        flex-direction: column !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        min-height: 100dvh !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        position: fixed !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Menü içinde scroll bar'ı gizle ama scroll çalışsın */
    .sidebar-left::-webkit-scrollbar {
        width: 4px;
    }
    
    .sidebar-left::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .sidebar-left::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
    }
    
    /* Menü kapatma butonu - sağ üst köşe */
    .sidebar-left .sidebar-close {
        position: absolute !important;
        top: 15px !important;
        right: 15px !important;
        margin: 0 !important;
    }
    
    /* Menü section'ları arasına hr ekle */
    .sidebar-left .sidebar-section {
        border-bottom: 1px solid var(--border) !important;
        padding-bottom: 15px !important;
        margin-bottom: 15px !important;
    }
    
    .sidebar-left .sidebar-section:last-child {
        border-bottom: none !important;
    }
    
    /* sidebar-title ve sidebar-menu arasında boşluk */
    .sidebar-left .sidebar-title {
        margin-top: 10px !important;
        margin-bottom: 10px !important;
    }
}
    
    .chat-messages {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }
    
    .chat-input-area {
        flex-shrink: 0;
        padding: 12px;
    }
    
    .chat-form {
        flex-direction: row;
        gap: 10px;
    }
    
    .chat-input {
        padding: 12px;
        font-size: 16px;
    }
    
    .chat-send {
        width: 44px;
        min-width: 44px;
        height: 44px;
        padding: 0;
    }
    
    .chat-header {
        flex-shrink: 0;
        padding: 15px;
    }
}


/* ==========================================================================
   Profil Sayfası - Quick Links
   ========================================================================== */
.quick-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-link-card {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.2s;
}

.quick-link-card:hover {
    background: var(--border);
    transform: translateY(-2px);
}

.quick-link-card svg {
    color: var(--primary);
}

.quick-link-card span {
    font-size: 13px;
    font-weight: 500;
}
