/* ════════════════════════════════════════════════════════════════
   RED Design System — Layout
   ════════════════════════════════════════════════════════════════ */

/* ── Skip Link ───────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  background: var(--navy-700);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 8px 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  z-index: 99999;
  transition: top .15s;
  white-space: nowrap;
}
.skip-link:focus { top: 0; }

/* ── Screen-reader only ──────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ───────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ══════════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(255,255,255,.04);
}

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

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

.sidebar-logo-mark {
  width: 32px;
  height: 32px;
  background: var(--navy-700);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.sidebar-logo-text { display: flex; flex-direction: column; gap: 1px; }
.sidebar-logo-name { font-size: 14px; font-weight: 700; color: #F1F5F9; letter-spacing: -.2px; }
.sidebar-logo-sub  { font-size: 10px; color: var(--sidebar-text); letter-spacing: .5px; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 1px; }

.nav-section {
  font-size: var(--nav-section-font-size, 10px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--nav-section-color, var(--gray-600));
  padding: 16px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r-md);
  font-size: var(--sidebar-font-size);
  font-family: var(--sidebar-font);
  font-weight: 500;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background .12s, color .12s;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-surface);
  color: var(--sidebar-text-hover);
}

.nav-item:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: -2px;
}

.nav-item.active {
  background: rgba(30,58,95,.35);
  color: #93c5fd;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: #60a5fa;
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-footer-name { font-size: 13px; font-weight: 600; color: var(--sidebar-text-hover); }
.sidebar-footer-dept { font-size: 11px; color: var(--sidebar-text); }

.role-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--sidebar-border);
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-500);
  letter-spacing: .2px;
}

/* ══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════════ */
.main-content { flex: 1; overflow-y: auto; min-width: 0; }
.page-body { padding: 32px 36px; max-width: 1140px; margin: 0 auto; }

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

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -.4px;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .page-body { padding: 24px 28px; }
}

@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .page-body { padding: 20px; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  /* Drawer modu — sidebar gizli, overlay + slide-in */
  .mobile-menu-btn { display: flex !important; }
  .app-shell { flex-direction: row; }
  .sidebar {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    width: 260px !important;
    height: 100vh !important;
    z-index: 1060;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }
  .sidebar.drawer-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }
  .main-content {
    width: 100%;
    padding-top: 64px; /* hamburger butonu için boşluk */
  }
  .page-body { padding: 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  /* Daraltma butonu mobilde gizle */
  .sidebar-toggle-btn { display: none !important; }
}

/* ══════════════════════════════════════════════════════════
   Sidebar — daraltılabilir mod
   ══════════════════════════════════════════════════════════ */
.nav-label { transition: opacity .15s, width .15s; }
.sidebar-collapsed .sidebar { width: 56px; }
.sidebar-collapsed .nav-label,
.sidebar-collapsed .sidebar-logo-text,
.sidebar-collapsed .sidebar-footer-info,
.sidebar-collapsed .nav-section { display: none; }
.sidebar-collapsed .nav-item  { justify-content: center; padding: 9px; }
.sidebar-collapsed .sidebar-logo { justify-content: center; padding: 16px 8px; }
.sidebar-collapsed .sidebar-toggle-btn { margin-left: 0 !important; }
.sidebar-collapsed .sidebar-footer { padding: 10px 8px; }
.sidebar-toggle-btn {
  width: 32px; height: 32px; border-radius: 6px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  color: var(--sidebar-text); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .15s;
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,.14); }

/* ── LAYOUT utility — page-toolbar, pagination ──────────────── */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-toolbar-left  { flex: 1; min-width: 0; }
.page-toolbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.page-toolbar-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
  letter-spacing: -.3px;
}
.page-toolbar-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.page-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex-shrink: 0; }

.pagination-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; flex-wrap: wrap; gap: 8px; }
.pagination-info { font-size: 12px; color: var(--text-3); }
.pagination-size { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.pagination-size .form-control { width: 70px; padding: 4px 6px; font-size: 12px; }

/* ── Sayfa geçiş animasyonu ──────────────────────────────────── */
.page-body { animation: page-fade-in .15s ease; }
@keyframes page-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .page-body { animation: none; }
}
