/* ═══════════════════════════════════════════════════════
   EMO İletişim Modülü – Ana Stil Dosyası
   TMMOB Elektrik Mühendisleri Odası
   ═══════════════════════════════════════════════════════ */

:root {
  --emo-blue:       #1b3f8b;
  --emo-blue-dark:  #122b5e;
  --emo-blue-light: #e8f0fe;
  --accent:         #e8a000;
  --bg:             #f0f2f5;
  --surface:        #ffffff;
  --border:         #e0e4ea;
  --text-primary:   #1a1f2e;
  --text-secondary: #5a6378;
  --text-light:     #8a94a8;
  --success:        #1a7a1a;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.10);
  --shadow-md:      0 4px 16px rgba(0,0,0,.13);
  --shadow-lg:      0 8px 32px rgba(0,0,0,.18);
  --radius:         10px;
  --header-h:       84px;
  --searchbar-h:    68px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--emo-blue);
  background: linear-gradient(135deg, #122b5e 0%, #1b3f8b 50%, #2555b8 100%);
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(27,63,139,.35);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 20px;
  max-width: 100%;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 52px; height: 52px;
  background: rgba(255,255,255,.18);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  backdrop-filter: blur(6px);
}

.logo-text { display: flex; flex-direction: column; }
.logo-title { font-size: 19px; font-weight: 700; color: #fff; letter-spacing: .3px; }
.logo-sub   { font-size: 14px; font-weight: 400; color: rgba(255,255,255,.85); margin-top: 2px; }

.header-stats { display: flex; gap: 12px; }

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  min-width: 90px;
  border-radius: 12px;
  background: rgba(255,255,255,.12);
  color: #fff;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.15);
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.stat-card:hover { transform: translateY(-2px); background: rgba(255,255,255,.20); }
.stat-card .stat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,.7); margin-bottom: 2px; }
.stat-card .stat-value { font-size: 20px; font-weight: 800; line-height: 1; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.stat-card.accent { 
  background: rgba(232,160,0,.25); 
  border-color: rgba(232,160,0,.40); 
}
.stat-card.accent .stat-label { color: rgba(255,255,255,.85); }
.stat-card.accent:hover { background: rgba(232,160,0,.35); }

/* ── Search Bar ──────────────────────────────────────── */
.search-bar-wrapper {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  height: var(--searchbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 999;
  box-shadow: var(--shadow-sm);
}

.search-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 100%;
  padding: 0 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.search-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  max-width: 520px;
  height: 46px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  transition: border-color .2s, box-shadow .2s;
}

.search-input-wrap:focus-within {
  border-color: var(--emo-blue);
  box-shadow: 0 0 0 4px rgba(27,63,139,.1);
}

.search-icon { padding: 0 14px; font-size: 18px; color: var(--text-light); user-select: none; }

.search-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
}

.search-input-wrap input::placeholder { color: var(--text-light); }

.clear-btn {
  background: none; border: none; cursor: pointer;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text-light);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.clear-btn.visible { opacity: 1; pointer-events: auto; }
.clear-btn:hover { color: var(--emo-blue); }

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.filter-btn {
  padding: 10px 18px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.filter-btn:hover  { border-color: var(--emo-blue); color: var(--emo-blue); }
.filter-btn.active {
  background: var(--emo-blue);
  border-color: var(--emo-blue);
  color: #fff;
}

.sube-select {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
  outline: none;
  transition: border-color .2s;
  max-width: 220px;
}
.sube-select:focus { border-color: var(--emo-blue); }

/* ── View Toggle ─────────────────────────────────────── */
.view-toggle {
  display: inline-flex;
  background: var(--bg);
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--border);
}

.view-btn {
  background: transparent;
  border: none;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-btn:hover { color: var(--text-primary); background: rgba(0,0,0,0.02); }
.view-btn.active {
  background: var(--surface);
  color: var(--emo-blue);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.view-btn svg { width: 16px; height: 16px; }

/* ── Main Layout ─────────────────────────────────────── */
.main-layout {
  display: flex;
  position: fixed;
  top: calc(var(--header-h) + var(--searchbar-h));
  left: 0; right: 0; bottom: 0;
}

/* ── Map ─────────────────────────────────────────────── */
.map-container {
  flex: 1;
  height: 100%;
  z-index: 1;
}

/* Leaflet popup tweak */
.leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

/* ── Side Panel ──────────────────────────────────────── */
.side-panel {
  width: 340px;
  min-width: 280px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 16px rgba(0,0,0,.08);
  z-index: 2;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.panel-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.panel-count {
  font-size: 11px;
  font-weight: 600;
  background: var(--emo-blue-light);
  color: var(--emo-blue);
  padding: 2px 10px;
  border-radius: 12px;
}

.result-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.result-list::-webkit-scrollbar { width: 5px; }
.result-list::-webkit-scrollbar-track { background: transparent; }
.result-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Result Card ─────────────────────────────────────── */
.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .18s;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--border);
  transition: background .18s;
}

.result-card.type-sube::before        { background: var(--emo-blue); }
.result-card.type-temsilcilik::before { background: #2a9d8f; }

.result-card:hover {
  border-color: var(--emo-blue);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}

.card-type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 5px;
}

.badge-sube        { background: var(--emo-blue-light); color: var(--emo-blue); }
.badge-temsilcilik { background: #e6f6f4; color: #1a7a6e; }

.card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.card-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.card-contact {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10.5px;
}

/* ── Loading Spinner ─────────────────────────────────── */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-light);
  font-size: 13px;
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--emo-blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 10px; }
.empty-state p { font-size: 13px; }

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  backdrop-filter: blur(4px);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 560px;
  max-width: calc(100vw - 32px);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: translateY(20px);
  transition: transform .2s;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--bg);
  border: none;
  border-radius: 50%;
  width: 30px; height: 30px;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  z-index: 1;
}
.modal-close:hover { background: var(--emo-blue-light); color: var(--emo-blue); }

.modal-body { padding: 24px; }

.modal-header { 
  display: flex; 
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.modal-icon.sube        { background: var(--emo-blue-light); }
.modal-icon.temsilcilik { background: #e6f6f4; }

.modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.modal-sube  { font-size: 12px; color: var(--emo-blue); font-weight: 600; }

.modal-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.info-item { display: flex; flex-direction: column; gap: 3px; }
.info-label { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-light); font-weight: 600; }
.info-value { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.info-value a { color: var(--emo-blue); text-decoration: none; }
.info-value a:hover { text-decoration: underline; }

.info-item.full-width { grid-column: 1 / -1; }

.modal-section { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.modal-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-light); margin-bottom: 10px; }

.personnel-list { display: flex; flex-direction: column; gap: 7px; }

.personnel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border-radius: 8px;
  padding: 8px 12px;
}

.personnel-badge {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--emo-blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.personnel-badge.alt { background: #2a9d8f; }

.personnel-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); flex: 1; }
.personnel-sicil { font-size: 11px; color: var(--text-light); background: var(--border); border-radius: 4px; padding: 1px 6px; }

/* ── Custom Leaflet Markers ──────────────────────────── */
.sube-marker-icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--emo-blue);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 3px 12px rgba(27,63,139,.4);
  border: 2.5px solid #fff;
}
.sube-marker-icon span { transform: rotate(45deg); font-size: 16px; }

.temsilcilik-marker-icon {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: #2a9d8f;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(42,157,143,.5);
  border: 2px solid #fff;
  font-size: 12px;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 860px) {
  .logo-title { font-size: 12px; }
  .header-stats { display: none; }
  
  .main-layout { flex-direction: column; }
  .map-container { height: 60%; flex: none; }
  .side-panel { width: 100%; border-left: none; border-top: 1px solid var(--border); height: 40%; }

  .search-bar-inner { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .search-input-wrap { max-width: 100%; }
  .search-bar-wrapper { height: auto; }
  
  :root { --searchbar-h: 104px; }
  .filter-btn { padding: 5px 10px; font-size: 11px; }
}

@media (max-width: 520px) {
  .filter-group { overflow-x: auto; padding-bottom: 4px; }
  .modal-info-grid { grid-template-columns: 1fr; }
  .logo-sub { display: none; }
}

/* ── List Layout (New) ───────────────────────────────── */
.list-layout {
  position: absolute;
  top: calc(var(--header-h) + var(--searchbar-h));
  left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg);
  z-index: 10;
}

.list-container {
  max-width: 1400px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.modern-table thead {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}

.modern-table th {
  padding: 14px 16px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}

.modern-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.modern-table tbody tr {
  transition: background-color 0.15s ease;
}

.modern-table tbody tr:hover {
  background-color: var(--emo-blue-light);
}

.modern-table .td-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 4px;
  display: block;
}

.modern-table .td-badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  margin-bottom: 6px;
}
.modern-table .td-badge.type-sube { background: var(--emo-blue-light); color: var(--emo-blue); }
.modern-table .td-badge.type-temsilcilik { background: #e6f6f4; color: #1a7a6e; }

.modern-table .td-sub {
  color: var(--text-secondary);
  font-size: 12px;
}

.modern-table .contact-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.modern-table .contact-icon {
  color: var(--text-light);
  font-size: 13px;
  width: 16px;
  text-align: center;
}
.modern-table td a { color: var(--emo-blue); text-decoration: none; }
.modern-table td a:hover { text-decoration: underline; }

.loading-cell {
  padding: 40px !important;
  color: var(--text-light);
  font-family: monospace;
}
