/* ============================================================
   dashboard.css — v1
   Kütüphane Takip — Desktop Dashboard Layout
   1024px+ ekranlarda aktif olur.
   Mobil görünüm (<1024px) bu dosyadan etkilenmez.
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --db-sidebar-w:      250px;
  --db-topbar-h:       72px;
  --db-sidebar-bg:     #1e293b;
  --db-sidebar-hover:  #2d3f55;
  --db-sidebar-active: #f97316;
  --db-sidebar-text:   #94a3b8;
  --db-sidebar-title:  #ffffff;
  --db-topbar-bg:      #ffffff;
  --db-topbar-border:  #e2e8f0;
  --db-content-bg:     #f1f5f9;
  --db-card-bg:        #ffffff;
  --db-card-border:    #e2e8f0;
  --db-text-primary:   #0f172a;
  --db-text-muted:     #64748b;
  --db-accent:         #f97316;
  --db-radius:         14px;
  --db-radius-sm:      10px;
}

/* ── Desktop: wrapper (sadece 1024px+) ─────────────────────── */
.db-wrapper {
  display: none; /* mobilden gizli */
}

@media (min-width: 1024px) {
  /* Mobil içeriği gizle, dashboard'u göster */
  .db-mobile-only {
    display: none !important;
  }

  .db-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--db-content-bg);
    font-family: Arial, sans-serif;
  }

  /* ── Sidebar ─────────────────────────────────────────────── */
  .db-sidebar {
    width: var(--db-sidebar-w);
    min-width: var(--db-sidebar-w);
    background: var(--db-sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
  }

  .db-sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }

  .db-sidebar-logo-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--db-sidebar-title);
    letter-spacing: -0.3px;
  }

  .db-sidebar-logo-sub {
    font-size: 12px;
    color: var(--db-sidebar-text);
    margin-top: 3px;
  }

  .db-nav {
    padding: 12px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .db-nav-section { display: none; } /* başlık yok — tek blok nav */

  .db-nav-bottom {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.07);
  }

  .db-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--db-sidebar-text);
    cursor: pointer;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
  }

  .db-nav-item:hover {
    background: var(--db-sidebar-hover);
    color: #ffffff;
  }

  .db-nav-item.active {
    background: rgba(249,115,22,0.15);
    color: var(--db-sidebar-active);
    border-right: 3px solid var(--db-sidebar-active);
  }

  .db-nav-item .db-nav-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
  }

  /* ── Ana alan ────────────────────────────────────────────── */
  .db-main {
    margin-left: var(--db-sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  /* ── Topbar ──────────────────────────────────────────────── */
  .db-topbar {
    height: var(--db-topbar-h);
    background: var(--db-topbar-bg);
    border-bottom: 1px solid var(--db-topbar-border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 90;
  }

  .db-topbar-search {
    flex: 1;
    max-width: 480px;
    position: relative;
  }

  .db-topbar-search input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 40px;
    border: 1px solid var(--db-card-border);
    border-radius: var(--db-radius-sm);
    background: #f8fafc;
    font-size: 14px;
    color: var(--db-text-primary);
    outline: none;
    box-sizing: border-box;
  }

  .db-topbar-search input:focus {
    border-color: var(--db-accent);
    background: #ffffff;
  }

  .db-topbar-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--db-text-muted);
    pointer-events: none;
  }

  .db-topbar-spacer { flex: 1; }

  .db-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .db-topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--db-card-border);
    background: #f8fafc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--db-text-muted);
  }

  .db-topbar-btn:hover {
    background: var(--db-card-border);
  }

  .db-topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--db-accent);
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
  }

  /* ── İçerik ──────────────────────────────────────────────── */
  .db-content {
    padding: 20px 24px;
    flex: 1;
  }

  .db-page-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--db-text-primary);
    margin-bottom: 4px;
  }

  .db-page-sub {
    font-size: 12px;
    color: var(--db-text-muted);
    margin-bottom: 16px;
  }

  /* ── İstatistik kartları ─────────────────────────────────── */
  .db-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }

  .db-stat-card {
    background: var(--db-card-bg);
    border: 1px solid var(--db-card-border);
    border-radius: var(--db-radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .db-stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .db-stat-card-label {
    font-size: 13px;
    color: var(--db-text-muted);
    font-weight: 500;
  }

  .db-stat-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--db-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
  }

  .db-stat-card-value {
    font-size: 26px;
    font-weight: bold;
    color: var(--db-text-primary);
    line-height: 1;
  }

  .db-stat-card-trend {
    font-size: 12px;
    color: var(--db-text-muted);
  }

  .db-stat-card-trend.up   { color: #059669; }
  .db-stat-card-trend.down { color: #dc2626; }
  .db-stat-card-trend.warn { color: #d97706; }

  /* ── Arama dropdown ─────────────────────────────────────── */
  .db-search-dropdown {
    display: none; /* JS açar */
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--db-card-bg);
    border: 1px solid var(--db-card-border);
    border-radius: var(--db-radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    max-height: 320px;
    overflow-y: auto;
    z-index: 200;
  }

  .db-search-dropdown.open { display: block; }

  .db-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--db-card-border);
    transition: background 0.1s;
  }

  .db-search-result:last-child { border-bottom: none; }
  .db-search-result:hover { background: #f8fafc; }

  .db-search-result-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--db-text-primary);
  }

  .db-search-result-meta {
    font-size: 12px;
    color: var(--db-text-muted);
    margin-top: 1px;
  }

  /* ── Ana panel grid ──────────────────────────────────────── */
  .db-panels {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 14px;
  }

  .db-panel {
    background: var(--db-card-bg);
    border: 1px solid var(--db-card-border);
    border-radius: var(--db-radius);
    overflow: hidden;
  }

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

  .db-panel-title {
    font-size: 15px;
    font-weight: bold;
    color: var(--db-text-primary);
  }

  .db-panel-action {
    font-size: 13px;
    color: var(--db-accent);
    cursor: pointer;
    text-decoration: none;
    border: none;
    background: none;
    padding: 0;
  }

  .db-panel-body { padding: 8px 0; }

  /* Son eklenen kitaplar listesi */
  .db-book-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--db-card-border);
    cursor: pointer;
    transition: background 0.1s;
  }

  .db-book-row:last-child { border-bottom: none; }
  .db-book-row:hover { background: #f8fafc; }

  .db-book-cover {
    width: 40px;
    height: 56px;
    border-radius: 6px;
    background: #f1f5f9;
    border: 1px solid var(--db-card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    overflow: hidden;
  }

  .db-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .db-book-info { flex: 1; min-width: 0; }

  .db-book-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--db-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .db-book-meta {
    font-size: 12px;
    color: var(--db-text-muted);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .db-book-badge {
    font-size: 11px;
    font-weight: bold;
    padding: 3px 10px;
    border-radius: 999px;
    flex-shrink: 0;
  }

  .db-book-badge.rafta   { background: #d1fae5; color: #065f46; }
  .db-book-badge.oduncte { background: #fef3c7; color: #92400e; }
  .db-book-badge.geciken { background: #fee2e2; color: #991b1b; }

  /* Yaklaşan iadeler listesi */
  .db-return-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--db-card-border);
  }

  .db-return-row:last-child { border-bottom: none; }

  .db-return-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    flex-shrink: 0;
  }

  .db-return-info { flex: 1; min-width: 0; }

  .db-return-name {
    font-size: 13px;
    font-weight: bold;
    color: var(--db-text-primary);
  }

  .db-return-book {
    font-size: 12px;
    color: var(--db-text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .db-return-date {
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    text-align: right;
  }

  /* ── Tablet (768–1023px) — kompakt sidebar ───────────────── */
}

@media (min-width: 768px) and (max-width: 1023px) {
  .db-wrapper { display: none; } /* tablet hâlâ mobil görünüm */
}

/* ── Geniş ekran (1400px+) ──────────────────────────────────── */
@media (min-width: 1400px) {
  .db-stats-grid {
    gap: 16px;
  }

  .db-panels {
    grid-template-columns: 1fr 440px;
  }

  .db-content {
    padding: 24px 32px;
  }
}
