/* ============================================================
   ASANSÖR YÖNETİM SİSTEMİ — DESIGN SYSTEM
   Vanilla CSS | Mobile First | Dark Sidebar
   ============================================================ */

/* -------- TOKENS -------- */
:root {
  /* Brand */
  --brand-50:  hsl(215, 100%, 97%);
  --brand-100: hsl(215, 96%,  92%);
  --brand-200: hsl(215, 90%,  82%);
  --brand-400: hsl(215, 80%,  58%);
  --brand-500: hsl(215, 75%,  48%);
  --brand-600: hsl(215, 72%,  40%);
  --brand-700: hsl(215, 68%,  32%);

  /* Neutrals */
  --gray-50:   hsl(220, 20%, 98%);
  --gray-100:  hsl(220, 16%, 94%);
  --gray-200:  hsl(220, 13%, 88%);
  --gray-300:  hsl(220, 11%, 78%);
  --gray-400:  hsl(220,  9%, 60%);
  --gray-500:  hsl(220,  8%, 46%);
  --gray-600:  hsl(220,  9%, 35%);
  --gray-700:  hsl(220, 10%, 26%);
  --gray-800:  hsl(220, 12%, 18%);
  --gray-900:  hsl(220, 14%, 11%);

  /* Sidebar */
  --sidebar-bg:     hsl(220, 18%, 12%);
  --sidebar-hover:  hsl(220, 16%, 18%);
  --sidebar-active: hsl(215, 75%, 48%);
  --sidebar-text:   hsl(220, 12%, 68%);
  --sidebar-width:  260px;

  /* Status Colors */
  --success-50:  hsl(145, 68%, 95%);
  --success-500: hsl(145, 55%, 40%);
  --success-600: hsl(145, 58%, 32%);
  --warning-50:  hsl(38,  95%, 95%);
  --warning-500: hsl(38,  92%, 50%);
  --warning-600: hsl(38,  88%, 40%);
  --danger-50:   hsl(4,   86%, 96%);
  --danger-500:  hsl(4,   78%, 52%);
  --danger-600:  hsl(4,   72%, 44%);
  --info-50:     hsl(200, 80%, 95%);
  --info-500:    hsl(200, 65%, 45%);

  /* Surfaces */
  --surface-0:   hsl(220, 20%, 98%);   /* page bg */
  --surface-1:   hsl(0,   0%,  100%);  /* card */
  --surface-2:   hsl(220, 16%, 96%);   /* input bg */
  --border:      hsl(220, 13%, 90%);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --text-xs:     0.7rem;
  --text-sm:     0.8125rem;
  --text-base:   0.9375rem;
  --text-lg:     1.0625rem;
  --text-xl:     1.25rem;
  --text-2xl:    1.5rem;
  --text-3xl:    1.875rem;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px hsl(220, 20%, 10%, 0.06), 0 1px 2px hsl(220, 20%, 10%, 0.04);
  --shadow-md: 0 4px 12px hsl(220, 20%, 10%, 0.08), 0 2px 4px hsl(220, 20%, 10%, 0.05);
  --shadow-lg: 0 10px 28px hsl(220, 20%, 10%, 0.12), 0 4px 10px hsl(220, 20%, 10%, 0.06);

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 320ms ease;

  /* Topbar */
  --topbar-height: 64px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-family);
  font-size: var(--text-base);
  color: var(--gray-800);
  background: var(--surface-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-500); text-decoration: none; }
a:hover { color: var(--brand-600); }
img { max-width: 100%; display: block; }
button { cursor: pointer; }

/* -------- LAYOUT -------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transform: translateX(0);
  transition: transform var(--transition-slow);
  overflow-y: auto;
  overflow-x: hidden;
}

.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: hsl(220, 20%, 4%, 0.5);
  backdrop-filter: blur(2px);
  z-index: 190;
}

/* -------- SIDEBAR INTERNALS -------- */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid hsl(220, 12%, 20%);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.sidebar-logo .ph {
  font-size: 1.6rem;
  color: var(--brand-400);
  flex-shrink: 0;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 1.2rem;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.sidebar-close:hover { background: var(--sidebar-hover); color: #fff; }

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* -------- BÖLÜM BAŞLIKLARI (BİNALAR / OPERASYON / ...) -------- */
.nav-section {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: hsl(220, 12%, 44%);
  padding: var(--space-5) var(--space-2) var(--space-2);
  text-transform: uppercase;
  white-space: nowrap;
  margin-top: var(--space-2);
}

/* Bölüm başlığından sonra ince ayraç çizgisi — düzenli ve modern görünüm */
.nav-section::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, hsl(220, 14%, 24%), transparent);
}

.sidebar-nav > .nav-item:first-of-type {
  margin-top: var(--space-1);
}

/* -------- MENÜ ÖĞELERİ -------- */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 11px var(--space-4);
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background var(--transition-base), color var(--transition-base),
              transform var(--transition-base), box-shadow var(--transition-base);
  text-decoration: none;
}

.nav-item .ph {
  font-size: 1.2rem;
  flex-shrink: 0;
  color: hsl(220, 10%, 52%);
  transition: color var(--transition-base), transform var(--transition-base);
}

.nav-item span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item .badge { flex-shrink: 0; }

/* Sol akcent çubuğu — hover ve aktif durumda belirir (dinamik his) */
.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-400);
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity var(--transition-base), transform var(--transition-base);
}

/* Üzerine gelince — renk değişimi + hafif kayma */
.nav-item:hover {
  background: hsl(215, 28%, 20%);
  color: #fff;
  transform: translateX(3px);
  box-shadow: 0 2px 8px hsl(220, 20%, 4%, 0.25);
}

.nav-item:hover .ph {
  color: var(--brand-400);
  transform: scale(1.1);
}

.nav-item:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

/* Aktif — belirgin, gradyan arka plan */
.nav-item.active {
  background: linear-gradient(90deg, var(--brand-500), hsl(215, 74%, 42%));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 12px hsl(215, 75%, 48%, 0.35);
}

.nav-item.active::before {
  opacity: 1;
  transform: scaleY(1);
  background: #fff;
}

.nav-item.active .ph { color: #fff; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}

.badge-danger  { background: var(--danger-500);  color: #fff; }
.badge-warning { background: var(--warning-500); color: #fff; }
.badge-success { background: var(--success-500); color: #fff; }
.badge-info    { background: var(--info-500);    color: #fff; }
.badge-gray    { background: var(--gray-200);    color: var(--gray-600); }

.sidebar-footer {
  padding: var(--space-4) var(--space-4);
  border-top: 1px solid hsl(220, 12%, 20%);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--brand-500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
}

.user-meta { flex: 1; min-width: 0; }
.user-name {
  display: block;
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  display: block;
  color: var(--sidebar-text);
  font-size: var(--text-xs);
}

.btn-logout {
  color: var(--sidebar-text);
  font-size: 1.1rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.btn-logout:hover { background: hsl(4, 60%, 30%); color: hsl(4, 90%, 80%); }

.btn-profile {
  color: var(--sidebar-text);
  font-size: 1.1rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.btn-profile:hover { background: var(--brand-500); color: #fff; }

/* -------- TOPBAR -------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-height);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  box-shadow: var(--shadow-sm);
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--gray-500);
  font-size: 1.4rem;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.topbar-menu-btn:hover { background: var(--surface-2); color: var(--gray-800); }

.topbar-breadcrumb {
  flex: 1;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--gray-800);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar-date {
  font-size: var(--text-sm);
  color: var(--gray-400);
}

/* -------- PAGE CONTENT -------- */
.page-content {
  flex: 1;
  padding: var(--space-6) var(--space-8);
  max-width: 1440px;
  width: 100%;
}

/* -------- FLASH MESSAGES -------- */
.flash {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: 500;
  border-bottom: 1px solid transparent;
  position: relative;
}

.flash .ph { font-size: 1.1rem; flex-shrink: 0; }
.flash-close { margin-left: auto; background: none; border: none; opacity: 0.6; font-size: 1rem; }
.flash-close:hover { opacity: 1; }

.flash-success { background: var(--success-50); color: var(--success-600); border-color: hsl(145, 55%, 80%); }
.flash-danger  { background: var(--danger-50);  color: var(--danger-600);  border-color: hsl(4, 78%, 85%); }
.flash-warning { background: var(--warning-50); color: var(--warning-600); border-color: hsl(38, 80%, 80%); }
.flash-info    { background: var(--info-50);    color: var(--info-500);    border-color: hsl(200, 60%, 80%); }

/* -------- CARDS -------- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  gap: var(--space-4);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-title .ph { color: var(--brand-500); }

.card-body { padding: var(--space-6); }
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--gray-50);
}

/* -------- STAT CARDS -------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card.stat-blue::before  { background: var(--brand-500); }
.stat-card.stat-green::before { background: var(--success-500); }
.stat-card.stat-orange::before{ background: var(--warning-500); }
.stat-card.stat-red::before   { background: var(--danger-500); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-blue  .stat-icon { background: var(--brand-50);   color: var(--brand-500); }
.stat-green .stat-icon { background: var(--success-50); color: var(--success-500); }
.stat-orange.stat-icon,
.stat-card.stat-orange .stat-icon { background: var(--warning-50); color: var(--warning-600); }
.stat-red   .stat-icon { background: var(--danger-50);  color: var(--danger-500); }

.stat-info { flex: 1; min-width: 0; }
.stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}
.stat-label {
  font-size: var(--text-sm);
  color: var(--gray-400);
  margin-top: 2px;
}
.stat-change {
  font-size: var(--text-xs);
  font-weight: 600;
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-change.up   { color: var(--success-500); }
.stat-change.down { color: var(--danger-500); }

/* -------- BUTTONS -------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  line-height: 1;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
}

.btn .ph { font-size: 1rem; }

.btn-sm  { padding: 6px 12px; font-size: var(--text-xs); }
.btn-lg  { padding: 12px 24px; font-size: var(--text-base); }

.btn-primary {
  background: var(--brand-500);
  color: #fff;
  border-color: var(--brand-500);
}
.btn-primary:hover {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
  box-shadow: 0 2px 8px hsl(215, 75%, 48%, 0.35);
}

.btn-outline {
  background: transparent;
  color: var(--gray-600);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--surface-2);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

.btn-success {
  background: var(--success-500);
  color: #fff;
  border-color: var(--success-500);
}
.btn-success:hover { background: var(--success-600); color: #fff; }

.btn-danger {
  background: var(--danger-500);
  color: #fff;
  border-color: var(--danger-500);
}
.btn-danger:hover { background: var(--danger-600); color: #fff; }

.btn-warning {
  background: var(--warning-500);
  color: #fff;
  border-color: var(--warning-500);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-500);
  border: none;
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--gray-800); }

/* -------- FORMS -------- */
.form-group { margin-bottom: var(--space-5); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.form-label.required::after {
  content: ' *';
  color: var(--danger-500);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  color: var(--gray-800);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px hsl(215, 80%, 58%, 0.15);
  background: var(--surface-1);
}

.form-control::placeholder { color: var(--gray-400); }

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23718096' viewBox='0 0 256 256'%3E%3Cpath d='M213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80a8 8 0 0 1 11.32-11.32L128 164.69l74.34-74.35a8 8 0 0 1 11.32 11.32z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--gray-400);
  margin-top: 4px;
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger-500);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-5);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  margin-top: var(--space-5);
}

/* -------- TABLES -------- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-400);
  background: var(--gray-50);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  color: var(--gray-700);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition-fast);
}
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* -------- STATUS CHIPS -------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chip-done,
.chip-resolved {
  background: var(--success-50);
  color: var(--success-600);
}
.chip-done::before, .chip-resolved::before { background: var(--success-500); }

.chip-pending {
  background: var(--info-50);
  color: var(--info-500);
}
.chip-pending::before { background: var(--info-500); }

.chip-overdue,
.chip-open {
  background: var(--danger-50);
  color: var(--danger-500);
}
.chip-overdue::before, .chip-open::before { background: var(--danger-500); animation: pulse 1.5s infinite; }

.chip-in_progress {
  background: var(--warning-50);
  color: var(--warning-600);
}
.chip-in_progress::before { background: var(--warning-500); }

.chip-cancelled {
  background: var(--gray-100);
  color: var(--gray-400);
}
.chip-cancelled::before { background: var(--gray-400); }

.chip-new      { background: hsl(270, 70%, 95%); color: hsl(270, 55%, 45%); }
.chip-existing { background: var(--gray-100);    color: var(--gray-500); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* -------- PRIORITY -------- */
.priority-critical { color: var(--danger-500);  font-weight: 700; }
.priority-high     { color: hsl(20, 90%, 52%); font-weight: 600; }
.priority-medium   { color: var(--warning-600); }
.priority-low      { color: var(--gray-400); }

/* -------- FILTERS BAR -------- */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.filters-bar .form-control { width: auto; min-width: 140px; }

/* -------- 2 KOLONLU ICERIK (raporlar vb.) -------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
}

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

/* -------- 2fr/1fr ICERIK (dashboard, bina detay) -------- */
.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-5);
  align-items: start;
}

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

/* -------- PAGE HEADER -------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.page-header-left p {
  font-size: var(--text-sm);
  color: var(--gray-400);
  margin-top: var(--space-1);
}

/* -------- MODAL -------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: hsl(220, 20%, 4%, 0.55);
  backdrop-filter: blur(3px);
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface-1);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 200ms ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gray-900);
}

.modal-close {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 1.2rem;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--danger-50); color: var(--danger-500); }

.modal-body { padding: var(--space-6); }

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* -------- BUILDING CARDS -------- */
.buildings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
}

.building-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.building-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.building-card-header {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  padding: var(--space-5) var(--space-5) var(--space-4);
  position: relative;
}

.building-card-code {
  font-size: var(--text-xs);
  font-weight: 700;
  color: hsl(215, 90%, 85%);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

.building-card-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.building-type-badge {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.type-new      { background: hsl(270, 80%, 60%); color: #fff; }
.type-existing { background: hsl(215, 70%, 35%); color: hsl(215, 90%, 90%); }

.building-card-body { padding: var(--space-4) var(--space-5) var(--space-5); }

.building-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.building-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--gray-500);
}

.building-meta-item .ph { color: var(--brand-400); font-size: 0.95rem; flex-shrink: 0; }
.building-meta-item strong { color: var(--gray-700); }

.building-stats-row {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.building-stat-item { flex: 1; text-align: center; }
.building-stat-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--gray-900);
}
.building-stat-label { font-size: var(--text-xs); color: var(--gray-400); }

.building-actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--gray-50);
}

/* -------- MAINTENANCE CALENDAR VIEW -------- */
.maintenance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.maintenance-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.maintenance-card:hover { box-shadow: var(--shadow-md); }

.maintenance-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.maintenance-building { font-weight: 600; color: var(--gray-900); }
.maintenance-period   { font-size: var(--text-xs); color: var(--gray-400); }

.maintenance-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--gray-500);
}

.maintenance-meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.maintenance-meta-row .ph { color: var(--gray-400); font-size: 0.9rem; }

.maintenance-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

/* -------- FAULT CARDS -------- */
.fault-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.fault-card:hover { box-shadow: var(--shadow-md); }

.fault-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.fault-id { font-size: var(--text-xs); color: var(--gray-400); font-weight: 600; }
.fault-desc { font-size: var(--text-sm); color: var(--gray-700); line-height: 1.5; }

.fault-cost-row {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--gray-50);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.fault-cost-item { flex: 1; }
.fault-cost-label { font-size: var(--text-xs); color: var(--gray-400); }
.fault-cost-value { font-weight: 700; color: var(--gray-800); }

/* -------- ACCOUNT/CARI CARDS -------- */
.account-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.account-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.account-card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account-building { font-weight: 700; font-size: var(--text-base); color: var(--gray-900); }
.account-code     { font-size: var(--text-xs); color: var(--gray-400); }

.account-balance {
  font-size: var(--text-xl);
  font-weight: 800;
  text-align: right;
}

.balance-debt    { color: var(--danger-500); }
.balance-credit  { color: var(--success-500); }
.balance-zero    { color: var(--gray-400); }

.account-rows { padding: var(--space-4) var(--space-5); }

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: var(--text-sm);
}

.account-row:last-child { border-bottom: none; }
.account-row-label { color: var(--gray-500); display: flex; align-items: center; gap: 6px; }
.account-row-value { font-weight: 600; color: var(--gray-800); }

/* -------- CHART CONTAINERS -------- */
.chart-container {
  position: relative;
  height: 280px;
}

/* -------- EMPTY STATE -------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  text-align: center;
  color: var(--gray-400);
}

.empty-state .ph {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-state h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: var(--space-2);
}

.empty-state p { font-size: var(--text-sm); max-width: 300px; }

/* -------- PAGINATION -------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5) 0;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-600);
  border: 1px solid var(--border);
  background: var(--surface-1);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.page-link:hover { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-600); }
.page-link.active { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
.page-link.disabled { opacity: 0.4; pointer-events: none; }

/* -------- UTILITY -------- */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--gray-400); }
.text-sm     { font-size: var(--text-sm); }
.text-xs     { font-size: var(--text-xs); }
.font-bold   { font-weight: 700; }
.font-semibold { font-weight: 600; }
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.gap-2       { gap: var(--space-2); }
.gap-3       { gap: var(--space-3); }
.mt-4        { margin-top: var(--space-4); }
.mt-6        { margin-top: var(--space-6); }
.mb-4        { margin-bottom: var(--space-4); }
.mb-6        { margin-bottom: var(--space-6); }
.w-full      { width: 100%; }
.flex-1      { flex: 1; }
.currency    { font-variant-numeric: tabular-nums; }

/* -------- LOADING SPINNER -------- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid hsl(215, 80%, 80%);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------- LOGIN PAGE -------- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, hsl(220, 20%, 16%) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.login-card {
  background: var(--surface-1);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: var(--space-10);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  text-align: center;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  background: var(--brand-500);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
}

.login-logo h1 {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--gray-900);
}

.login-logo p {
  font-size: var(--text-sm);
  color: var(--gray-400);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
  .page-content { padding: var(--space-5) var(--space-6); }
}

/* Mobile */
@media (max-width: 768px) {
  /* iOS: 16px alti input fontu sayfayi otomatik zumlar — onle */
  .form-control { font-size: 16px; }

  /* Dokunmatik hedefleri buyut */
  .btn { min-height: 40px; }
  .btn-sm, .btn-ghost { min-height: 34px; }

  .card-header { flex-wrap: wrap; }

  .topbar { padding: 0 var(--space-4); gap: var(--space-2); }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-close { display: flex; }
  .sidebar-overlay.open { display: block; }

  .main-wrapper { margin-left: 0; }

  .topbar-menu-btn { display: flex; }

  .page-content { padding: var(--space-4); }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }

  .stat-card { padding: var(--space-4); }
  .stat-value { font-size: var(--text-xl); }

  .buildings-grid { grid-template-columns: 1fr; }
  .maintenance-grid { grid-template-columns: 1fr; }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .btn { width: 100%; justify-content: center; }

  .form-row { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }

  .filters-bar { flex-direction: column; align-items: stretch; }
  .filters-bar .form-control { width: 100%; }
  .filters-bar .btn { width: 100%; justify-content: center; }

  .topbar-date { display: none; }

  .modal { max-height: 100vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  .table { min-width: 600px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: var(--space-6); }

  .topbar-actions .btn span { display: none; }

  .stat-card { flex-direction: column; }
  .stat-icon { width: 40px; height: 40px; }
}
