/* ─────────────────────────────────────────────────────
   BT Rapor Sistemi — Ortak Stil Dosyası
   ───────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Source+Sans+3:ital,wght@0,300;0,400;0,600;0,700;1,400&display=swap');

:root {
  --cr:       #8B1515;
  --cr-dark:  #6A0F0F;
  --cr-mid:   #c97a7a;
  --cr-light: #f5dada;
  --cr-pale:  #fdf4f4;
  --ink:      #1e1e1e;
  --ink-mid:  #4a4a4a;
  --ink-lt:   #888;
  --border:   #ddd;
  --bg:       #f0eded;
  --white:    #fff;
  --green:    #2e7d32;  --green-bg: #e8f5e9;
  --yellow:   #e65100;  --yellow-bg: #fff8e1;
  --red:      #c62828;  --red-bg:   #ffebee;
  --blue:     #1565c0;  --blue-bg:  #e3f2fd;
  --gray-bg:  #f5f5f5;
  --shadow:   0 2px 12px rgba(0,0,0,.1);
  --radius:   8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

a { color: var(--cr); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── SIDEBAR ── */
:root {
  --sb-width:        232px;
  --sb-width-sm:     64px;
  --mobile-topbar-h: 52px;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sb-width);
  background: var(--cr-dark);
  color: white;
  display: flex;
  flex-direction: column;
  z-index: 200;
  box-shadow: 2px 0 8px rgba(0,0,0,.18);
  transition: width .22s ease;
  overflow: hidden;
}
html.sb-collapsed .sidebar { width: var(--sb-width-sm); }

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 14px;
  text-decoration: none;
  color: white;
  border-bottom: 1px solid rgba(255,255,255,.1);
  min-height: 64px;
  position: relative;
  flex-shrink: 0;
}
.sidebar-brand:hover { text-decoration: none; background: rgba(255,255,255,.04); }
.sb-logo { width: 36px; height: 36px; border-radius: 6px; object-fit: contain; background: white; padding: 3px; flex-shrink: 0; }
.sb-logo-fallback { font-size: 26px; line-height: 1; flex-shrink: 0; width: 36px; text-align: center; }
.sb-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sb-brand-name { font-family: 'Playfair Display', serif; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-brand-sub  { font-size: 9px; opacity: .65; letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; white-space: nowrap; }
html.sb-collapsed .sb-brand-text { display: none; }

/* Toggle butonu (sidebar üzerinde, daraltma) */
.sidebar-toggle {
  position: absolute;
  top: 22px;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18);
  background: var(--cr-dark);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
  transition: transform .22s ease, background .15s;
  font-family: monospace;
  line-height: 1;
  padding: 0;
}
.sidebar-toggle:hover { background: var(--cr); }
.sb-toggle-icon { display: inline-block; transition: transform .22s ease; }
html.sb-collapsed .sb-toggle-icon { transform: rotate(180deg); }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 6px;
  color: white;
  text-decoration: none;
  font-size: 13.5px;
  font-family: 'Source Sans 3', sans-serif;
  opacity: .82;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
  position: relative;
}
.sidebar-link:hover { background: rgba(255,255,255,.1); opacity: 1; text-decoration: none; }
.sidebar-link.active { background: var(--cr); opacity: 1; box-shadow: inset 3px 0 0 white; }
.sb-icon { font-size: 17px; flex-shrink: 0; width: 22px; text-align: center; line-height: 1; }
.sb-label { overflow: hidden; text-overflow: ellipsis; }
html.sb-collapsed .sb-label { display: none; }
html.sb-collapsed .sidebar-link { justify-content: center; padding: 10px 0; }
html.sb-collapsed .sidebar-link.active { box-shadow: inset 3px 0 0 white; }

/* Tooltip (collapsed durumda) */
html.sb-collapsed .sidebar-link:hover::after,
html.sb-collapsed .sb-user:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 999;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* Footer */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 10px 8px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sb-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  font-size: 12px;
  color: white;
  opacity: .65;
  white-space: nowrap;
  position: relative;
}
.sb-user .sb-label { overflow: hidden; text-overflow: ellipsis; }
.sb-logout { font-size: 13px; }
html.sb-collapsed .sb-user { justify-content: center; padding: 8px 0; }

/* Mobile topbar */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 150;
  background: var(--cr-dark);
  color: white;
  padding: 0 16px;
  height: var(--mobile-topbar-h);
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.mobile-hamburger {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 5px;
  font-size: 18px;
  padding: 4px 11px;
  cursor: pointer;
  line-height: 1;
}
.mobile-title { font-family: 'Playfair Display', serif; font-size: 15px; }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
}

/* Main content */
.main-content {
  margin-left: var(--sb-width);
  min-height: 100vh;
  transition: margin-left .22s ease;
}
html.sb-collapsed .main-content { margin-left: var(--sb-width-sm); }

/* ── PAGE ── */
.page { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.page-sm { max-width: 720px; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--cr);
}
.page-subtitle { font-size: 13px; color: var(--ink-lt); margin-top: 2px; }

/* ── CARDS ── */
.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid #e8dede;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  background: var(--cr);
  color: white;
  padding: 11px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 7px;
}
.card-body { padding: 18px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 6px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: filter .15s, opacity .15s;
  line-height: 1.2;
}
.btn:hover { filter: brightness(.9); text-decoration: none; }
.btn-primary   { background: var(--cr); color: white; }
.btn-secondary { background: var(--gray-bg); color: var(--ink-mid); border: 1px solid var(--border); }
.btn-success   { background: var(--green); color: white; }
.btn-danger    { background: var(--red); color: white; }
.btn-outline   { background: transparent; color: var(--cr); border: 1px solid var(--cr); }
.btn-sm        { padding: 5px 11px; font-size: 12px; }
.btn-lg        { padding: 11px 26px; font-size: 15px; }
.btn-icon      { padding: 6px 8px; }

/* ── FORM ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-mid);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: #fdfafa;
  outline: none;
  transition: border-color .15s;
}
.form-control:focus { border-color: var(--cr-mid); background: white; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: 11.5px; color: var(--ink-lt); margin-top: 4px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table thead th {
  background: var(--cr);
  color: white;
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid #f0e8e8;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--cr-pale); }

/* ── BADGE ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-gray   { background: var(--gray-bg);   color: #555; }
.badge-crimson{ background: var(--cr-light);  color: var(--cr-dark); }

/* ── ALERT ── */
.alert {
  padding: 11px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid #c8e6c9; }
.alert-danger  { background: var(--red-bg);   color: var(--red);   border: 1px solid #ffcdd2; }
.alert-warning { background: var(--yellow-bg);color: var(--yellow);border: 1px solid #ffe0b2; }
.alert-info    { background: var(--blue-bg);  color: var(--blue);  border: 1px solid #bbdefb; }

/* ── DYNAMIC ROWS ── */
.dyn-section { margin-bottom: 8px; }
.dyn-row {
  border: 1px solid #ece4e4;
  border-radius: 6px;
  padding: 12px 14px 10px;
  margin-bottom: 8px;
  background: #fdfafa;
  position: relative;
  padding-right: 42px;
}
.dyn-row .row-grid { display: grid; gap: 8px; }
.dyn-row .row-grid.g2 { grid-template-columns: 1fr 1fr; }
.dyn-row .row-grid.g3 { grid-template-columns: 2fr 1fr 1fr; }
.dyn-row .row-grid.g4 { grid-template-columns: 3fr 1fr 1fr 1fr; }
.dyn-row .form-group { margin-bottom: 0; }
.btn-del-row {
  position: absolute;
  top: 10px; right: 8px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: 1px solid var(--cr-light);
  border-radius: 50%;
  color: var(--cr-mid);
  font-size: 16px;
  cursor: pointer;
  transition: all .15s;
  line-height: 1;
}
.btn-del-row:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.btn-add-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  background: var(--cr-pale);
  border: 1px dashed var(--cr-mid);
  border-radius: 6px;
  color: var(--cr);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: background .15s;
}
.btn-add-row:hover { background: var(--cr-light); }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: white;
  border-radius: 8px;
  padding: 16px 18px;
  border: 1px solid #e8dede;
  box-shadow: var(--shadow);
}
.stat-card .stat-num { font-size: 30px; font-weight: 700; color: var(--cr); font-family: 'Playfair Display', serif; }
.stat-card .stat-lbl { font-size: 11px; color: var(--ink-lt); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

/* ── LOGO UPLOAD ── */
.logo-preview { width: 120px; height: 60px; object-fit: contain; border: 1px solid var(--border); border-radius: 6px; padding: 4px; background: white; }
.logo-placeholder { width: 120px; height: 60px; border: 2px dashed var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--ink-lt); font-size: 12px; }

/* ── TABLET ── */
@media (max-width: 1024px) {
  :root { --sb-width: 210px; }
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sb-width);
    transition: transform .25s ease;
  }
  body.sb-mobile-open .sidebar { transform: translateX(0); }
  body.sb-mobile-open .sidebar-overlay { display: block; }
  html.sb-collapsed .sidebar { width: var(--sb-width); } /* mobilde collapse kapalı */
  html.sb-collapsed .sb-brand-text { display: flex; }
  html.sb-collapsed .sb-label { display: inline; }
  html.sb-collapsed .sidebar-link { justify-content: flex-start; padding: 9px 12px; }
  .sidebar-toggle { display: none; }
  .main-content { margin-left: 0 !important; }
  .mobile-topbar { display: flex; }
}
@media (max-width: 640px) {
  .page { padding: 16px 14px 50px; }
  .form-row { grid-template-columns: 1fr; }
  .dyn-row .row-grid.g2,
  .dyn-row .row-grid.g3,
  .dyn-row .row-grid.g4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ── PRINT ── */
@media print {
  @page { size: A4; margin: 12mm 14mm 14mm 14mm; }
  .sidebar, .sidebar-overlay, .mobile-topbar, .no-print, .page-header .btn { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body { background: white !important; }
  .page { padding: 0 !important; max-width: 100% !important; }
  .card { box-shadow: none !important; border: none !important; }
}
