/* ============================================================
   BELKENT YAPI - ÖN MUHASEBE SİSTEMİ
   Ana Stil Dosyası
   ============================================================ */

@import url('//fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap');

:root {
    --primary:        #1a3a5c;
    --primary-light:  #2a5298;
    --primary-dark:   #0f2137;
    --accent:         #e8a020;
    --accent-hover:   #d4911a;
    --success:        #1a8a4a;
    --danger:         #c0392b;
    --warning:        #e67e22;
    --info:           #2471a3;
    --sidebar-width:  260px;
    --sidebar-bg:     #0f2137;
    --sidebar-text:   #a8c0d6;
    --sidebar-active: #2a5298;
    --topbar-h:       60px;
    --body-bg:        #f0f4f8;
    --card-bg:        #ffffff;
    --text-main:      #1a2535;
    --text-muted:     #6b7c93;
    --border:         #d8e2ec;
    --radius:         10px;
    --shadow:         0 2px 12px rgba(15,33,55,.08);
    --shadow-md:      0 4px 24px rgba(15,33,55,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    background: var(--body-bg);
    color: var(--text-main);
    height: 100%;
}

/* ── LAYOUT ── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform .3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.sidebar-logo-icon {
    width: 38px; height: 38px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff; font-weight: 800;
    flex-shrink: 0;
}
.sidebar-logo-text { color: #fff; }
.sidebar-logo-text .app-name { font-size: 13px; font-weight: 800; line-height: 1.2; }
.sidebar-logo-text .company-name { font-size: 11px; color: var(--sidebar-text); line-height: 1.2; }

.sidebar-section {
    padding: 20px 12px 6px;
}
.sidebar-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(168,192,214,.45);
    padding: 0 8px;
    margin-bottom: 6px;
}

.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    transition: all .2s;
    margin-bottom: 2px;
}
.sidebar-nav li a:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
}
.sidebar-nav li a.active {
    background: var(--sidebar-active);
    color: #fff;
}
.sidebar-nav li a i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}
.sidebar-nav li a .badge-nav {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ── MAIN CONTENT ── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
    height: var(--topbar-h);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow);
}
.topbar-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
    flex: 1;
}
.topbar-title .breadcrumb-sub {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    display: block;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background .2s;
}
.topbar-user:hover { background: var(--body-bg); }
.topbar-user .avatar {
    width: 34px; height: 34px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
}
.topbar-user .user-info .name { font-size: 13px; font-weight: 700; line-height: 1.2; }
.topbar-user .user-info .role { font-size: 11px; color: var(--text-muted); line-height: 1.2; }

/* ── PAGE CONTENT ── */
.page-content {
    padding: 24px;
    flex: 1;
}

/* ── CARDS ── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.card-header .card-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
    flex: 1;
    margin: 0;
}
.card-body { padding: 20px; }
.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: #fafbfd;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ── STAT CARDS ── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-icon.blue   { background: rgba(42,82,152,.12); color: var(--primary-light); }
.stat-icon.green  { background: rgba(26,138,74,.12);  color: var(--success); }
.stat-icon.orange { background: rgba(232,160,32,.12); color: var(--accent); }
.stat-icon.red    { background: rgba(192,57,43,.12);  color: var(--danger); }
.stat-icon.purple { background: rgba(116,75,162,.12); color: #7449a1; }
.stat-icon.teal   { background: rgba(26,163,145,.12); color: #1aa391; }
.stat-info .stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.stat-info .stat-value { font-size: 22px; font-weight: 800; line-height: 1.2; }
.stat-info .stat-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
    white-space: nowrap;
}
.btn:focus { outline: 2px solid var(--primary-light); outline-offset: 2px; }
.btn-primary { background: var(--primary-light); color: #fff; }
.btn-primary:hover { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #157a3f; color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #a93226; color: #fff; }
.btn-warning { background: var(--accent); color: #fff; }
.btn-warning:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: #e8edf3; color: var(--text-main); }
.btn-secondary:hover { background: #d5dce6; color: var(--text-main); }
.btn-outline-primary { background: transparent; border: 2px solid var(--primary-light); color: var(--primary-light); }
.btn-outline-primary:hover { background: var(--primary-light); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-icon { padding: 7px; border-radius: 8px; }

/* ── TABLES ── */
.table-wrapper { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
}
.data-table thead th {
    background: #f5f8fb;
    padding: 11px 14px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #fafcff; }
.data-table tfoot td {
    padding: 12px 14px;
    border-top: 2px solid var(--primary);
    font-weight: 800;
    background: #f5f8fb;
}

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control, .form-select {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 13.5px;
    color: var(--text-main);
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(42,82,152,.1);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.invalid-feedback { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ── ALERTS & FLASH ── */
.alert {
    padding: 13px 16px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    margin-bottom: 16px;
}
.alert-success { background: #eaf7f0; border: 1px solid #aed6be; color: #145c2e; }
.alert-danger   { background: #fdf0ef; border: 1px solid #f1a89c; color: #7c1c14; }
.alert-warning  { background: #fef9ec; border: 1px solid #f5d48e; color: #7a4e0e; }
.alert-info     { background: #eaf2fb; border: 1px solid #9dc4e8; color: #1a4d72; }

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
}
.badge.bg-success  { background: rgba(26,138,74,.12);  color: #145c2e; }
.badge.bg-danger   { background: rgba(192,57,43,.12);  color: #7c1c14; }
.badge.bg-warning  { background: rgba(232,160,32,.15); color: #7a4e0e; }
.badge.bg-primary  { background: rgba(42,82,152,.12);  color: #1a2e6b; }
.badge.bg-secondary{ background: rgba(107,124,147,.12);color: #4a5568; }
.badge.bg-info     { background: rgba(36,113,163,.12); color: #1a4d72; }

/* ── PAGINATION ── */
.pagination { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pagination .page-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--text-main);
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
}
.pagination .page-btn:hover  { background: var(--primary-light); color: #fff; border-color: var(--primary-light); }
.pagination .page-btn.active { background: var(--primary-light); color: #fff; border-color: var(--primary-light); }
.pagination .page-btn.disabled { opacity: .4; pointer-events: none; }

/* ── MODAL ── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(10,20,40,.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(10,20,40,.25);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn .25s ease;
}
.modal-box.sm { max-width: 420px; }
.modal-box.md { max-width: 640px; }
.modal-box.lg { max-width: 880px; }
.modal-box.xl { max-width: 1100px; }
@keyframes modalIn {
    from { opacity: 0; transform: scale(.95) translateY(-20px); }
    to   { opacity: 1; transform: scale(1)  translateY(0);      }
}
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.modal-title { font-size: 16px; font-weight: 800; flex: 1; }
.modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 20px; color: var(--text-muted); padding: 4px;
    border-radius: 6px; line-height: 1;
}
.modal-close:hover { background: var(--body-bg); color: var(--text-main); }
.modal-body  { padding: 22px; }
.modal-footer{ padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── TABS ── */
.tab-bar {
    display: flex;
    border-bottom: 2px solid var(--border);
    gap: 2px;
    margin-bottom: 20px;
}
.tab-btn {
    padding: 10px 18px;
    font-family: 'Nunito', sans-serif;
    font-size: 13.5px;
    font-weight: 700;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all .2s;
    border-radius: 6px 6px 0 0;
}
.tab-btn:hover { color: var(--primary-light); background: rgba(42,82,152,.05); }
.tab-btn.active { color: var(--primary-light); border-bottom-color: var(--primary-light); background: rgba(42,82,152,.05); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── SEARCH BAR ── */
.search-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.search-input-wrap i {
    position: absolute;
    left: 11px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}
.search-input-wrap input {
    padding-left: 34px !important;
}

/* ── PROGRESS BAR ── */
.progress { background: #e8edf3; border-radius: 20px; overflow: hidden; height: 8px; }
.progress-bar {
    height: 100%;
    border-radius: 20px;
    background: var(--primary-light);
    transition: width .4s;
}
.progress-bar.green  { background: var(--success); }
.progress-bar.orange { background: var(--accent); }
.progress-bar.red    { background: var(--danger); }

/* ── GRID HELPERS ── */
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.col { flex: 1; min-width: 0; }
.col-auto { flex: 0 0 auto; }
.col-2 { flex: 0 0 calc(50% - 8px); }
.col-3 { flex: 0 0 calc(33.333% - 11px); }
.col-4 { flex: 0 0 calc(25% - 12px); }

/* ── UTILITIES ── */
.text-right { text-align: right; }
.text-center{ text-align: center; }
.text-muted { color: var(--text-muted) !important; }
.text-success{ color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning{ color: var(--accent) !important; }
.fw-bold { font-weight: 800 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }
.mt-auto { margin-top: auto !important; }
.d-flex { display: flex !important; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-1 { gap: 8px !important; }
.gap-2 { gap: 16px !important; }
.w-100 { width: 100% !important; }
.p-0 { padding: 0 !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── LOGIN PAGE ── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.login-logo {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo .logo-box {
    width: 56px; height: 56px;
    background: var(--accent);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    font-weight: 800;
    margin-bottom: 12px;
}
.login-logo h1 { font-size: 18px; font-weight: 800; color: var(--text-main); }
.login-logo p  { font-size: 13px; color: var(--text-muted); }

/* ── RESPONSIVE ── */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .col-2, .col-3, .col-4 { flex: 0 0 100%; }
}
@media (max-width: 576px) {
    .page-content { padding: 16px; }
    .stat-card { flex-direction: column; text-align: center; }
}

/* ── PRINT ── */
@media print {
    .sidebar, .topbar, .btn, .pagination, .search-bar { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ══════════════════════════════════════════════════════════════
   PWA / MOBİL İYİLEŞTİRMELER
══════════════════════════════════════════════════════════════ */

/* Standalone modda (PWA açıkken) safe area desteği */
@media (display-mode: standalone) {
  .topbar {
    padding-top: env(safe-area-inset-top);
  }
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Tablet */
@media (max-width: 992px) {
  .row { flex-wrap: wrap; }
  .col { flex: 0 0 100%; max-width: 100%; }
  .stat-card { padding: 12px 14px; }

  /* Topbar hamburger */
  .topbar-hamburger { display: flex !important; }

  /* Tablo overflow */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 600px; }

  /* Grid layout tek kolon */
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: repeat(4"] {
    grid-template-columns: 1fr !important;
  }
}

/* Telefon */
@media (max-width: 576px) {
  .page-content { padding: 12px; }

  /* Stat kartlar 2'li grid */
  .row.mb-3 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .row.mb-3 .col { flex: unset; }
  .stat-card {
    flex-direction: column;
    text-align: center;
    padding: 12px 10px;
    gap: 6px;
  }
  .stat-icon { width: 36px; height: 36px; font-size: 15px; }
  .stat-value { font-size: 16px !important; }
  .stat-label { font-size: 11px; }
  .stat-sub   { font-size: 10px; }

  /* Topbar */
  .topbar { padding: 0 12px; height: 52px; }
  .topbar-title { font-size: 13px; }
  .user-info { display: none; }
  #pwa-install-btn span { display: none; }

  /* Card */
  .card-header { flex-wrap: wrap; gap: 6px; }
  .card-title  { font-size: 13px; }

  /* Butonlar */
  .btn { padding: 7px 12px; font-size: 12px; }
  .btn-sm { padding: 5px 8px; font-size: 11px; }

  /* Form */
  .search-bar { flex-wrap: wrap; }
  .search-bar input,
  .search-bar select { width: 100% !important; }

  /* Tablo font küçült */
  .data-table th,
  .data-table td { font-size: 12px; padding: 8px 10px; }

  /* Breadcrumb gizle */
  .breadcrumb { display: none; }

  /* Badge */
  .badge { font-size: 10px; padding: 2px 6px; }

  /* Sidebar overlay */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
  }
  .sidebar-overlay.show { display: block; }
}

/* Dokunma iyileştirmeleri */
@media (hover: none) and (pointer: coarse) {
  .btn           { min-height: 40px; }
  .btn-sm        { min-height: 34px; }
  .sidebar-nav li a { min-height: 44px; }
  input, select, textarea { font-size: 16px !important; } /* iOS zoom önleme */
}
