/* =====================
   CSS DEĞİŞKENLERİ
   ===================== */
:root {
    --bg:       #f8fafc;
    --surface:  #ffffff;
    --surface2: #f1f5f9;
    --border:   #e2e8f0;
    --text:     #1e293b;
    --muted:    #64748b;
    --accent:   #2563eb;
    --green:    #10b981;
    --amber:    #f59e0b;
    --orange:   #ea580c;
    --red:      #ef4444;
    --mono:     'DM Mono', monospace;
    --sans:     'DM Sans', sans-serif;
    --nav-h:    52px;   /* üst utility nav */
    --topnav-h: 44px;   /* ana navigasyon */
}

/* =====================
   ANA NAVİGASYON (ikinci satır)
   ===================== */
.topnav {
    background: var(--accent);
    height: var(--topnav-h);
    display: flex;
    align-items: stretch;
    padding: 0 1rem;
    position: sticky;
    top: var(--nav-h);
    z-index: 490;
    flex-shrink: 0;
    gap: 2px;
}

.topnav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    color: rgba(255,255,255,.85);
    font-size: 12px;
    font-family: var(--mono);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: color .15s, background .15s, border-color .15s;
    white-space: nowrap;
    cursor: pointer;
}
.topnav-item:hover   { color: #fff; background: rgba(255,255,255,.1); }
.topnav-item.active  { color: #fff; border-bottom-color: #fff; }
.topnav-item .icon   { font-size: 14px; }

/* Mobil hamburger (topnav) */
.topnav-toggle {
    display: none;
    align-items: center;
    padding: 0 12px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    margin-left: auto;
    background: none;
    border: none;
}

/* Mobilde topnav collapse */
@media (max-width: 768px) {
    .topnav {
        flex-wrap: wrap;
        height: auto;
        padding: 0;
        position: sticky;
        top: var(--nav-h);
    }
    .topnav-brand-area {
        display: flex;
        align-items: center;
        padding: 0 12px;
        height: var(--topnav-h);
        font-size: 12px;
        color: rgba(255,255,255,.9);
        font-family: var(--mono);
    }
    .topnav-toggle { display: flex; height: var(--topnav-h); }
    .topnav-links {
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height .25s ease;
        background: #1d4ed8; /* accent biraz koyu */
        display: flex;
        flex-direction: column;
    }
    .topnav-links.open { max-height: 300px; }
    .topnav-item {
        height: 44px;
        padding: 0 16px;
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    .topnav-item.active { border-left-color: #fff; border-bottom: none; }
}

/* Desktop: links always visible */
@media (min-width: 769px) {
    .topnav-brand-area { display: none; }
    .topnav-links {
        display: flex;
        align-items: stretch;
        gap: 2px;
        max-height: none !important;
        overflow: visible !important;
        background: transparent !important;
        flex-direction: row;
    }
}

/* =====================
   REKLAM ALANI
   ===================== */
.ad-banner {
    width: 100%;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

/* Grafik yanında dikey (sidebar) */
.ad-banner.ad-leaderboard {
    height: 60px;   /* 728×90 oranı → sayfaya sığacak şekilde küçültülmüş */
}

.ad-banner.ad-rectangle {
    height: 120px;  /* 300×250 küçük dikdörtgen */
    width: 300px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.ad-banner img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.ad-label {
    position: absolute;
    top: 3px;
    right: 6px;
    font-size: 9px;
    font-family: var(--mono);
    color: var(--muted);
    opacity: .6;
    pointer-events: none;
}

/* =====================
   RESET & TEMEL
   ===================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =====================
   NAV
   ===================== */
nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 0 1rem;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 500;
    flex-shrink: 0;
    gap: 8px;
}

.nav-brand {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: .06em;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-brand::before {
    content: '';
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-user {
    font-size: 11px;
    color: var(--muted);
    font-family: var(--mono);
}

/* Mobilde nav-user gizle, yer kazandır */
@media (max-width: 600px) {
    .nav-user { display: none; }
    .nav-brand { font-size: 11px; }
}

/* =====================
   BUTONLAR & BADGE
   ===================== */
.btn-nav {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-family: var(--mono);
    cursor: pointer;
    border: 1px solid var(--border);
    text-decoration: none;
    display: inline-block;
    transition: background .15s, color .15s;
    background: var(--surface2);
    color: var(--muted);
    white-space: nowrap;
}
.btn-nav:hover       { background: var(--border); color: var(--text); }
.btn-logout          { background: rgba(239,68,68,.08);  color: #dc2626; border-color: rgba(239,68,68,.2); }
.btn-logout:hover    { background: rgba(239,68,68,.15); }
.btn-admin           { background: rgba(16,185,129,.08); color: #059669; border-color: rgba(16,185,129,.2); }
.btn-admin:hover     { background: rgba(16,185,129,.15); }

.role-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}
.role-free    { background: #eff6ff; color: #2563eb; }
.role-premium { background: #fffbeb; color: #d97706; }
.role-pro     { background: #f5f3ff; color: #7c3aed; }
.role-admin   { background: #ecfdf5; color: #059669; }

/* =====================
   DİL SWITCHER
   ===================== */
.lang-switcher { display: flex; gap: 4px; }

.lang-btn {
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 10px;
    font-family: var(--mono);
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.lang-btn:hover  { background: var(--border); color: var(--text); }
.lang-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

/* =====================
   ANA LAYOUT
   ===================== */
.main {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - var(--nav-h) - var(--topnav-h));
}

/* =====================
   SIDEBAR
   ===================== */
.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Mobilde sidebar panel olarak açılır */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: calc(var(--nav-h) + var(--topnav-h));
        left: 0;
        bottom: 0;
        z-index: 400;
        transform: translateX(-100%);
        transition: transform .25s ease;
        width: 260px;
        box-shadow: 4px 0 12px rgba(0,0,0,0.1);
    }
    .sidebar.open { transform: translateX(0); }
}

.sidebar-section { padding: .75rem .75rem .25rem; }

.section-label {
    font-size: 10px;
    font-family: var(--mono);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 6px;
}

/* =====================
   BÖLGE SEÇ
   ===================== */
.region-select {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--sans);
    outline: none;
    cursor: pointer;
}
.region-select:focus { border-color: var(--accent); }

/* =====================
   İSTASYON LİSTESİ
   ===================== */
.station-list {
    flex: 1;
    overflow-y: auto;
    padding: .5rem;
}
.station-list::-webkit-scrollbar       { width: 4px; }
.station-list::-webkit-scrollbar-track { background: transparent; }
.station-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.station-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    margin-bottom: 4px;
    transition: background .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: 10px;
}
.station-item:hover  { background: var(--surface2); border-color: var(--border); }
.station-item.active { background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.2); }

.station-dot   { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.station-info  { flex: 1; min-width: 0; }
.station-name  { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.station-speed { font-size: 11px; font-family: var(--mono); color: var(--muted); }
.station-arrow { font-size: 16px; flex-shrink: 0; }

/* =====================
   HARİTA ALANI
   ===================== */
.map-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
	
}

#map { 
	flex: 1; z-index:0;
	min-height: 150px;
	}

/* =====================
   MOBİL ARAÇ ÇUBUĞU
   ===================== */
.mobile-toolbar {
    display: none;
    padding: 8px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 8px;
    align-items: center;
}

@media (max-width: 768px) {
    .mobile-toolbar { display: flex; }
	#map { 
	flex: 1; 
	z-index:0;
	min-height: 150px;
	}
}

.btn-toggle-sidebar {
    padding: 6px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-family: var(--mono);
    cursor: pointer;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}

.mobile-region-select {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-family: var(--sans);
    outline: none;
    cursor: pointer;
}

/* Sidebar açıkken overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 399;
}
@media (max-width: 768px) {
    .sidebar-overlay { display: block; pointer-events: none; opacity: 0; transition: opacity .25s; }
    .sidebar-overlay.active { pointer-events: auto; opacity: 1; }
}

/* =====================
   ALT PANEL
   ===================== */
.bottom-panel {
    height: auto;
    flex-shrink: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0,0,0,.03);
    display: flex;
}

/* Mobilde alt panel dikey scroll edilebilir özet */
@media (max-width: 768px) {
    .bottom-panel {
        //height: 200px;
		height: auto;
        //max-height: 60vh;
        flex-direction: column;
        overflow-y: auto;
    }
}

/* =====================
   ANLK DEĞER KARTI
   ===================== */
.current-card {
    width: 200px;
    flex-shrink: 0;
    padding: 1rem 1.25rem;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: row;
    //justify-content: center;
	//justify-content:空间-between !important; /* Elemanları iki uca yasla */
}
.wind_curr {
    //width: 350px;
    flex-shrink: 0;
    //padding: 1rem 1.25rem;
    //border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
@media (max-width: 768px) {
    .current-card {
        width: 100%;
		//display: flex;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-direction: row;
        //align-items: center;
        gap: 10px;
        padding: .75rem 1rem;
        flex-wrap: nowrap !important; /* Alt satıra inmeyi kesinlikle yasakla */
		overflow: hidden;
		justify-content: space-between !important; /* Elemanları iki uca yasla */
    }
	.wind_curr {
		min-width: 0;
		flex: 1;
		flex-shrink: 0;
		//padding: 1rem 1.25rem;
		//border-right: 1px solid var(--border);
		display: flex;
		flex-direction: row;
		justify-content: space-between !important; /* Elemanları iki uca yasla */
	}
}

.current-label { 
	font-size: 10px; font-family: 
	var(--mono); color: var(--muted); t
	ext-transform: uppercase; 
	letter-spacing: .1em; 
	margin-bottom: 4px; 
	
	max-width: 75px;
}
.current-name  { 
	font-size: 13px; 
	font-weight: 500; 
	margin-bottom: 8px; 
	//white-space: nowrap; 
	overflow: hidden; 
	text-overflow: ellipsis; 
	
	max-width: 75px;
	}
.current-speed { font-size: 32px; font-family: var(--mono); font-weight: 300; line-height: 1; }
.current-unit  { font-size: 12px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.current-meta  { display: flex; gap: 12px; margin-top: 8px; flex-direction: column}
.meta-item     { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.meta-val      { color: var(--text); font-weight: 500; }

@media (max-width: 768px) {
    .current-speed { 
		font-size: 22px !important; 
		line-height: 1 !important;
	}
    .current-name  { 
	margin-bottom: 0; 
	overflow: hidden;
        text-overflow: ellipsis; /* Sığmazsa üç nokta koy (...) */
        font-size: 13px;
        flex: 1; /* İsim alanını esnet */
		}
}

/* =====================
   GRAFİK
   ===================== */
.chart-wrap {
    flex: 1;
    padding: .75rem 1rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.chart-title   { font-size: 10px; font-family: var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.chart-premium { font-size: 10px; color: var(--amber); font-family: var(--mono); }

canvas#windChart { flex: 1; }

@media (max-width: 768px) {
    .chart-wrap { 
	
	height: 280px !important; /* Mobilde net bir yükseklik ver */
	min-height: 250px !important;
	//display: block !important;
	display: flex !important;
	flex-direction: column !important;
	position: relative !important;
	
	}
	#graphContainer {
        min-height: 200px;
		flex: 1;
		position: relative;
		width: 100%;
    }
	#graphContainer canvas {
        position: absolute;
        top: 0; left: 0;
        width: 100% !important;
        height: 100% !important;
    }
}

/* =====================
   PUSULA
   ===================== */
.compass-wrap {
    width: 80px;
    flex-shrink: 0;
    //border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: .25rem;
}

@media (max-width: 768px) {
    .compass-wrap { 
	display: flex !important;
	flex-shrink: 0 !important; /* ASLA küçülme */
	margin-left: auto;
	width: 75px !important;
	//display: none; 
	} /* Mobilde gizle, yer kazandır */
	.compass {
        width: 60px !important; /* Mobilde pusulayı biraz ufaltalım ki yer kalsın */
        height: 60px !important;
    }
}

.compass      { position: relative; width: 70px; height: 70px; }
.compass-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.compass-labels          { position: absolute; inset: 0; font-size: 9px; font-family: var(--mono); color: var(--muted); }
.compass-labels span     { position: absolute; }
.compass-labels .N       { top: 2px;    left: 50%; transform: translateX(-50%); }
.compass-labels .S       { bottom: 2px; left: 50%; transform: translateX(-50%); }
.compass-labels .E       { right: 4px;  top: 50%;  transform: translateY(-50%); }
.compass-labels .W       { left: 4px;   top: 50%;  transform: translateY(-50%); }

.compass-arrow {
    width: 4px;
    height: 34px;
    background: linear-gradient(to bottom, var(--red) 50%, var(--accent) 50%);
    border-radius: 2px;
    transform-origin: 50% 50%;
    transition: transform .5s ease;
}

.compass-deg { font-size: 11px; font-family: var(--mono); color: var(--text); font-weight: 600; }
.compass-dir { font-size: 10px; color: var(--muted); font-family: var(--mono); }

/* =====================
   PREMIUM BLUR
   ===================== */
.premium-blur { filter: blur(4px); pointer-events: none; user-select: none; }

/* =====================
   LEAFLET ÖZELLEŞTIRME
   ===================== */
.leaflet-container { background: #f1f5f9 !important; }

.wind-marker-wrap   { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.wind-marker-name   { font-size: 9px; color: #475569; font-family: 'DM Mono',monospace; font-weight: 600; text-shadow: 1px 1px 0 #fff; white-space: nowrap; }
.wind-marker-bubble {
    padding: 4px 8px;
    border-radius: 6px;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    border: 2px solid;
    background: white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    cursor: pointer;
}

.leaflet-popup-content-wrapper {
    background: white !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    color: var(--text) !important;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,.1) !important;
}
.leaflet-popup-tip     { background: white !important; }
.leaflet-popup-content { margin: 10px 14px !important; font-family: 'DM Sans', sans-serif; }

.speed_chart {
    //padding-left: 2px;
	//padding-right: 2px;
	
	max-width: 80px;
}

/* Ana konteynır başlangıçta sıfır yükseklikte ve gizli */
/* Ana konteynır: Ekrana sığdır ve dışarı taşanı gizle */
/* Reklam Kutusu */
/* 1. Reklam ve Grafik alt alta gelsin ama içindekiler bozulmasın */


/* 2. Reklam alanı */

#adContainer {
    background: #ffffff !important; /* Mavi yerine temiz beyaz */
    margin: 0 !important;          /* Dış boşlukları sıfırla */
    padding: 0 !important;         /* İç boşlukları sıfırla */
    border-bottom: 1px solid var(--border);
    display: flex !important;
    flex-direction: column;
    align-items: center;           /* Yatayda tam ortala */
}

/* 2. Reklamın içindeki wrapper'ın sağa/sola taşmasını veya boşluk bırakmasını engelle */
#adContainer {
    width: 100% !important;
    max-width: 100% !important; /* Ekranı aşmasını engelle */
    display: flex !important;
    flex-direction: column !important;
    align-items: center; /* İçerikleri yatayda ortala */
    overflow: hidden !important; /* Taşan reklamı kes */
    background: #ffffff !important;
    border-bottom: 1px solid var(--border);
}

.ad-label {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 10px;
    padding: 3px 0;
    line-height: 1;
    z-index: 20;
    position: relative;
	color: black;
}

#adWrapper {
    /* JS tarafında marginLeft/Right ve marginBottom ile yönetiliyor */
    padding: 0 !important;
    line-height: 0;
}


/* Alt Panel: Eski (çalışan) yatay düzenine geri döner */
.bottom-panel {
    display: flex !important;
    flex-direction: row !important; /* Kart, Grafik, Pusula YAN YANA */
    height: 250px;                 /* PC için sabit veya auto yükseklik */
    width: 100%;
    background: var(--surface);
    flex-shrink: 0;
}

/* Mobilde Alt Panel yine alt alta dönsün */
@media (max-width: 768px) {
    .bottom-panel {
        flex-direction: column !important;
        height: auto;
    }
    .current-card { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
    //.compass-wrap { display: none; }
}


#graphContainer {
    flex: 1;
    position: relative;
    min-height: 120px;  /* Kritik: canvas'a referans yüksekliği */
    width: 100%;
}
#graphContainer canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100% !important;
    height: 100% !important;
}

