/**
 * ==============================================================================
 * T.C. BELEDİYESİ TEMİZLİK İŞLERİ MÜDÜRLÜĞÜ
 * SAHA VE KANTAR YÖNETİM SİSTEMİ
 * Saf Vanilla CSS - Sıfır Dış Bağımlılık - Tam Responsive & Yazdırma Destekli
 * ==============================================================================
 */

:root {
  /* Kurumsal Renk Paleti */
  --color-primary: #1d4ed8;
  --color-primary-hover: #1e40af;
  --color-primary-light: #eff6ff;
  --color-primary-border: #bfdbfe;

  --navy-dark: #0f172a;
  --navy-sidebar: #111827;
  --navy-sidebar-hover: #1f2937;
  --navy-sidebar-active: #1e293b;

  --bg-canvas: #f8fafc;
  --bg-card: #ffffff;
  --bg-alt: #f1f5f9;

  --border-color: #e2e8f0;
  --border-dark: #cbd5e1;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #0284c7;
  --info-bg: #e0f2fe;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Consolas, "Liberation Mono", Menlo, Courier, monospace;

  --header-h: 62px;
  --sidebar-w: 240px;
  --footer-h: 38px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 1. TEMEL SIFIRLAMA & TİPOGRAFİ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-main);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

/* 2. UYGULAMA İSKELETİ (LAYOUT) */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

/* ÜST BAŞLIK (HEADER) */
.app-header {
  height: var(--header-h);
  background: var(--navy-dark);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid #1e293b;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  text-transform: uppercase;
  line-height: 1.2;
}

.brand-sub {
  font-size: 10.5px;
  color: #94a3b8;
  font-weight: 500;
}

.header-center {
  display: flex;
  align-items: center;
}

.header-page-title {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid #334155;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: #e2e8f0;
}

.title-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 5px rgba(34, 197, 94, 0.8);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Hızlı Eylem Butonları */
.btn-quick-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-quick-action.btn-create {
  background: var(--color-primary);
  color: #ffffff;
  border: 1px solid #2563eb;
}

.btn-quick-action.btn-create:hover {
  background: var(--color-primary-hover);
}

.btn-quick-action.btn-report {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
}

.btn-quick-action.btn-report:hover {
  background: #334155;
  color: #ffffff;
}

/* Kullanıcı Kapsülü */
.user-capsule {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid #334155;
  padding: 4px 10px 4px 6px;
  border-radius: 20px;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #38bdf8;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 11.5px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.2;
}

.user-role {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
}

.user-role.role-admin {
  color: #fbbf24;
}

/* Çıkış Butonu */
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: #fca5a5;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-logout:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* 3. ANA ALAN & SOL MENÜ (SIDEBAR) */
.main-wrapper {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-h) - var(--footer-h));
  position: relative;
}

.app-sidebar {
  width: var(--sidebar-w);
  background: var(--navy-sidebar);
  border-right: 1px solid #1f2937;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  padding: 10px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-group-title {
  font-size: 10px;
  font-weight: 800;
  color: #6b7280;
  letter-spacing: 0.8px;
  padding: 12px 18px 6px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

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

.nav-item.active {
  background: var(--navy-sidebar-active);
  color: #38bdf8;
  border-left-color: #38bdf8;
  font-weight: 600;
}

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

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  background: #b45309;
  color: #fef3c7;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* 4. ÇALIŞMA ALANI & İÇERİK */
.app-content {
  flex: 1;
  padding: 24px 28px;
  background: var(--bg-canvas);
  overflow-x: auto;
}

.app-footer {
  height: var(--footer-h);
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-badge {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.footer-badge.badge-online {
  color: #16a34a;
}

/* 5. SAYFA BAŞLIĞI & BUTONLAR */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.page-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buton Stilleri */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #ffffff;
}

.btn-outline {
  background: #ffffff;
  color: var(--text-secondary);
  border-color: var(--border-dark);
}

.btn-outline:hover {
  background: var(--bg-alt);
  color: var(--text-main);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
  border-color: var(--success);
}

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

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 10px 20px;
  font-size: 14.5px;
}

/* 6. KPI GÖSTERGE KARTLARI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
}

.kpi-value.highlight {
  color: var(--success);
}

.kpi-unit {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 6px;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* 7. KARTLAR VE PANELLER */
.card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
  overflow: hidden;
}

.card-header {
  padding: 14px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* 8. TABLOLAR (DATA TABLES) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.table thead th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table tbody tr:hover {
  background-color: #f8fafc;
}

.table td.text-center, .table th.text-center {
  text-align: center;
}

.table td.text-right, .table th.text-right {
  text-align: right;
}

/* TÜRK ARAÇ PLAKA ROZETİ */
.plate-badge {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 2px solid #0f172a;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #0f172a;
  padding: 1px 8px 1px 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  vertical-align: middle;
  line-height: 1.3;
}

.plate-badge::before {
  content: "TR";
  background: #003399;
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  padding: 3px 5px;
  margin-right: 7px;
  border-top-left-radius: 1px;
  border-bottom-left-radius: 1px;
  letter-spacing: 0;
}

/* ROZETLER (BADGES) */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.badge-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid var(--color-primary-border);
}

.badge-success {
  background: var(--success-bg);
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge-warning {
  background: var(--warning-bg);
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-danger {
  background: var(--danger-bg);
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.badge-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

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

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-main);
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

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

.form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-main);
  background-color: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-block {
  width: 100%;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

/* Rapor Sayfası (A4 Görünümü) */
.report-paper {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px 36px;
  box-shadow: var(--shadow-sm);
  max-width: 1000px;
  margin: 0 auto 30px;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 16px;
  gap: 16px;
}

.report-logo-box img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.report-title-center {
  text-align: center;
  flex: 1;
}

.report-mun-name {
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #0f172a;
}

.report-sub-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 2px;
}

.report-doc-title {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.report-meta-box {
  text-align: right;
  font-size: 12px;
  color: #334155;
  line-height: 1.6;
}

.report-signatures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 36px;
  page-break-inside: avoid;
}

.signature-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  background: #ffffff;
}

.signature-title {
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.5px;
}

.signature-space {
  height: 48px;
}

.signature-name {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 10. BİLDİRİMLER (ALERTS) */
.alerts-container {
  margin-bottom: 18px;
}

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.alert-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-close-btn {
  background: transparent;
  border: none;
  font-size: 15px;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
}

.alert-close-btn:hover {
  opacity: 1;
}

.alert-success {
  background: var(--success-bg);
  border-color: #86efac;
  color: #14532d;
}

.alert-danger {
  background: var(--danger-bg);
  border-color: #fca5a5;
  color: #7f1d1d;
}

.alert-warning {
  background: var(--warning-bg);
  border-color: #fde047;
  color: #713f12;
}

.alert-info {
  background: var(--info-bg);
  border-color: #7dd3fc;
  color: #0c4a6e;
}

/* 11. MOBİL & DUYARLI UYUM (RESPONSIVE) */
.mobile-toggle {
  display: none;
  background: #1e293b;
  border: 1px solid #334155;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-direction: column;
  gap: 3px;
}

.toggle-bar {
  width: 18px;
  height: 2px;
  background: #cbd5e1;
  border-radius: 1px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  z-index: 99;
}

@media (max-width: 960px) {
  .header-page-title {
    display: none;
  }
}

@media (max-width: 860px) {
  .mobile-toggle {
    display: flex;
  }

  .app-sidebar {
    position: fixed;
    top: var(--header-h);
    bottom: 0;
    left: 0;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease-in-out;
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.open {
    display: block;
  }

  .app-content {
    padding: 16px;
  }

  .btn-quick-action .action-text,
  .user-meta,
  .brand-sub {
    display: none;
  }
}

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

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-actions {
    width: 100%;
  }

  .app-footer {
    flex-direction: column;
    height: auto;
    padding: 12px 16px;
    gap: 6px;
    text-align: center;
  }
}

/* 12. YAZDIRMA (A4 GÜN SONU RESMİ RAPORU) */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 12mm 12mm 12mm;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11px !important;
  }

  .app-header,
  .app-sidebar,
  .sidebar-backdrop,
  .app-footer,
  .page-actions,
  .btn,
  .alerts-container,
  .no-print {
    display: none !important;
  }

  .main-wrapper, .app-container {
    display: block !important;
    min-height: auto !important;
  }

  .app-content {
    padding: 0 !important;
    background: #ffffff !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    margin-bottom: 12px !important;
    page-break-inside: avoid;
  }

  .table th, .table td {
    padding: 6px 8px !important;
    font-size: 10.5px !important;
  }

  .plate-badge {
    border: 1px solid #000000 !important;
    box-shadow: none !important;
  }
}
