/* ========================================================
   ASİSTAN DANİŞAN & KPI TAKİP SİSTEMİ - PREMİUM MODERN STYLES
   ======================================================== */

:root {
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #f8fafc;
  
  --primary: #15803d; /* Forest Green */
  --primary-hover: #166534;
  --primary-light: #dcfce7;
  --primary-text: #14532d;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border: #e2e8f0;
  --border-focus: #22c55e;
  
  --status-satis-bg: #166534;
  --status-satis-text: #ffffff;
  
  --status-ongorusme-bg: #dcfce7;
  --status-ongorusme-text: #166534;
  
  --status-ilgileniyor-bg: #fef3c7;
  --status-ilgileniyor-text: #92400e;
  
  --status-ulasilamadi-bg: #f1f5f9;
  --status-ulasilamadi-text: #475569;
  
  --status-ilgilenmiyor-bg: #fee2e2;
  --status-ilgilenmiyor-text: #991b1b;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* ========================================================
   NAVBAR
   ======================================================== */
.navbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.nav-brand-container {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sales-quote-card {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #bbf7d0;
  color: #15803d;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(22, 101, 52, 0.06);
  max-width: 480px;
  user-select: none;
}
.quote-sparkle {
  font-size: 0.95rem;
}
.quote-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
  letter-spacing: -0.01em;
}

.brand-logo {
  font-size: 1.8rem;
  background: var(--primary-light);
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-md);
}

.navbar h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.navbar .subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.live-clock {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: monospace;
}

/* Full Width Fluid Container */
.container-fluid {
  width: 100%;
  max-width: 100%;
  margin: 0.65rem auto;
  padding: 0 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(22, 101, 52, 0.25);
}

.btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-secondary:hover {
  background-color: #e2e8f0;
  color: var(--text-main);
}

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

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
}

/* ========================================================
   STATS CARDS GRID (BELOVED DASHBOARD CARDS)
   ======================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-card[style*="cursor:pointer"],
.stat-card[style*="cursor: pointer"] {
  cursor: pointer;
  user-select: none;
}
.stat-card[style*="cursor:pointer"]:hover,
.stat-card[style*="cursor: pointer"]:hover {
  border-color: #94a3b8;
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

@keyframes pulseDot {
  0% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.stat-card.card-alert {
  border-color: #fcd34d;
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
  cursor: pointer;
}

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

.icon-blue { background: #e0f2fe; }
.icon-teal { background: #ccfbf1; }
.icon-green { background: #dcfce7; }
.icon-amber { background: #fef3c7; }

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

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

.badge-teal { background: #ccfbf1; color: #0f766e; }
.badge-green { background: #dcfce7; color: #15803d; }
.text-amber { color: #b45309; }

/* ========================================================
   TABS NAVIGATION
   ======================================================== */
.tabs-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tabs-nav::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}
.tab-btn:hover {
  color: var(--text-main);
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.tab-badge {
  background: #ef4444;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 9999px;
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================================
   FILTER TOOLBAR (EXCEL STYLE DROPDOWNS)
   ======================================================== */
.filter-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.search-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.75rem;
  min-width: 280px;
}
.search-input-group input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  font-family: inherit;
  width: 100%;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Excel Checkbox Dropdown */
.filter-popover-wrapper {
  position: relative;
}

.btn-filter-dropdown {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  font-family: inherit;
}
.btn-filter-dropdown:hover {
  background: #e2e8f0;
}

.popover-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  padding: 0.6rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}

.popover-actions {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin-bottom: 0.3rem;
}
.popover-actions button {
  background: none;
  border: none;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}
.popover-actions button:hover {
  text-decoration: underline;
}

.popover-item {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.65rem !important;
  font-size: 0.83rem;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}
.popover-item:hover {
  background: var(--bg-subtle);
}
.popover-item input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ========================================================
   FULL WIDTH DATA TABLE
   ======================================================== */
.table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  max-height: calc(100vh - 210px);
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.81rem;
}

.leads-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.73rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  z-index: 10;
  user-select: none;
  white-space: nowrap;
}

.leads-table th.sortable {
  cursor: pointer;
}
.leads-table th.sortable:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.sort-icon {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-left: 3px;
}
th.sorted-asc .sort-icon, th.sorted-desc .sort-icon {
  color: var(--primary);
  font-weight: 800;
}

.leads-table td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

.col-nowrap {
  white-space: nowrap;
}

.col-danisan {
  max-width: 135px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-arama {
  width: 78px;
  max-width: 82px;
  white-space: nowrap;
  text-align: center;
  font-size: 0.78rem;
}

.col-notlar {
  min-width: 240px;
  width: 100%;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

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

.leads-table tr.row-overdue {
  background: #fffbeb !important;
}
.leads-table tr.row-overdue td:first-child {
  border-left: 3px solid #f59e0b;
}

.table-bar-foot {
  padding: 0.55rem 1rem;
  background: #ffffff;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-satis { background: var(--status-satis-bg); color: var(--status-satis-text); }
.badge-ongorusme { background: var(--status-ongorusme-bg); color: var(--status-ongorusme-text); }
.badge-ilgileniyor { background: var(--status-ilgileniyor-bg); color: var(--status-ilgileniyor-text); }
.badge-ulasilamadi { background: var(--status-ulasilamadi-bg); color: var(--status-ulasilamadi-text); }
.badge-ilgilenmiyor { background: var(--status-ilgilenmiyor-bg); color: var(--status-ilgilenmiyor-text); }
.badge-tekrar-ara { background: #fef08a; color: #854d0e; border-radius: 4px; padding: 0.15rem 0.4rem; }

/* ========================================================
   SINGLE CUSTOM LINE CHART (CHART.JS)
   ======================================================== */
.chart-container-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.chart-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.chart-top-bar h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.chart-metrics-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
}

.chart-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.chart-time-select {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  font-family: inherit;
  font-weight: 600;
}

.line-chart-wrapper {
  height: 320px;
  width: 100%;
}

/* KPI Breakdown Tables Grid */
.kpi-tables-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.kpi-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.kpi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.kpi-table th {
  background: var(--primary);
  color: #ffffff;
  padding: 0.55rem 0.75rem;
  font-weight: 600;
  text-align: right;
}
.kpi-table th:first-child { text-align: left; }

.kpi-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
}
.kpi-table td:first-child { text-align: left; font-weight: 600; }
.kpi-table tr.total-row td { background: var(--bg-subtle); font-weight: 700; }

.kpi-metric-strip {
  display: flex;
  gap: 0.75rem;
}

.kpi-metric-box {
  flex: 1;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  text-align: center;
}
.kpi-metric-box .label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.kpi-metric-box .val { font-size: 1.5rem; font-weight: 800; margin: 0.2rem 0; }
.kpi-metric-box .sub { font-size: 0.78rem; font-weight: 700; color: var(--primary); }

/* ========================================================
   GUIDE & MODALS
   ======================================================== */
.guide-box {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 480px;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.guide-step {
  display: flex;
  gap: 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.step-circle {
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 1.25rem 1.5rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  align-items: start;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  height: 1.25rem;
  line-height: 1.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.15rem;
  display: block;
}

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  outline: none;
}
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.field-warn {
  color: #dc2626;
  font-size: 0.74rem;
  font-weight: 600;
  margin-top: 0.2rem;
  line-height: 1.2;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 200;
}

.toast {
  background: #1e293b;
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.toast.success { border-left: 4px solid #22c55e; }
.toast.error { border-left: 4px solid #ef4444; }

.hidden { display: none !important; }
.req { color: #ef4444; }

@media (max-width: 900px) {
  .kpi-tables-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .navbar { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}
