/* ==========================================================================
   Enerjik Yapı – Ortak Tema (Bootstrap 5 üzerine)  |  Lacivert + Sarı, minimal
   Tüm yönetim sayfaları bu dosyayı kullanır. Renkler :root içinden değişir.
   ========================================================================== */
:root {
    --navy: #14213d;
    --navy-2: #1c2f57;
    --navy-3: #2a416f;
    --gold: #b98a3e;
    --gold-2: #a37731;
    --gold-soft: #f7f0e1;
    --bg: #f5f6f8;
    --line: #e4e7ec;
    --ink: #1c2434;
    --muted: #667085;
    --ok: #1f7a4d;
    --warn: #b7791f;
    --bad: #b42318;
    --radius: 8px;

    --bs-primary: var(--navy);
    --bs-primary-rgb: 20, 33, 61;
    --bs-body-font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--bg);
    --bs-border-color: var(--line);
    --bs-link-color: var(--navy-2);
    --bs-link-hover-color: var(--gold-2);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--bs-body-font-family);
    background: var(--bg);
    color: var(--ink);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}
h1, h2, h3, h4, h5, h6 { color: var(--navy); font-weight: 700; }
a { color: var(--navy-2); }

/* ---------- Uygulama iskeleti: sidebar + içerik ---------- */
body.app-shell, body.has-sidebar { display: flex; height: 100vh; overflow: hidden; }
.content {
    flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column;
    overflow-y: auto; overflow-x: hidden; position: relative; width: 100%;
    -webkit-overflow-scrolling: touch;
}
.topbar {
    min-height: 62px; background: #fff; border-bottom: 1px solid var(--line);
    border-top: 3px solid var(--navy);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 22px; position: sticky; top: 0; z-index: 999;
}
.topbar strong, .topbar b { color: var(--navy); }
.main-content { padding: 22px; }
.hamburger-trigger, .hamburger {
    display: none; background: #fff; border: 1px solid var(--line); color: var(--navy);
    padding: 7px 12px; border-radius: 6px; font-weight: 700; cursor: pointer; margin-right: 12px; line-height: 1;
}
.header { color: var(--navy); }

/* ---------- Sidebar ---------- */
.sidebar, .sidebar * { color: #cfd6e4 !important; }
.sidebar {
    width: 252px; min-width: 252px; height: 100vh; flex-shrink: 0;
    background: var(--navy) !important; border-right: 1px solid rgba(255,255,255,.06);
    display: flex; flex-direction: column; overflow: hidden; white-space: nowrap;
    transition: width .2s ease, min-width .2s ease, left .25s ease;
}
.sidebar-header {
    height: 66px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; background: #0e182d !important; border-bottom: 2px solid var(--gold);
}
.sidebar-brand, .sidebar-brand span, .sidebar .name { color: #fff !important; }
.sidebar-brand { font-weight: 700; font-size: 1.05rem; letter-spacing: .2px; }
.sidebar-toggle-btn {
    background: rgba(255,255,255,.08) !important; border: 1px solid rgba(255,255,255,.18);
    color: #fff !important; border-radius: 6px; padding: 4px 9px; cursor: pointer; line-height: 1.2;
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,.16) !important; }
.sidebar-user-box {
    display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-size: .9rem;
    background: var(--navy) !important; border-bottom: 1px solid rgba(255,255,255,.08);
}
.user-avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
    display: flex; align-items: center; justify-content: center; font-weight: 700;
    background: var(--gold) !important; color: #fff !important; border: 2px solid rgba(255,255,255,.25);
}
.user-info { display: flex; flex-direction: column; overflow: hidden; line-height: 1.25; }
.user-info .name { font-weight: 700; font-size: .95rem; text-overflow: ellipsis; overflow: hidden; }
.user-info .role { font-size: .75rem; color: #e1c88f !important; }
.sidebar-menu { list-style: none; margin: 0; padding: 8px 0; overflow-y: auto; flex-grow: 1; }
.sidebar-menu li a {
    display: flex; align-items: center; gap: 12px; padding: 11px 16px; text-decoration: none;
    font-size: .93rem; font-weight: 500; border-left: 3px solid transparent;
}
.sidebar-menu li a:hover { background: rgba(255,255,255,.07) !important; }
.sidebar-menu li a:hover, .sidebar-menu li a:hover * { color: #fff !important; }
.sidebar-menu li.active a { background: rgba(185,138,62,.16) !important; border-left-color: var(--gold); }
.sidebar-menu li.active a, .sidebar-menu li.active a * { color: #f0d9a4 !important; }
.sidebar-menu li a .menu-icon { width: 22px; text-align: center; flex-shrink: 0; font-size: 1.05rem; }
.sidebar-menu li.logout-item a, .sidebar-menu li.logout-item a * { color: #f4a49b !important; }

html.sidebar-collapsed .sidebar { width: 68px; min-width: 68px; }
html.sidebar-collapsed .sidebar .sidebar-brand,
html.sidebar-collapsed .sidebar .user-info,
html.sidebar-collapsed .sidebar .menu-text { display: none !important; }
html.sidebar-collapsed .sidebar-header { justify-content: center; padding: 0; }
html.sidebar-collapsed .sidebar-user-box { justify-content: center; padding: 12px 0; }
html.sidebar-collapsed .sidebar-menu li a { justify-content: center; padding: 14px 0; border-left-width: 3px; }

.sidebar-backdrop { display: none; }

/* ---------- Kartlar ---------- */
.card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(16,24,40,.04);
    display: block; position: static; min-width: 0;
}
.card h2, .card h3 { color: var(--navy); }
.data-card, .fatura-card, .welcome-box {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

/* ---------- Formlar ---------- */
.form-group { margin-bottom: 16px; text-align: left; min-width: 0; }
.form-group label, .filter-group label, label.form-label {
    display: block; margin-bottom: 5px; color: #475467; font-weight: 600; font-size: .85rem;
}
/* :where() -> özgüllük 0: sayfaya özel kurallar (ör. .search-box) her zaman kazanır */
:where(input[type=text], input[type=password], input[type=number], input[type=email], input[type=tel],
input[type=date], input[type=month], input[type=time], input[type=search], input[type=url],
input[type=datetime-local], select, textarea) {
    max-width: 100%; border: 1px solid #cfd4dc; border-radius: 6px; background-color: #fff;
    color: var(--ink); font-size: .95rem; padding: 9px 11px; outline: none; font-family: inherit;
}
.form-control, .form-select { border: 1px solid #cfd4dc; border-radius: 6px; font-size: .95rem; padding: 9px 11px; }
.form-group input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),
.form-group select, .form-group textarea { width: 100%; }
input:focus, select:focus, textarea:focus, .form-control:focus, .form-select:focus {
    border-color: var(--gold); box-shadow: 0 0 0 3px rgba(185,138,62,.18);
}
input[type=checkbox], input[type=radio] { accent-color: var(--navy); }
input[type=file] { max-width: 100%; }
.filter-group { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 150px; }
.filter-box, .filter-bar {
    display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 18px;
}
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }

/* ---------- Butonlar ---------- */
.btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-secondary, .btn-filter, .btn-clear,
.btn-back, .btn-incele, .btn-excel, .btn-pdf, .btn-info, .btn-dark {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid transparent; border-radius: 6px; padding: 9px 18px; font-weight: 600; font-size: .9rem;
    line-height: 1.3; text-decoration: none !important; cursor: pointer; text-align: center;
    color: #fff !important; transition: background .15s, border-color .15s, opacity .15s;
}
.btn-primary { background: var(--navy); border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-3); border-color: var(--navy-3); }
.btn-warning, .btn-filter { background: var(--gold); border-color: var(--gold); }
.btn-warning:hover, .btn-filter:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn-success, .btn-excel { background: var(--ok); border-color: var(--ok); }
.btn-success:hover, .btn-excel:hover { filter: brightness(.93); }
.btn-danger { background: var(--bad); border-color: var(--bad); }
.btn-danger:hover { filter: brightness(.93); }
.btn-secondary, .btn-clear, .btn-back, .btn-dark { background: #475467; border-color: #475467; }
.btn-incele, .btn-info { background: var(--navy-2); border-color: var(--navy-2); }
.btn-pdf { opacity: 1; }
.btn-pdf:hover, .btn-incele:hover, .btn-back:hover, .btn-clear:hover { opacity: .9; }
button:disabled, .btn-primary:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Uyarılar / rozetler ---------- */
.alert { padding: 12px 15px; margin-bottom: 18px; border-radius: 6px; font-size: .92rem; font-weight: 500; border: 1px solid transparent; }
.alert.success, .alert-success { background: #ecfdf3; color: #14653f; border-color: #abefc6; }
.alert.error, .alert.danger, .alert-danger { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.alert.warning, .alert-warning { background: var(--gold-soft); color: #7a5412; border-color: #ecd9ae; }
.alert.info, .alert-info { background: #eef4ff; color: #1c3b7a; border-color: #c7d7fe; }

/* ---------- Tablolar ---------- */
.table-responsive, .table-wrap, .table-container, .table-scroll {
    width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
table { border-collapse: collapse; }
:where(table) { width: 100%; }
:where(th) { background: #f2f4f7; color: #344054; font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
:where(td) { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.mega-table, .history-table, .list-table, .info-table, .fatura-table, .endeks-table, .modal-table {
    width: 100%; font-size: .86rem;
}
.mega-table th, .history-table th, .list-table th, .info-table th, .fatura-table th, .endeks-table th, .modal-table th {
    background: #f2f4f7; color: #344054; font-weight: 600; text-align: left;
    border-bottom: 1px solid var(--line); padding: 10px 12px; white-space: nowrap;
}
.mega-table td, .history-table td, .list-table td, .info-table td, .fatura-table td, .endeks-table td, .modal-table td {
    padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle;
}
.mega-table tbody tr:hover, .history-table tbody tr:hover, .list-table tbody tr:hover { background: #fafbfc; }

.badge { border-radius: 20px; font-size: .74rem; font-weight: 700; padding: 3px 9px; }

/* ---------- Modal ---------- */
.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 99999;
    background: rgba(14,24,45,.72); justify-content: center; align-items: center; padding: 14px;
}
.modal-content, .modal-box {
    background: #fff; width: 100%; max-width: 850px; border-radius: 10px; overflow: hidden;
    display: flex; flex-direction: column; max-height: 92vh; box-shadow: 0 24px 48px -12px rgba(0,0,0,.35);
}
.modal-header {
    background: var(--navy); color: #fff; padding: 14px 20px; display: flex;
    justify-content: space-between; align-items: center; border-bottom: 3px solid var(--gold);
    flex-shrink: 0;
}
.modal-header h3, .modal-header h2, .modal-header span { color: #fff; margin: 0; font-size: 1.05rem; }
.modal-body { padding: 18px 20px; overflow-y: auto; overflow-x: auto; flex: 1 1 auto; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; background: #fafbfc; }
.modal-close-btn, .close-btn { background: none; border: 0; color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; }

/* ---------- Genel yardımcılar ---------- */
img { max-width: 100%; height: auto; }
.text-right { text-align: right; } .text-center { text-align: center; }
pre, code { white-space: pre-wrap; word-break: break-word; }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
    .sidebar { position: fixed; left: -260px; top: 0; z-index: 100000; width: 252px; min-width: 252px; }
    html.sidebar-open .sidebar { left: 0; box-shadow: 6px 0 24px rgba(0,0,0,.35); }
    html.sidebar-open .sidebar .sidebar-brand, html.sidebar-open .sidebar .user-info,
    html.sidebar-open .sidebar .menu-text { display: inline !important; }
    html.sidebar-open .sidebar .user-info { display: flex !important; }
    html.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 99990; background: rgba(14,24,45,.5); }
    html.sidebar-collapsed .sidebar { width: 252px; min-width: 252px; }
    .hamburger-trigger, .hamburger { display: inline-block; }
    .main-content { padding: 14px 12px; }
    .topbar { padding: 8px 12px; }
}
@media (max-width: 768px) {
    .grid-layout, .data-grid, .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
    .filter-group { min-width: 100%; }
    .filter-box > *, .filter-bar > * { flex: 1 1 100%; }
    .card { padding: 15px; }
    .modal-overlay { padding: 6px; align-items: flex-end; }
    .modal-content, .modal-box { max-height: 96vh; border-radius: 12px 12px 0 0; }
    .modal-footer > * { flex: 1 1 auto; }
    .btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-secondary { padding: 10px 14px; }
    input, select, textarea { font-size: 16px !important; } /* iOS/Android zoom engeli */
    .search-container { width: 100% !important; max-width: 100%; }
}

@media print {
    .sidebar, .topbar, .no-print, .sidebar-backdrop { display: none !important; }
    body.app-shell, body.has-sidebar { display: block; height: auto; overflow: visible; }
    .content { overflow: visible; }
}

/* Sayfa bazlı tablo kapsayıcıları: yatay kaydırma (mobil) */
.mega-table-container, .history-table-wrapper, .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
