/* ========================================
   🌗 Mefico FX v1.2 — Responsive UI System
   PC: Sidebar aktif | Mobil: Header Menü
   ======================================== */

/* -------------------
   🎨 Tema Değişkenleri
------------------- */
:root {
    --bg: #0e0f11;
    --panel: #151719;
    --panel-2: #121315;
    --txt: #e9eef3;
    --txt-dim: #b9c1c9;
    --brand: #16d1c4;
    --divider: #262a2f;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35);

    --radius-lg: 14px;
    --radius-xl: 18px;

    --sb-collapsed: 72px;
    --sb-expanded: 260px;
    --hdr-h: 64px;
}

/* ☀️ Gündüz Teması */
body.theme-light {
    --bg: #f6f8fb;
    --panel: #ffffff;
    --panel-2: #f1f3f6;
    --txt: #0f1214;
    --txt-dim: #4a5560;
    --divider: #dfe5ec;
    --shadow: 0 8px 24px rgba(0, 0, 0, .08);
}

/* -------------------
   🧩 Genel Yapı
------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    background: radial-gradient(1200px 800px at 25% -10%, rgba(22, 209, 196, .15), transparent 60%), var(--bg);
    color: var(--txt);
    font-family: 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
    margin: 0;
    padding: 0;
}

.wrapper {
    display: flex;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* -------------------
   🧭 SIDEBAR (PC)
------------------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sb-collapsed);
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border-right: 1px solid var(--divider);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, box-shadow 0.3s ease;
    border-top-right-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    z-index: 50;
    overflow: hidden;
}

/* JS tarafından .hover-expand class'ı eklendiğinde genişler */
.sidebar.hover-expand {
    width: var(--sb-expanded);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* ---- Sidebar Header ---- */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    min-height: var(--hdr-h);
    border-bottom: 1px solid var(--divider);
    overflow: hidden;
    /* Taşmayı engelle */
}

/* ---- Logo ---- */
.logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--txt);
}

.sidebar-logo {
    width: 28px;
    height: 28px;
    display: block;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 700;
    font-size: 18px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.25s ease;
    white-space: nowrap;
    /* Metnin kaymamasını sağlar */
}

.sidebar.hover-expand .logo-text {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* ---- Menü ---- */
.sidebar-nav {
    flex: 1;
    padding: 12px 8px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* .nav-item + .nav-item yerine modern 'gap' kullanımı */
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    height: 48px;
    padding: 0 14px;
    border-radius: var(--radius-lg);
    color: var(--txt);
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.25s ease;
    box-sizing: border-box;
    overflow: hidden;
    /* Genişlemede taşmayı engeller */
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-1px);
}

.nav-item.active {
    background: rgba(22, 209, 196, 0.08);
    border: 1px solid rgba(22, 209, 196, 0.2);
    box-shadow: inset 0 0 0 1px rgba(22, 209, 196, 0.25);
}

.nav-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: block;
    /* İSTEK: Renk filtresi kaldırıldı. */
}

.nav-text {
    font-size: 0.95rem;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.25s ease;
    white-space: nowrap;
    /* Metnin kaymamasını sağlar */
}

.sidebar.hover-expand .nav-text {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Dar görünümde yalnız ikon (ve tam hizalı) */
.sidebar:not(.hover-expand) .nav-item {
    justify-content: flex-start;
    gap: 25px;
    padding: 15px;
}

/* Versiyon etiketi */
.sidebar::after {
    content: "v1.2 Mefico-FX";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    text-align: center;
    font-size: 12px;
    color: var(--txt-dim);
    opacity: 0.65;
}

/* -------------------
   💠 CONTENT / HEADER
------------------- */
.content-wrapper {
    flex: 1;
    margin-left: var(--sb-collapsed);
    display: flex;
    flex-direction: column;
    transition: margin-left .3s ease;
}

.sidebar.hover-expand~.content-wrapper {
    margin-left: var(--sb-expanded);
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    height: var(--hdr-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(0, 0, 0, .18), transparent), var(--panel);
    border-bottom: 1px solid var(--divider);
    padding: 0 16px;
    z-index: 40;
    box-shadow: var(--shadow);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-center {
    text-align: center;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

/* Header Butonları (Genel Stil) */
.menu-toggle-btn,
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid var(--divider);
    background: transparent;
    color: var(--txt);
    cursor: pointer;
    transition: all .2s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Mobil menü butonu (sadece ikon) */
.menu-toggle-btn {
    width: 40px;
    padding: 0;
}

.menu-toggle-btn:hover,
.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, .05);
}

.toggle-icon {
    width: 22px;
    height: 22px;
    transition: filter 0.3s ease;
}

/* -------------------
   📱 MOBİL NAV MENÜ
------------------- */
.mobile-nav {
    display: none;
    /* JS ile 'active' olunca 'flex' olacak */
    flex-direction: column;
    background: var(--panel);
    border-top: 1px solid var(--divider);
    box-shadow: var(--shadow);
    position: absolute;
    top: var(--hdr-h);
    left: 0;
    right: 0;
    z-index: 100;
    animation: fadeDown .3s ease forwards;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    color: var(--txt);
    text-decoration: none;
    border-bottom: 1px solid var(--divider);
    transition: background .2s;
}

.mobile-nav-item:hover {
    background: rgba(255, 255, 255, .05);
}

.mobile-nav-item.active {
    background: rgba(22, 209, 196, .1);
    border-color: rgba(22, 209, 196, .3);
}

.mobile-nav-item img {
    width: 24px;
    height: 24px;
    /* İSTEK: Renk filtresi kaldırıldı. */
}

/* Menü aktif olunca görünür */
.mobile-nav.active {
    display: flex;
}

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -------------------
   📱 Mobil Overlay (JS uyumluluğu için eklendi)
------------------- */
#menuOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    /* Mobil menünün (100) altında */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
}

#menuOverlay.active {
    opacity: 1;
    visibility: visible;
}


/* -------------------
   🧠 RESPONSIVE AYARLAR
------------------- */
@media (max-width: 991px) {
    .sidebar {
        display: none;
    }

    .content-wrapper {
        margin-left: 0;
    }

    /* Mobil menü butonunu göster */
    .menu-toggle-btn {
        display: inline-flex;
    }

    .header-center {
        display: none;
    }

    .mobile-nav {
        /* backdrop-filter: blur(8px); JS overlay'i zaten yapıyor */
        border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    }
}

@media (min-width: 992px) {

    /* PC'de mobil menü her zaman gizli kalsın */
    .mobile-nav {
        display: none !important;
    }

    /* PC'de mobil menü butonu gizli kalsın */
    .menu-toggle-btn {
        display: none;
    }
}


/* ---------------------------
   🎨 İSTEĞE GÖRE İKON RENKLENDİRME
------------------------------ */

/* ☀️ Gündüz modu: SADECE menü ikonu orijinal (siyah) */
body.theme-light .toggle-icon {
    filter: none;
}

/* 🌙 Gece modu: SADECE menü ikonu beyaz */
body.theme-dark .toggle-icon {
    filter: brightness(0) invert(1);
}



/* =========================================================
   🌙 Bölüm 4 - Ana İçerik / Kartlar / Modal / Footer
   Tam Uyumlu Renk + Tema + Responsive Yapı
   ========================================================= */

/* --- Genel --- */
.main-content {
    flex: 1;
    padding: 24px;
    min-height: calc(100dvh - var(--hdr-h));
    background: var(--bg);
    color: var(--txt);
    transition: background .3s, color .3s;
}

.main-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

/* =========================================================
   STATUS PANEL
   ========================================================= */
.status-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    margin-bottom: 24px;
    border-radius: var(--radius-lg);
    background: var(--panel);
    border: 1px solid var(--divider);
    box-shadow: var(--shadow);
    transition: all .25s ease;
}

.status-panel span {
    font-size: .9rem;
    color: var(--txt);
}

.update-info {
    color: var(--txt-dim);
    font-size: .8rem;
}

/* Durum Renkleri */
.status-panel.status-error {
    border-color: #f87171;
    color: #fca5a5;
}

.status-panel.status-success {
    border-color: #34d399;
    color: #6ee7b7;
}

.status-panel.status-info {
    border-color: #60a5fa;
    color: #93c5fd;
}

/* =========================================================
   GEÇMİŞ TARİH SEÇİMİ
   ========================================================= */
.historical-query-area {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--panel);
    border: 1px solid var(--divider);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.historical-query-area label {
    font-weight: 600;
    color: var(--txt-dim);
    white-space: nowrap;
}

.date-input {
    flex: 1;
    min-width: 180px;
    padding: 10px 14px;
    background: var(--panel-2);
    border: 1px solid var(--divider);
    border-radius: var(--radius-lg);
    color: var(--txt);
    transition: border-color .2s;
}

.date-input:focus {
    outline: none;
    border-color: var(--brand);
}

.reset-date-btn {
    padding: 10px 16px;
    background: var(--brand);
    border: none;
    border-radius: var(--radius-lg);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
}

.reset-date-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* =========================================================
   PARA BİRİMİ KARTLARI
   ========================================================= */
.currency-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
}

.currency-card {
    background: var(--panel);
    border: 1px solid var(--divider);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all .25s ease;
    position: relative;
}

.currency-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, .35);
}

.currency-card.is-base {
    border-color: var(--brand);
    box-shadow: 0 0 12px rgba(22, 209, 196, .35);
}

/* Kart başlık */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.currency-info {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 10px;
}

.currency-info img {
    width: 32px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid var(--divider);
    object-fit: cover;
}

.currency-code {
    font-size: 1.4rem;
    font-weight: 700;
}

.currency-name {
    font-size: .85rem;
    color: var(--txt-dim);
}

/* Kart butonları */
.card-actions button {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--txt-dim);
    font-size: 1.1rem;
    transition: color .2s;
}

.card-actions .fav-btn.is-favorite {
    color: #facc15;
}

.card-actions .close-btn:hover {
    color: #f87171;
}

/* Giriş alanı */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.currency-input {
    flex: 1;
    font-size: 1.4rem;
    font-weight: 600;
    padding: 12px 42px 12px 14px;
    border: 2px solid var(--divider);
    border-radius: var(--radius-lg);
    text-align: right;
    background: var(--panel-2);
    color: var(--txt);
    transition: all .2s;
}

.currency-input:focus {
    border-color: var(--brand);
    outline: none;
}

.clear-input-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--txt-dim);
    font-size: 1.2rem;
    opacity: 0;
    transition: opacity .2s;
}

.input-wrapper:hover .clear-input-btn {
    opacity: .9;
}

/* Alt bilgi */
.card-footer {
    border-top: 1px dashed var(--divider);
    padding-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-rate {
    font-size: .9rem;
    color: var(--txt-dim);
}

.card-rate span {
    color: var(--txt);
    margin-left: 5px;
}

.trend-indicator {
    font-size: .8rem;
    font-weight: 700;
}

.trend-up {
    color: #34d399;
}

.trend-down {
    color: #f87171;
}

/* =========================================================
   FLOATING BUTTON
   ========================================================= */
.floating-btn {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 2rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(22, 209, 196, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .25s ease;
    z-index: 900;
}

.floating-btn:hover {
    transform: scale(1.07);
    box-shadow: 0 10px 22px rgba(22, 209, 196, .45);
}

/* =========================================================
   MODAL STİLİ
   ========================================================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(5px);
    z-index: 1200;
    justify-content: center;
    align-items: center;
    transition: opacity .25s;
}

.modal-content {
    background: var(--panel);
    color: var(--txt);
    padding: 24px;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow);
    animation: fadeIn .3s ease;
}

.detail-modal .modal-content {
    max-width: 640px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--divider);
    margin-bottom: 16px;
    padding-bottom: 8px;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--brand);
}

.close-modal-btn {
    background: none;
    border: none;
    color: var(--txt-dim);
    font-size: 1.8rem;
    cursor: pointer;
}

.close-modal-btn:hover {
    color: #f87171;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--divider);
    border-radius: var(--radius-lg);
    background: var(--panel-2);
    color: var(--txt);
    margin-bottom: 12px;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.clear-selection-btn {
    border: 1px solid var(--divider);
    background: var(--panel-2);
    color: var(--txt);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    font-size: .9rem;
    cursor: pointer;
    transition: all .2s;
}

.clear-selection-btn:hover {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

#toggleFavorites.active-filter {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* --- Modal Liste --- */
.currency-list-area {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--divider);
    border-radius: var(--radius-lg);
    background: var(--panel-2);
}

.modal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--divider);
    transition: background .2s;
}

.modal-item:hover {
    background: rgba(255, 255, 255, .04);
}

.modal-item:last-child {
    border-bottom: none;
}

.modal-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-item-info img {
    width: 24px;
    height: 18px;
    border-radius: 4px;
}

.modal-code {
    font-weight: 700;
}

.modal-name {
    color: var(--txt-dim);
}

.add-item-btn {
    background: var(--brand);
    color: #fff;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    transition: transform .2s;
}

.add-item-btn:hover {
    transform: scale(1.1);
}

/* --- Detail Modal --- */
.detail-section {
    padding: 12px 0;
    border-bottom: 1px solid var(--divider);
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section h4 {
    color: var(--brand);
    margin-bottom: 6px;
    font-size: 1.05rem;
}

.sparkline-container {
    height: 120px;
    border-radius: var(--radius-lg);
    background: var(--panel-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--txt-dim);
}

/* =========================================================
   FOOTER
   ========================================================= */
.app-footer {
    background: var(--panel);
    border-top: 1px solid var(--divider);
    color: var(--txt-dim);
    font-size: .85rem;
    text-align: center;
    padding: 16px;
    margin-top: auto;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (min-width: 601px) and (max-width: 991px) {
    .currency-cards {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }

    .currency-card {
        padding: 16px;
    }

    .currency-input {
        font-size: 1.3rem;
    }
}

@media (max-width: 600px) {
    .currency-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .currency-card {
        padding: 14px;
        border-radius: 12px;
    }

    .currency-info img {
        width: 26px;
        height: 18px;
    }

    .currency-code {
        font-size: 1.1rem;
    }

    .currency-name {
        font-size: .78rem;
    }

    .currency-input {
        font-size: 1.1rem;
    }

    .floating-btn {
        right: 15px;
        bottom: 15px;
        width: 52px;
        height: 52px;
        font-size: 1.8rem;
    }

    .modal-content {
        padding: 18px;
        width: 92%;
    }
}