/* ==========================================================================
   BARIVIO CORE THEME & CSS VARIABLES
   Light & Dark Coffee (Gece - Koyu Kahve) Paleti
   ========================================================================== */

:root {
    /* Global Radius Sistemi - Tüm radiuslar buradan türetilir */
    --radius-global: 12px;
    --radius-xs: calc(var(--radius-global) * 0.33);  /* 4px */
    --radius-sm: calc(var(--radius-global) * 0.5);   /* 6px */
    --radius-md: var(--radius-global);               /* 12px */
    --radius-lg: calc(var(--radius-global) * 1.5);   /* 18px */
    --radius-xl: calc(var(--radius-global) * 2);     /* 24px */
    --radius-full: 9999px;

    /* Layout Ölçüleri */
    --header-height: 80px;
    --footer-height: 380px;
    --mobile-nav-height: 64px;
    --container-max-width: 1200px;
    --layout-content-padding: 2.5rem 1.5rem;
    --layout-content-padding-mobile: 1.5rem 1rem;
    
    /* Tipografi */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Z-Index Ölçeği */
    --z-dropdown: 10;
    --z-sticky: 20;
    --z-bottom-nav: 30;
    --z-overlay: 40;
    --z-modal: 50;
    --z-toast: 100;

    /* Gündüz (Light) Modu Renkleri */
    --bg-body: #faf7f2;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f4eee5;
    --bg-header: rgba(255, 255, 255, 0.92);
    --bg-footer: #1e130c;
    --text-footer: #e8ded4;
    --text-footer-muted: #a89a8f;

    --text-primary: #21150e;
    --text-secondary: #5e4e42;
    --text-muted: #8c7a6e;
    
    --border-color: #e8ded4;
    --border-color-focus: #a87146;
    
    --brand-primary: #a87146;          /* Kavrulmuş Sıcak Kahve */
    --brand-primary-hover: #8f5d35;
    --brand-accent: #c48a56;
    --brand-dark: #2a1a10;
    --brand-surface: #f9f5f0;

    --avatar-bg: #eddcd2;
    --avatar-text: #6b4423;

    --color-success: #15803d;
    --color-danger: #b91c1c;
    --color-warning: #b45309;

    --shadow-sm: 0 1px 2px 0 rgba(33, 21, 14, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(33, 21, 14, 0.08), 0 2px 4px -2px rgba(33, 21, 14, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(33, 21, 14, 0.1), 0 4px 6px -4px rgba(33, 21, 14, 0.05);

    /* Form ve Buton Standartları */
    --btn-min-width: 140px;
    --input-height: 2.75rem;
}

/* ==========================================================================
   GECE MODU (Dark Coffee / Koyu Espresso & Roasted Bean Paleti)
   ========================================================================== */
[data-theme="dark"] {
    --bg-body: #140d09;               /* Koyu Kavrulmuş Kahve Çekirdeği */
    --bg-surface: #1e140d;            /* Espresso Yüzey */
    --bg-surface-elevated: #281b12;   /* Yükseltilmiş Kahve Kartı */
    --bg-header: rgba(20, 13, 9, 0.94);
    --bg-footer: #0c0805;
    --text-footer: #e2d5c8;
    --text-footer-muted: #96867a;

    --text-primary: #f8f4ee;
    --text-secondary: #c9bbae;
    --text-muted: #918174;

    --border-color: #362419;
    --border-color-focus: #c48a56;

    --brand-primary: #c48a56;          /* Sıcak Kahve Karamel Vurgusu */
    --brand-primary-hover: #d79f6a;
    --brand-accent: #e2b07d;
    --brand-dark: #0f0a07;
    --brand-surface: #241810;

    --avatar-bg: #3d2618;
    --avatar-text: #e2b07d;

    --color-success: #22c55e;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   RESET & TEMEL
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.25s ease, color 0.25s ease;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    body {
        padding-bottom: var(--mobile-nav-height); /* Mobil alt bar boşluğu */
    }
}

[dir="rtl"] {
    text-align: right;
    direction: rtl;
}

/* ==========================================================================
   ANA YAPI: HEADER, MAIN (BODY), FOOTER
   Kural: Min-Height = 100vh - (Header + Footer)
   ========================================================================== */
.tm-header {
    height: var(--header-height);
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.tm-main-body {
    flex: 1 0 auto;
    min-height: calc(100vh - (var(--header-height) + var(--footer-height)));
    width: 100%;
    display: flex;
    flex-direction: column;
}

.tm-footer {
    min-height: var(--footer-height);
    background-color: var(--bg-footer);
    color: var(--text-footer);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    width: 100%;
}

.tm-container {
    max-width: var(--container-max-width);
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

@media (max-width: 768px) {
    .tm-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ==========================================================================
   LOGO BOYUTLARI VE DARK/LIGHT SEÇİCİ
   ========================================================================== */
.tm-site-logo {
    height: 48px;
    max-height: 52px;
    width: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.2s ease;
}

.tm-logo-dark {
    display: block;
}

.tm-logo-light {
    display: none;
}

[data-theme="light"] .tm-logo-dark {
    display: none;
}

[data-theme="light"] .tm-logo-light {
    display: block;
}

@media (max-width: 992px) {
    .tm-nav-desktop {
        display: none !important;
    }
}

/* ==========================================================================
   USER PROFILE PULDOWN & AVATAR (Sağ Üst: Belirgin, Şık ve Erişilebilir)
   ========================================================================== */
.tm-user-area {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tm-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.3rem 0.85rem 0.3rem 0.3rem;
    background-color: var(--bg-surface-elevated);
    border: 1.5px solid rgba(196, 138, 86, 0.4);
    border-radius: var(--radius-full);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tm-user-trigger:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 4px 12px rgba(196, 138, 86, 0.25);
    transform: translateY(-1px);
}

.tm-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(196, 138, 86, 0.22);
    color: var(--brand-primary);
    border: 1px solid rgba(196, 138, 86, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9375rem;
    font-weight: 800;
    text-transform: uppercase;
    flex-shrink: 0;
}

.tm-user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.25;
}

[dir="rtl"] .tm-user-info {
    text-align: right;
}

.tm-user-name {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tm-user-action-label {
    font-size: 0.6875rem;
    color: var(--brand-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Language Pulldown Menu */
.tm-lang-menu {
    position: relative;
}

.tm-lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.6rem;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 38px;
}

.tm-lang-trigger:hover {
    border-color: var(--brand-primary);
}

.tm-lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 150px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.35rem 0;
    display: none;
    z-index: var(--z-dropdown);
    animation: tmFadeIn 0.15s ease-out forwards;
}

[dir="rtl"] .tm-lang-dropdown {
    right: auto;
    left: 0;
}

.tm-lang-dropdown.is-open {
    display: block;
}

.tm-lang-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.875rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tm-lang-item:hover,
.tm-lang-item.is-active {
    background-color: var(--bg-surface-elevated);
    color: var(--brand-primary);
}

.tm-lang-flag {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

/* User Pulldown Menu */
.tm-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    display: none;
    z-index: var(--z-dropdown);
    animation: tmFadeIn 0.15s ease-out forwards;
}

[dir="rtl"] .tm-user-dropdown {
    right: auto;
    left: 0;
}

.tm-user-dropdown.is-open {
    display: block;
}

.tm-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background-color 0.15s ease, color 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

[dir="rtl"] .tm-dropdown-item {
    text-align: right;
}

.tm-dropdown-item:hover {
    background-color: var(--bg-surface-elevated);
    color: var(--brand-primary);
}

.tm-dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.4rem 0;
}

@keyframes tmFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   MOBİL ALT BAR (Mobile Bottom Navigation)
   ========================================================================== */
.tm-mobile-bottom-nav {
    display: none;
}

@media (max-width: 992px) {
    body {
        padding-bottom: var(--mobile-nav-height);
    }

    .tm-mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--mobile-nav-height);
        background-color: var(--bg-surface);
        border-top: 2px solid rgba(196, 138, 86, 0.4);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        z-index: 9999;
        justify-content: space-around;
        align-items: center;
        padding: 0 0.5rem;
    }

    .tm-mobile-nav-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        background: none;
        border: none;
        color: var(--text-secondary);
        font-size: 0.6875rem;
        font-weight: 500;
        text-decoration: none;
        cursor: pointer;
        padding: 0.35rem 0.5rem;
        border-radius: var(--radius-sm);
        transition: color 0.2s ease;
        flex: 1;
    }

    .tm-mobile-nav-btn:hover,
    .tm-mobile-nav-btn.is-active {
        color: var(--brand-primary);
    }

    .tm-mobile-nav-icon {
        font-size: 1.25rem;
        line-height: 1;
    }
}

/* ==========================================================================
   ANDROİD TARZI MOBİL MENÜ (Bottom Sheet / Drawer)
   ========================================================================== */
.tm-bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 10, 7, 0.65);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.tm-bottom-sheet-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.tm-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-lg);
    padding: 1rem 1.25rem 2rem 1.25rem;
    z-index: calc(var(--z-modal) + 1);
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 85vh;
    overflow-y: auto;
}

.tm-bottom-sheet-overlay.is-active .tm-bottom-sheet {
    transform: translateY(0);
}

.tm-sheet-handle {
    width: 40px;
    height: 4px;
    background-color: var(--border-color);
    border-radius: var(--radius-full);
    margin: 0 auto 1.25rem auto;
}

/* ==========================================================================
   STANDART BUTON, İNPUT VE KARTLAR (Radius-Global ile Yönetilir)
   ========================================================================== */
.tm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--btn-min-width);
    height: var(--input-height);
    padding: 0 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tm-btn-primary {
    background-color: var(--brand-primary);
    color: #ffffff;
}

.tm-btn-primary:hover {
    background-color: var(--brand-primary-hover);
    transform: translateY(-1px);
}

.tm-btn-secondary {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.tm-btn-secondary:hover {
    background-color: var(--border-color);
}

.tm-btn-danger {
    background-color: var(--color-danger);
    color: #ffffff;
}

.tm-btn-danger:hover {
    opacity: 0.9;
}

.tm-input {
    width: 100%;
    height: var(--input-height);
    padding: 0 1rem;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tm-input:focus-visible {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(168, 113, 70, 0.2);
}

.tm-paper {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   CAPTCHA BİLEŞENİ
   ========================================================================== */
.tm-captcha-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.tm-captcha-img-box {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tm-captcha-refresh-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.tm-captcha-refresh-btn:hover {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

/* ==========================================================================
   ERİŞİLEBİLİRLİK
   ========================================================================== */
a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 3px;
}

/* ==========================================================================
   KULLANIM KOŞULLARI MODAL DIALOG (Terms Modal)
   ========================================================================== */
.tm-terms-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.tm-terms-modal-overlay.is-active {
    display: flex;
    animation: tmFadeIn 0.2s ease-out;
}

.tm-terms-modal-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 680px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tm-terms-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.tm-terms-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.tm-terms-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
