/**
 * DEMOKİRA - Kurumsal Kira Takip ve Gayrimenkul Yönetim Platformu
 * Ultra-Premium Finansal SaaS Arayüz Stilleri (CSS)
 * Renk Paleti: Beyaz, Açık Gri, Koyu Lacivert & Kurumsal Finans Mavisi
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --dk-font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --dk-font-mono: 'JetBrains Mono', monospace;

  /* Enterprise Palette */
  --dk-navy-950: #060b14;
  --dk-navy-900: #0b1324;
  --dk-navy-850: #101a30;
  --dk-navy-800: #16223d;
  --dk-navy-700: #1e3056;

  --dk-primary: #1d4ed8;
  --dk-primary-hover: #1e40af;
  --dk-primary-light: #eff6ff;

  --dk-emerald: #059669;
  --dk-emerald-light: #ecfdf5;
  --dk-amber: #d97706;
  --dk-amber-light: #fffbeb;
  --dk-rose: #e11d48;
  --dk-rose-light: #fff1f2;

  --dk-slate-50: #f8fafc;
  --dk-slate-100: #f1f5f9;
  --dk-slate-200: #e2e8f0;
  --dk-slate-300: #cbd5e1;
  --dk-slate-400: #94a3b8;
  --dk-slate-500: #64748b;
  --dk-slate-600: #475569;
  --dk-slate-700: #334155;
  --dk-slate-800: #1e293b;
  --dk-slate-900: #0f172a;

  --dk-card-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --dk-card-shadow-hover: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
  --dk-modal-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
}

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

html, body {
  font-family: var(--dk-font-sans);
  background-color: var(--dk-slate-50);
  color: var(--dk-slate-900);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  font-size: 14px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fadeIn {
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Custom Enterprise Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--dk-slate-300);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--dk-slate-400);
}

/* Sidebar Custom Styling */
#dkSidebar {
  background: linear-gradient(180deg, var(--dk-navy-900) 0%, var(--dk-navy-950) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

.dk-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 9px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  margin-bottom: 2px;
}

.dk-nav-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  transform: translateX(2px);
}

.dk-nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.22) 0%, rgba(37, 99, 235, 0.05) 100%);
  color: #60a5fa;
  border-left: 3px solid #3b82f6;
  font-weight: 700;
}

.dk-nav-item svg {
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.dk-nav-item.active svg {
  color: #60a5fa;
}

/* Topbar Styling */
header {
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--dk-slate-200);
}

/* Metric / KPI Cards */
.dk-kpi-card {
  background: #ffffff;
  border: 1px solid var(--dk-slate-200);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--dk-card-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
}

.dk-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--dk-card-shadow-hover);
  border-color: var(--dk-slate-300);
}

.dk-kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
}

.dk-kpi-card.kpi-blue::before { background: #2563eb; }
.dk-kpi-card.kpi-emerald::before { background: #059669; }
.dk-kpi-card.kpi-amber::before { background: #d97706; }
.dk-kpi-card.kpi-purple::before { background: #7c3aed; }
.dk-kpi-card.kpi-rose::before { background: #e11d48; }

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-paid {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-partial {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

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

.badge-overdue {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.badge-active {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* Modern Clean Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--dk-slate-200);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  font-size: 13px;
  color: var(--dk-slate-800);
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color 0.1s ease;
}

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

/* Property Cards */
.dk-property-card {
  background: #ffffff;
  border: 1px solid var(--dk-slate-200);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--dk-card-shadow);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.dk-property-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--dk-card-shadow-hover);
  border-color: #cbd5e1;
}

/* Modals */
.dk-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.dk-modal-content {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid var(--dk-slate-200);
  box-shadow: var(--dk-modal-shadow);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.2s ease-out;
}

.dk-modal-header {
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--dk-slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dk-modal-body {
  padding: 24px;
  overflow-y: auto;
}

.dk-modal-footer {
  padding: 16px 24px;
  background: var(--dk-slate-50);
  border-top: 1px solid var(--dk-slate-100);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Form Controls */
label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--dk-slate-700);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 9px 13px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--dk-slate-200);
  border-radius: 9px;
  background-color: #ffffff;
  color: var(--dk-slate-900);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Primary Button Styling */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 9px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 9px;
  background: #ffffff;
  color: var(--dk-slate-700);
  border: 1px solid var(--dk-slate-200);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--dk-slate-50);
  border-color: var(--dk-slate-300);
}

/* Live Demo Banner Bar */
.demo-live-bar {
  background: linear-gradient(90deg, #1e3a8a 0%, #1e40af 50%, #1d4ed8 100%);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

/* Print Stylesheet for Invoices & Official Receipts */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 12mm 15mm 12mm;
  }

  /* Hide interactive chrome */
  #dkSidebar,
  #dkDemoBar,
  header,
  nav,
  .no-print,
  button,
  .btn,
  #quickMenuDropdown,
  .fixed.bottom-4,
  #pwaInstallBanner,
  #offlineIndicator {
    display: none !important;
    visibility: hidden !important;
  }

  /* Isolated Document Print Mode (printDocumentDirect) */
  body.is-printing-document #dkAppShell,
  body.is-printing-document .fixed.inset-0,
  body.is-printing-document header,
  body.is-printing-document #dkDemoBar,
  body.is-printing-document #dkSidebar {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -99999px !important;
  }

  body.is-printing-document #dkPrintContainer {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  /* Modal Open Isolation */
  body.modal-open #dkAppShell,
  body:has(#modalLeaseContract:not(.hidden)) #dkAppShell,
  body:has(#modalReceipt:not(.hidden)) #dkAppShell,
  body:has(#modalLegalNotice:not(.hidden)) #dkAppShell {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -99999px !important;
  }

  body.modal-open .fixed.inset-0:not(.hidden) {
    position: static !important;
    display: block !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  body.modal-open .fixed.inset-0:not(.hidden) > div {
    max-width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    max-height: none !important;
  }

  /* Base Print Layout */
  html, body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 9.5pt !important;
    height: auto !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }
  th, td {
    border: 1px solid #cbd5e1 !important;
    padding: 5px 7px !important;
    font-size: 8pt !important;
  }
  th {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 700 !important;
  }
}
