/* =====================================================
   BIST Screener Pro - Dual Theme (Dark/Light)
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=DM+Sans:wght@400;500;600;700&display=swap');

/* Varsayılan Dark Theme */
:root {
    --bg: #0d0f14;
    --surface: #161a23;
    --border: #252b38;
    --accent: #f0b429;
    --green: #22c55e;
    --red: #ef4444;
    --muted: #6b7280;
    --text: #e2e8f0;
    --text-bright: #ffffff;
    --border-hover: #333333;
    --hover-bg: rgba(255,255,255,0.03);
    --card-hover-bg: rgba(255,255,255,0.02);
    --table-header-bg: rgba(255,255,255,0.02);
    --table-hover-bg: rgba(255,255,255,0.02);
    --btn-sec-bg: rgba(255,255,255,0.04);
    --input-bg: rgba(255,255,255,0.03);
    --section-title-bg: rgba(255,255,255,0.01);
    --menu-bg: rgba(22, 26, 35, 0.95);
    --mono: 'Space Mono', monospace;
    --sans: 'DM Sans', sans-serif;
    --sidebar-width: 240px;
    --radius: 10px;
    --radius-sm: 6px;
}

/* Light Theme */
body.theme-light {
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --accent: #d97706;
    --green: #16a34a;
    --red: #dc2626;
    --muted: #64748b;
    --text: #1e293b;
    --text-bright: #0f172a;
    --border-hover: #cbd5e1;
    --hover-bg: rgba(0,0,0,0.05);
    --card-hover-bg: rgba(0,0,0,0.03);
    --table-header-bg: rgba(0,0,0,0.03);
    --table-hover-bg: rgba(0,0,0,0.02);
    --btn-sec-bg: rgba(0,0,0,0.05);
    --input-bg: rgba(0,0,0,0.03);
    --section-title-bg: rgba(0,0,0,0.02);
    --menu-bg: rgba(255, 255, 255, 0.95);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: #f5c842; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 3px; }

/* Light mode scrollbar */
body.theme-light ::-webkit-scrollbar-thumb { background: #94a3b8; }

/* ---- Layout ---- */
.app-layout { 
    display: flex; 
    width: 100%;
    min-height: 100vh; 
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 10000; /* Sidebar'ın her şeyin üstünde olduğundan emin ol */
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand > div {
    flex: 1;
}

.sidebar-brand button {
    transition: transform 0.2s ease;
}

.sidebar-brand button:hover {
    transform: scale(1.1);
}

.sidebar-brand-icon {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; color: #0d0f14;
}

.sidebar-brand-text {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.sidebar-brand-version {
    font-size: 10px;
    color: var(--muted);
    font-family: var(--mono);
}

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-section { margin-bottom: 20px; }

.nav-section-title {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
    padding: 0 12px;
    margin-bottom: 6px;
}

.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 1px;
}

.nav-link:hover { background: var(--hover-bg); color: var(--text); }

.nav-link.active {
    background: rgba(240,180,41,0.1);
    color: var(--accent);
    border: 1px solid rgba(240,180,41,0.15);
}

.nav-link .nav-icon { font-size: 16px; width: 22px; text-align: center; }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }

.sidebar-user {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--card-hover-bg);
}

.sidebar-user-avatar {
    width: 32px; height: 32px;
    border-radius: 6px;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; color: #0d0f14;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: var(--muted); font-family: var(--mono); }

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width) !important;
    width: calc(100% - var(--sidebar-width)) !important;
    padding: 24px 30px;
    display: block;
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
}

.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}

.page-title {
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: -0.5px;
}

.page-subtitle { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.card:hover { border-color: var(--border-hover); }

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
}

/* ---- Stat Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    width: 100%;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex; align-items: flex-start; gap: 14px;
}

.stat-card:hover { border-color: var(--border-hover); }

.stat-icon {
    width: 42px; height: 42px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}

.stat-icon.green { background: rgba(34,197,94,0.1); color: var(--green); }
.stat-icon.blue { background: rgba(59,130,246,0.1); color: #3b82f6; }
.stat-icon.purple { background: rgba(124,58,237,0.1); color: #7c3aed; }
.stat-icon.yellow { background: rgba(240,180,41,0.1); color: var(--accent); }
.stat-icon.red { background: rgba(239,68,68,0.1); color: var(--red); }

.stat-info { flex: 1; }

.stat-label {
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: 4px;
}

.stat-value { font-family: var(--mono); font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--text-bright); }

/* ---- Grid ---- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

/* ---- Tables ---- */
.table-container { overflow-x: auto; border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; }

th {
    background: var(--table-header-bg);
    padding: 10px 14px;
    text-align: left;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--table-hover-bg); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; font-family: var(--sans);
    border: none; cursor: pointer; white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #0d0f14;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.btn-primary:hover { background: #f5c842; color: #0d0f14; }

.btn-secondary {
    background: var(--btn-sec-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--border-hover); color: var(--text-bright); }

.btn-danger {
    background: rgba(239,68,68,0.1);
    color: var(--red);
    border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover { background: rgba(239,68,68,0.15); }

.btn-success {
    background: rgba(34,197,94,0.1);
    color: var(--green);
    border: 1px solid rgba(34,197,94,0.2);
}

.btn-success:hover { background: rgba(34,197,94,0.15); }

.btn-sm { padding: 5px 12px; font-size: 11px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: var(--sans);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(240,180,41,0.1);
}

.form-control::placeholder { color: var(--muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

textarea.form-control { min-height: 90px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center;
    font-family: var(--mono);
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge-green { background: rgba(34,197,94,0.12); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.badge-red { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.badge-blue { background: rgba(59,130,246,0.12); color: #3b82f6; border: 1px solid rgba(59,130,246,0.2); }
.badge-yellow { background: rgba(240,180,41,0.12); color: var(--accent); border: 1px solid rgba(240,180,41,0.2); }
.badge-purple { background: rgba(124,58,237,0.12); color: #7c3aed; border: 1px solid rgba(124,58,237,0.2); }

/* ---- Alerts ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}

.alert-error { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.15); color: var(--red); }

/* ---- Price Colors ---- */
.price-up, .up { color: var(--green); }
.price-down, .down { color: var(--red); }

/* ---- Chart ---- */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px; /* Sabit yükseklik, Chart.js'in çıldırmasını önler */
    overflow: hidden;
}

/* ---- Modal ---- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1040;
    align-items: center; justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 90%; max-width: 500px;
    max-height: 90vh; overflow-y: auto;
}

.modal-title {
    font-family: var(--mono);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 20px;
}

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---- AI Result ---- */
.ai-result {
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 500px;
    overflow-y: auto;
}

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state-text { font-size: 14px; margin-bottom: 6px; }

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
}

.login-card {
    width: 100%; max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
}

.login-logo { text-align: center; margin-bottom: 28px; }

.login-logo-icon {
    width: 52px; height: 52px;
    background: var(--accent);
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 700; color: #0d0f14;
    margin-bottom: 14px;
}

.login-logo h1 {
    font-family: var(--mono);
    font-size: 18px; font-weight: 700; color: var(--text-bright);
    letter-spacing: 1px;
}

.login-logo p { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---- Live Analysis Page ---- */
.live-search-box {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.live-search-box:focus-within { border-color: var(--accent); }

.live-search-box input {
    flex: 1;
    padding: 12px 16px;
    background: transparent; border: none; outline: none;
    font-family: var(--mono);
    font-size: 15px; color: var(--text-bright);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.live-search-box input::placeholder {
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0;
}

.live-search-box button {
    padding: 12px 20px;
    background: var(--accent);
    border: none; cursor: pointer;
    font-family: var(--mono);
    font-size: 12px; font-weight: 700;
    color: #0d0f14; letter-spacing: 1px;
}

.live-search-box button:hover { background: #f5c842; }

.quick-links {
    margin-top: 8px;
    display: flex; flex-wrap: wrap; gap: 5px; justify-content: center;
}

.quick-links a {
    font-family: var(--mono);
    font-size: 10px;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--muted);
    cursor: pointer; letter-spacing: 1px;
}

.quick-links a:hover { border-color: var(--accent); color: var(--accent); }

/* Live Card */
.live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
}

.live-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex; flex-direction: column;
}

.live-card-head {
    padding: 18px 20px;
    display: flex; justify-content: space-between; align-items: flex-start;
    border-bottom: 1px solid var(--border);
}

.live-symbol { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--text-bright); }
.live-tarih { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 4px; }
.live-fiyat-wrap { text-align: right; }
.live-fiyat { font-family: var(--mono); font-size: 26px; font-weight: 700; }
.live-degisim {
    font-family: var(--mono); font-size: 12px;
    display: inline-block; padding: 2px 8px;
    border-radius: 4px; margin-top: 2px;
}

.bg-up { background: rgba(34,197,94,0.12); }
.bg-down { background: rgba(239,68,68,0.12); }
.bg-flat { background: rgba(107,114,128,0.12); }

.cache-badge {
    font-family: var(--mono); font-size: 9px;
    padding: 1px 5px; border-radius: 3px;
    background: rgba(107,114,128,0.1);
    color: var(--muted); border: 1px solid rgba(107,114,128,0.15);
    margin-left: 4px;
}

.section-title {
    padding: 8px 20px;
    font-family: var(--mono); font-size: 10px;
    letter-spacing: 2px; text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: var(--section-title-bg);
}

.data-grid { display: grid; grid-template-columns: 1fr 1fr; }

.data-item { padding: 12px 20px; border-bottom: 1px solid var(--border); }
.data-item:nth-child(odd) { border-right: 1px solid var(--border); }
.data-item .label { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.data-item .value { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--text-bright); }
.data-item.red .value { color: var(--red); }
.data-item.grn .value { color: var(--green); }

.aort-fark { font-family: var(--mono); font-size: 11px; margin-left: 4px; }

.period-section { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.period-section h3 { font-family: var(--mono); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.period-rows { display: flex; flex-direction: column; gap: 10px; }
.period-row { display: flex; align-items: center; gap: 8px; }
.p-label { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--muted); width: 60px; }
.p-bar-wrap { flex: 1; position: relative; height: 4px; background: var(--border); border-radius: 2px; }
.p-bar { position: absolute; top: 0; left: 0; height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--red), var(--accent), var(--green)); }
.p-dot { position: absolute; top: 50%; transform: translate(-50%,-50%); width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.p-vals { font-family: var(--mono); font-size: 10px; white-space: nowrap; }
.p-low { color: var(--red); }
.p-high { color: var(--green); }

.hacim-section {
    padding: 14px 20px;
    display: flex; justify-content: space-between;
    gap: 14px; flex-wrap: wrap; margin-top: auto;
}

.h-label { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.h-value { font-family: var(--mono); font-size: 13px; color: var(--accent); }

.refresh-bar { padding: 8px 20px 10px; border-top: 1px solid var(--border); }
.refresh-label { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 4px; text-align: center; }
.refresh-track { height: 2px; background: var(--border); border-radius: 1px; }
.refresh-fill { height: 100%; background: var(--accent); border-radius: 1px; width: 100%; transition: width 1s linear; }

.raw-table-wrap { padding: 0 0 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.raw-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.raw-table thead tr { background: var(--table-header-bg); }
.raw-table th { padding: 7px 14px; font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); text-align: left; border-bottom: 1px solid var(--border); font-weight: 400; }
.raw-table td { padding: 8px 14px; font-family: var(--mono); font-size: 12px; color: var(--text); border-bottom: 1px solid var(--border); }
.raw-table tr:last-child td { border-bottom: none; }
.raw-table tr:hover td { background: var(--table-hover-bg); }
.raw-table td.num { text-align: right; }
.raw-table td.red { color: var(--red); }
.raw-table td.grn { color: var(--green); }

.error-box {
    padding: 14px 18px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius-sm);
    color: #fca5a5;
    font-size: 13px;
    text-align: center;
}

/* ---- Mobile Toggle ---- */
.mobile-toggle, #mobile-toggle {
    display: none;
    position: fixed; 
    bottom: 20px; 
    right: 20px; 
    z-index: 99999;
    width: 50px; 
    height: 50px;
    border-radius: 50%;
    background: var(--accent); 
    color: #0d0f14;
    border: none; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* ---- Utility ---- */
.text-green { color: var(--green) !important; }
.text-red { color: var(--red) !important; }
.text-blue { color: #3b82f6 !important; }
.text-muted { color: var(--muted) !important; }
.text-center { text-align: center; }
.font-mono { font-family: var(--mono); }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-1 { flex: 1; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 991px) {
    .sidebar {
        left: -100%; /* Daha güvenli bir gizleme yöntemi */
        width: 260px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.active {
        left: 0;
        z-index: 1050; /* Sidebar her zaman üstte */
    }

    /* Sidebar açıkken arka planı karart */
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1049;
    }

    /* Toggle butonunu mobilde zorla göster */
    .mobile-toggle, #mobile-toggle {
        display: flex !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 16px; /* Mobilde daha dar padding */
    }

    /* Mobilde kartlar 2'li veya 1'li dizilsin */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-title { font-size: 18px; }
    .stat-value { font-size: 20px; }
    .live-grid { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr; /* Çok küçük ekranlarda tek sütun */
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =====================================================
   KARARGAH ÖZEL DASHBOARD STİLİ (Güncel ve Konsolide)
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px; /* Daha havadar bir görünüm için gap artırıldı */
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
}


.pro-card { 
    background: var(--surface); 
    border: 1px solid var(--border); 
    border-radius: 12px; 
    overflow: hidden; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.pro-card-header {
    background: var(--table-header-bg); 
    padding: 18px 25px; 
    border-bottom: 1px solid var(--border); 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    font-weight: bold;
    color: var(--accent);
}

.pro-table thead th { 
    background: var(--table-header-bg); 
    color: var(--muted); 
    font-weight: 600; 
    text-transform: uppercase; 
    font-size: 0.75rem; 
    padding: 15px; 
    border: none; 
}

.pro-table td { 
    padding: 15px; 
    border-bottom: 1px solid var(--border); 
    color: var(--text); 
}

@media (max-width: 1024px) {
    .portfolio-grid { grid-template-columns: 1fr; }
    .main-grid { grid-template-columns: 1fr; }
}

/* =====================================================
   QUANT METRICS & BETA GAUGE STYLES
   ===================================================== */
.quant-bar-wrap {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
}

.quant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.quant-header span {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--muted);
    text-transform: uppercase;
}

.beta-badge {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.beta-badge.agresif { background: rgba(239, 68, 68, 0.15); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.2); }
.beta-badge.defansif { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.2); }
.beta-badge.paralel { background: rgba(34, 197, 94, 0.15); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.2); }

.quant-gauge {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
}

.gauge-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-fill.agresif { background: linear-gradient(90deg, #3b82f6, var(--red)); }
.gauge-fill.defansif { background: linear-gradient(90deg, #1e293b, #3b82f6); }
.gauge-fill.paralel { background: linear-gradient(90deg, #3b82f6, var(--green)); }

.quant-footer {
    display: flex;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text);
}

.quant-footer strong { color: var(--text-bright); }
.quant-footer strong.p-up { color: var(--green); text-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }

/* =====================================================
   Institutional Grade - Split Button & Margin Alerts
   ===================================================== */
.btn-group { display: inline-flex; position: relative; border-radius: 8px; overflow: visible; z-index: 1001; }

.btn-sniper {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none; color: #fff; padding: 12px 20px; font-weight: bold;
    border-radius: 8px 0 0 8px; transition: 0.3s; font-family: var(--sans);
    cursor: pointer; display: flex; align-items: center; gap: 8px;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
}

.btn-sniper:hover { filter: brightness(1.1); box-shadow: 0 0 20px rgba(34, 197, 94, 0.4); }

.btn-sniper-toggle {
    background: #16a34a; border: none; color: white;
    padding: 12px 15px; border-left: 1px solid rgba(255,255,255,0.2);
    border-radius: 0 8px 8px 0; cursor: pointer; transition: 0.3s;
    height: 100%;
}

.btn-sniper-toggle:hover { background: #15803d; }

.sniper-menu {
    position: absolute; top: 100%; right: 0; min-width: 240px;
    background: var(--menu-bg); backdrop-filter: blur(15px);
    border: 1px solid var(--border); border-radius: 12px; margin-top: 10px;
    display: none; z-index: 9999; box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    overflow: hidden; padding: 6px;
}

.sniper-menu.active { display: block; animation: menuFadeIn 0.2s ease-out; }

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

.sniper-menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; color: var(--text); font-size: 13px;
    border-radius: 8px; transition: 0.2s;
}

.sniper-menu a:hover { background: var(--hover-bg); color: var(--text-bright); }
.sniper-menu a i { width: 16px; color: var(--muted); }
.sniper-menu a:hover i { color: var(--accent); }

.menu-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* Margin Alert Glow */
@keyframes marginPulse {
    0% { box-shadow: 0 0 5px rgba(255, 77, 77, 0.4); }
    50% { box-shadow: 0 0 25px rgba(255, 77, 77, 0.8); border-color: #ef4444; }
    100% { box-shadow: 0 0 5px rgba(255, 77, 77, 0.4); }
}

.liquidity-glow {
    animation: marginPulse 1.5s infinite !important;
    background: rgba(239, 68, 68, 0.05) !important;
    border-color: #ef4444 !important;
}

.margin-badge {
    background: #ef4444; color: #fff; padding: 2px 8px;
    border-radius: 4px; font-size: 10px; font-weight: 700;
    display: none; text-transform: uppercase; letter-spacing: 0.5px;
    font-family: var(--mono);
}

/* Hedge Fund Blue Theme */
.modal-manual { background: #0d1117 !important; border: 1px solid #1f6feb !important; }
.manual-accent { color: #1f6feb !important; }
.btn-manual { background: #1f6feb; color: #fff; border: 1px solid #1f6feb; border-radius: var(--radius-sm); padding: 14px; width: 100%; cursor: pointer; font-weight: 600; font-family: var(--sans); transition: 0.3s; }
.btn-manual:hover { filter: brightness(1.2); box-shadow: 0 0 15px rgba(31, 111, 235, 0.3); }

/* =====================================================
   MOBİL RESPONSIVE - KAPSAMLI DÜZELTMELER
   ===================================================== */

/* ---- Tablet (768px - 1024px) ---- */
@media (max-width: 1024px) {
    /* Grid'leri tek sütuna düşür */
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    
    /* Portfolio grid responsive */
    .portfolio-grid { grid-template-columns: 1fr; }
    .main-grid { grid-template-columns: 1fr; }
    
    /* Backtest sidebar'ı üstte göster */
    .quant-layout { flex-direction: column; }
    .sidebar-lab { 
        width: 100% !important; 
        position: relative !important;
        margin-bottom: 20px;
    }
    
    /* Scanner aside tam genişlik */
    .scanner-aside { width: 100% !important; }
    
    /* Admin dashboard 4'lü grid'i 2'li yap */
    .admin-dashboard .quick-actions { 
        grid-template-columns: repeat(2, 1fr) !important; 
    }
}

/* ---- Mobil Cihazlar (max-width: 991px) ---- */
@media (max-width: 991px) {
    .sidebar {
        left: -100%;
        width: 260px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .sidebar.active {
        left: 0;
        box-shadow: 5px 0 25px rgba(0,0,0,0.5);
    }

    /* Mobil toggle butonu göster */
    .mobile-toggle, #mobile-toggle {
        display: flex !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 16px;
    }

    /* Stats grid 2 sütun */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-title { font-size: 18px; }
    .stat-value { font-size: 20px; }
    .live-grid { grid-template-columns: 1fr; }
    
    /* Sayfa başlıkları mobilde alt alta */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    /* Form row'ları mobilde tek sütun */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Backtest ve screener formları mobilde tek sütun */
    .backtest-form, .screener-form {
        display: flex;
        flex-direction: column;
    }
    
    .backtest-form .form-group,
    .screener-form .form-group {
        min-width: 100% !important;
        margin-bottom: 12px;
    }
}

/* ---- Küçük Mobil Cihazlar (max-width: 768px) ---- */
@media (max-width: 768px) {
    /* Stats grid tek sütun */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* Live grid tek sütun ve minmax değerini düşür */
    .live-grid {
        grid-template-columns: 1fr;
    }
    
    .live-card-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .live-fiyat-wrap {
        text-align: left;
    }
    
    /* Data grid tek sütun */
    .data-grid {
        grid-template-columns: 1fr;
    }
    
    .data-item:nth-child(odd) {
        border-right: none;
    }
    
    /* Modal'lar mobilde tam genişlik */
    .modal {
        width: 95% !important;
        max-width: 95% !important;
        padding: 20px 16px;
        margin: 10px;
    }
    
    /* Inline style ile width verilmiş modalları override et */
    .modal[style*="width: 500px"],
    .modal[style*="width: 480px"],
    .modal[style*="width: 450px"] {
        width: 95% !important;
        max-width: 95% !important;
    }
    
    /* Tablo container'ları mobilde daha dar padding */
    .table-container {
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    /* Tablo font boyutunu küçült */
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px 10px !important;
    }
    
    /* Admin pro tablo */
    .pro-table {
        font-size: 11px;
    }
    
    .pro-table th, .pro-table td {
        padding: 10px 8px !important;
    }
    
    /* Buton grupları mobilde alt alta */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-sniper {
        border-radius: 8px 8px 0 0;
        width: 100%;
        justify-content: center;
    }
    
    .btn-sniper-toggle {
        border-radius: 0 0 8px 8px;
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.2);
        width: 100%;
        justify-content: center;
    }
    
    .sniper-menu {
        position: relative;
        top: auto;
        right: auto;
        margin-top: 8px;
        width: 100%;
    }
    
    /* Portfolio actions mobilde düzenle */
    .portfolio-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .actions {
        flex-direction: column;
        width: 100%;
    }
    
    .actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Chart yüksekliklerini azalt */
    .chart-container {
        height: 250px !important;
    }
    
    /* Sayfa içi chart container'ları */
    .chart-container[style*="height: 350px"],
    .chart-container[style*="height: 320px"] {
        height: 250px !important;
    }
    
    /* Küçük chart'lar */
    .chart-container[style*="height: 200px"] {
        height: 180px !important;
    }
    
    /* Market pulse bar mobilde scroll edilebilir */
    .market-pulse-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .pulse-item {
        min-width: 180px !important;
    }
    
    /* Admin dashboard quick actions 2 sütun */
    .admin-quick-actions {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Scanner tablo wrapper */
    .scanner-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Period rows mobilde düzenle */
    .period-row {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .p-label {
        width: 100%;
    }
    
    /* Hacim section mobilde tek sütun */
    .hacim-section {
        flex-direction: column;
        gap: 12px;
    }
    
    /* Quant bar wrap mobilde düzenle */
    .quant-bar-wrap {
        padding: 12px 16px;
    }
    
    .quant-footer {
        flex-direction: column;
        gap: 4px;
    }
}

/* ---- Çok Küçük Ekranlar (max-width: 576px) ---- */
@media (max-width: 576px) {
    .main-content {
        padding: 12px;
    }
    
    .page-title {
        font-size: 16px;
    }
    
    .page-subtitle {
        font-size: 12px;
    }
    
    /* Stat card'lar daha kompakt */
    .stat-card {
        padding: 14px;
        gap: 10px;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 9px;
    }
    
    /* Card padding azalt */
    .card {
        padding: 16px;
    }
    
    .card-header {
        padding: 12px 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    /* Buton boyutları */
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .btn-sm {
        padding: 4px 10px;
        font-size: 10px;
    }
    
    .btn-lg {
        padding: 10px 16px;
        font-size: 12px;
        width: 100%;
        justify-content: center;
    }
    
    /* Badge font boyutu */
    .badge {
        font-size: 9px;
        padding: 2px 6px;
    }
    
    /* Alert mobilde daha kompakt */
    .alert {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    /* Form kontrol */
    .form-control {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .form-label {
        font-size: 9px;
    }
    
    /* Live search box mobilde düzenle */
    .live-search-box {
        flex-direction: column;
    }
    
    .live-search-box input {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .live-search-box button {
        padding: 10px;
        width: 100%;
    }
    
    /* Quick links mobilde scroll edilebilir */
    .quick-links {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    
    .quick-links a {
        flex-shrink: 0;
    }
    
    /* Login card mobilde */
    .login-card {
        padding: 24px 20px;
        margin: 16px;
    }
    
    .login-logo-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    /* Mobile toggle butonu daha küçük */
    .mobile-toggle, #mobile-toggle {
        width: 44px;
        height: 44px;
        bottom: 16px;
        right: 16px;
        font-size: 18px;
    }
    
    /* Sidebar footer mobilde */
    .sidebar-user {
        padding: 6px 8px;
    }
    
    .sidebar-user-avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
    
    /* AI result mobilde */
    .ai-result {
        padding: 12px;
        font-size: 12px;
        max-height: 400px;
    }
    
    /* Empty state mobilde */
    .empty-state {
        padding: 30px 16px;
    }
    
    .empty-state-icon {
        font-size: 32px;
    }
    
    /* Modal actions mobilde */
    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Portfolio overview tablo mobilde */
    .panel table {
        font-size: 11px;
    }
    
    .panel th, .panel td {
        padding: 8px 6px;
    }
    
    /* Symbol font */
    .symbol {
        font-size: 12px;
    }
    
    /* Alpha card */
    .alpha-card {
        padding: 14px;
    }
    
    .stat-card h3 {
        font-size: 1.4rem;
    }
    
    /* Sniper buton mobilde */
    .btn-sniper, .btn-sniper-toggle {
        padding: 10px 14px;
        font-size: 12px;
    }
    
    /* Margin badge mobilde */
    .margin-badge {
        font-size: 8px;
        padding: 1px 5px;
    }
    
    /* Manual trade modal */
    .modal-manual {
        padding: 16px !important;
    }
    
    .btn-manual {
        padding: 12px;
        font-size: 13px;
    }
}

/* ---- Çok Çok Küçük Ekranlar (max-width: 375px) ---- */
@media (max-width: 375px) {
    .stat-value {
        font-size: 16px;
    }
    
    .page-title {
        font-size: 14px;
    }
    
    /* Tablo font daha da küçük */
    table {
        font-size: 11px;
    }
    
    th, td {
        padding: 6px 8px !important;
    }
    
    /* Pulse item daha küçük */
    .pulse-item {
        min-width: 160px !important;
    }
    
    /* Live fiyat daha küçük */
    .live-fiyat {
        font-size: 20px !important;
    }
    
    .live-symbol {
        font-size: 20px !important;
    }
}

/* ---- Yatay Mobil Görünüm (Landscape) ---- */
@media (max-width: 991px) and (orientation: landscape) {
    .sidebar {
        width: 220px;
    }
    
    .chart-container {
        height: 200px !important;
    }
    
    /* Modal yüksekliğini sınırla */
    .modal {
        max-height: 85vh;
    }
}

/* ---- Print Styles ---- */
@media print {
    .sidebar, .mobile-toggle, #mobile-toggle {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    body {
        background: #fff;
        color: #000;
    }
    
    .card, .stat-card, .pro-card {
        border: 1px solid #000;
        background: #fff;
    }
}

/* =====================================================
   EK RESPONSIVE YARDIMCI SINIFLAR
   ===================================================== */

/* Responsive tablo için yardımcı sınıf */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
    width: 100%;
}

/* =====================================================
   EK YARDIMCI RESPONSIVE SINIFLAR (PHP dosyalarında kullanım için)
   ===================================================== */

/* Mobile'da gizle */
@media (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }
}

/* Desktop'ta gizle */
.show-on-mobile {
    display: none;
}

@media (max-width: 768px) {
    .show-on-mobile {
        display: block !important;
    }
}

/* =====================================================
   TOAST NOTIFICATION (main.js showToast için gerekli stiller)
   ===================================================== */

.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000; /* Modal'lardan (1000) her zaman üstte */
    min-width: 300px;
    max-width: 450px;
    padding: 16px 20px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.toast-notification.alert-success {
    border-left: 4px solid var(--green);
    background: rgba(34, 197, 94, 0.05);
}

.toast-notification.alert-error {
    border-left: 4px solid var(--red);
    background: rgba(239, 68, 68, 0.05);
}

.toast-notification.alert-info {
    border-left: 4px solid #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Mobilde Toast */
@media (max-width: 576px) {
    .toast-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
        padding: 12px 16px;
        font-size: 13px;
    }
}

/* =====================================================
   MOBİL EK DÜZELTMELER (Chart & Sidebar)
   ===================================================== */

/* Chart container mobilde taşmasın */
@media (max-width: 768px) {
    .chart-container {
        width: 100% !important;
        overflow: hidden;
    }
    
    .chart-container canvas {
        width: 100% !important;
        height: auto !important;
    }
}

/* Chart container genel düzeltme - kart taşmasını önle */
.chart-container {
    position: relative;
    overflow: hidden; /* Taşmayı engelle */
    width: 100%;
}

.chart-container canvas {
    width: 100% !important;
    max-width: 100% !important;
}

/* Sidebar overlay (JS toggle için) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    backdrop-filter: blur(2px);
}

@media (max-width: 991px) {
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Sidebar açıkken gövde kaymasın */
    body.sidebar-open {
        overflow: hidden;
    }
}

/* Mobil toggle butonu - z-index garantisi */
.mobile-toggle, #mobile-toggle {
    z-index: 10001; /* Toast'tan da üstte */
}

/* =====================================================
   GRAFİK & TABLO YARDIMCILARI
   ===================================================== */

/* Chart wrapper için garanti */
.chart-wrapper-responsive {
    position: relative;
    width: 100% !important;
    overflow: hidden;
}

/* Hacim grafiği özel - kart içinde kalsın */
.chart-container canvas#volumeChart {
    min-width: auto !important;
    width: 100% !important;
}

/* Tablo mobilde scroll edilebilir */
.table-wrapper-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* Mobilde tablo hücreleri wrap edebilsin */
@media (max-width: 768px) {
    .table-wrapper-mobile table {
        font-size: 11px;
    }
    
    .table-wrapper-mobile th,
    .table-wrapper-mobile td {
        padding: 6px 8px !important;
    }
}

/* =====================================================
   SON KONTROL - Print Styles
   ===================================================== */
@media print {
    .sidebar, .mobile-toggle, #mobile-toggle, .toast-notification {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    body {
        background: #fff;
        color: #000;
    }
    
    .card, .stat-card, .pro-card {
        border: 1px solid #000;
        background: #fff;
    }
    
    .chart-container {
        page-break-inside: avoid;
    }
}

