/* ==========================================================================
   GLOBAL DEĞİŞKENLER VE TEMEL AYARLAR (VARIABLES.CSS)
   Responsive, stabil ve hata/titreme önleyici sürüm
   ========================================================================== */

:root {
    /* --- Renk Paleti --- */
    --primary-color: #06b6d4;
    --primary-hover: #0891b2;
    --primary-soft: #ecfeff;
    --primary-border: #a5f3fc;

    --secondary-color: #1e293b;
    --secondary-hover: #0f172a;
    --secondary-soft: #334155;

    --success: #10b981;
    --success-hover: #059669;
    --success-soft: #ecfdf5;
    --success-border: #bbf7d0;

    --warning: #f59e0b;
    --warning-hover: #d97706;
    --warning-soft: #fffbeb;
    --warning-border: #fde68a;

    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-soft: #fef2f2;
    --danger-border: #fecaca;

    --info: #06b6d4;
    --info-hover: #0891b2;
    --info-soft: #ecfeff;
    --info-border: #a5f3fc;

    /* --- Arka Plan ve Metin Renkleri --- */
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-muted: #f8fafc;
    --bg-soft: #f8fafc;

    --text-main: #334155;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --text-soft: #94a3b8;
    --text-light: #f8fafc;

    --border-color: #e2e8f0;
    --border-soft: #f1f5f9;

    /* --- Ölçüler ve Boşluklar --- */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 85px;
    --mobile-bottom-nav-height: 72px;

    --border-radius-xs: 4px;
    --border-radius-sm: 6px;
    --border-radius-md: 10px;
    --border-radius-lg: 15px;
    --border-radius-xl: 20px;
    --border-radius-2xl: 24px;
    --radius-pill: 999px;

    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 15px;
    --spacing-lg: 25px;
    --spacing-xl: 32px;

    /* --- Gölgeler ve Efektler --- */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 24px 60px rgba(15, 23, 42, 0.18);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.35s ease;
    --transition: 0.25s ease;

    --font-main: "Nunito Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* --- Tipografi --- */
    --font-family-base: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    --font-size-base: 16px;
}

/* ==========================================================================
   GLOBAL SIFIRLAMA VE STABİL SAYFA DAVRANIŞI
   ========================================================================== */

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

html {
    width: 100%;
    min-height: 100%;
    font-size: var(--font-size-base);
    overflow-x: hidden;

    /* Smooth scroll bazı modal/sayfa geçişlerinde titreme yapabildiği için kapalı */
    scroll-behavior: auto;

    /* Scrollbar gelip gidince layout genişliği değişmesin */
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;

    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-family-base);
    font-size: 1rem;
    line-height: 1.6;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Modal açıldığında arka planın kayıp titremesini azaltır.
   JS tarafında modal açarken body'ye .modal-open eklenebilir. */
body.modal-open {
    overflow: hidden;
}

/* ==========================================================================
   GENEL ELEMAN DÜZENİ
   ========================================================================== */

img,
picture,
video,
canvas,
svg,
iframe {
    max-width: 100%;
}

img,
picture,
video,
canvas {
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
}

a {
    color: inherit;
}

table {
    border-collapse: collapse;
}

textarea {
    resize: vertical;
}

input,
select,
textarea,
button {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 3px solid rgba(56, 189, 248, 0.35);
    outline-offset: 2px;
}

/* Font Awesome ikonlarının kendi font ailesini koruması için */
i[class^="fa-"],
i[class*=" fa-"],
.fa,
.fa-solid,
.fa-regular,
.fa-brands {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
}

/* ==========================================================================
   YARDIMCI GLOBAL SINIFLAR
   ========================================================================== */

.text-primary {
    color: var(--primary-color) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.hidden {
    display: none !important;
}

.no-scroll {
    overflow: hidden !important;
}

.no-padding {
    padding: 0 !important;
}

.full-width-card {
    width: 100%;
    max-width: 100%;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobilde yatay taşma yapan uzun kelime/linkleri kırar */
.break-safe {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ==========================================================================
   RESPONSIVE KÖK AYARLARI
   ========================================================================== */

@media (max-width: 1200px) {
    :root {
        --spacing-lg: 22px;
        --spacing-xl: 28px;
    }
}

@media (max-width: 992px) {
    html {
        font-size: 15px;
    }

    :root {
        --spacing-lg: 20px;
        --spacing-xl: 24px;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14.5px;
    }

    :root {
        /*
           Burada --sidebar-width: 100% yapılmadı.
           Çünkü layout.css içinde calc(100vw - var(--sidebar-width)) gibi hesaplar varsa
           mobilde genişlik hesaplarını bozabilir.
        */
        --spacing-md: 12px;
        --spacing-lg: 16px;
        --spacing-xl: 20px;
        --mobile-bottom-nav-height: 72px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    :root {
        --spacing-sm: 8px;
        --spacing-md: 10px;
        --spacing-lg: 14px;
        --spacing-xl: 18px;
        --mobile-bottom-nav-height: 70px;
    }
}

/* ==========================================================================
   HAREKET AZALTMA
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}