*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --primary-blue: #0284c7;
  --primary-blue-dark: #0369a1;
  --header-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --success-green: #10b981;
  --danger-red: #ef4444;
  --warning-amber: #f59e0b;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Header Banner */
.portal-header {
  background: var(--header-gradient);
  color: #ffffff;
  padding: 1.25rem 1.75rem;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 4px 20px rgba(2, 132, 199, 0.15);
}

.portal-header-content {
  max-width: 1380px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.portal-title-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.portal-title-area i.portal-logo-icon {
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.75rem;
  border-radius: 14px;
}

.portal-title-area h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
}

.portal-title-area p {
  font-size: 0.9rem;
  margin: 0;
  opacity: 0.9;
}

.portal-meta-area {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sync-badge {
  background: #ffffff;
  color: var(--primary-blue-dark);
  padding: 0.45rem 0.85rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
}

.sync-badge .date-highlight {
  color: #dc2626;
  font-weight: 700;
}

.user-badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.portal-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-portal-logout,
.btn-portal-action {
  background: #ffffff;
  color: #0284c7;
  border: none;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  text-decoration: none;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
}

.btn-portal-logout:hover,
.btn-portal-action:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.btn-portal-danger,
.btn-portal-logout#btnLogout {
  background: rgba(254, 226, 226, 0.95);
  color: #dc2626;
}

.btn-portal-danger:hover,
.btn-portal-logout#btnLogout:hover {
  background: #fee2e2;
  transform: translateY(-1px);
}

/* Main Container */
.main-wrapper {
  max-width: 1380px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* Query Card */
.query-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-color);
  margin-bottom: 1.75rem;
}

.card-heading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.query-input-wrap {
  position: relative;
  margin-bottom: 1.25rem;
}

.tc-textarea {
  width: 100%;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  color: var(--text-main);
  box-sizing: border-box;
  font-family: inherit;
  resize: vertical;
  min-height: 56px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tc-textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.1);
}

.sorgula-btn-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.25rem;
}

.btn-sorgula {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.85rem 2rem;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: all 0.2s;
}

.btn-sorgula:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* Filters Row */
.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
}

.filter-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.filter-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: #ffffff;
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
}

.filter-select:focus {
  border-color: var(--primary-blue);
}

/* Action Summary Bar */
.action-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.record-count-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-quick-filter {
  padding: 0.55rem 1.15rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.btn-quick-green {
  background: #10b981;
  color: #ffffff;
}

.btn-quick-green:hover {
  background: #059669;
}

.btn-quick-red {
  background: #ef4444;
  color: #ffffff;
}

.btn-quick-red:hover {
  background: #dc2626;
}

.btn-quick-zip {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.btn-quick-zip:hover {
  background: #0369a1;
}

.btn-quick-excel {
  background: #10b981;
  color: #ffffff;
}

/* Results Table */
.results-card {
  background: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-color);
}

.table-responsive {
  overflow-x: auto;
}

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

.portal-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 0.9rem 1rem;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.portal-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

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

/* Tablo Sütun Sabitleme ve Hizalama Kuralları (Taşmayı ve dikey bölünmeyi önler) */
.portal-table th.col-tc,
.portal-table td.col-tc {
  white-space: nowrap !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
  color: #0369a1;
}

.portal-table th.col-telefon,
.portal-table td.col-telefon {
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.portal-table th.col-eposta,
.portal-table td.col-eposta {
  white-space: nowrap !important;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-table th.col-egitim,
.portal-table td.col-egitim {
  min-width: 260px;
  max-width: 420px;
  line-height: 1.45;
  white-space: normal !important;
  word-break: normal;
}

.portal-table th.col-nowrap,
.portal-table td.col-nowrap {
  white-space: nowrap !important;
}

/* Badges */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green {
  background: #d1fae5;
  color: #065f46;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.badge-yellow {
  background: #fef3c7;
  color: #92400e;
}

.badge-blue {
  background: #e0f2fe;
  color: #0369a1;
}

/* Action Icons */
.btn-action-icon {
  background: #0284c7;
  color: #ffffff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-action-icon:hover {
  background: #0369a1;
  transform: scale(1.05);
}

.btn-pdf-indir {
  background: #ef4444;
  color: #ffffff;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.btn-pdf-indir:hover {
  background: #dc2626;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  transition: all 0.25s;
}

.modal-overlay.active {
  visibility: visible;
  opacity: 1;
}

.modal-content {
  background: #ffffff;
  border-radius: 20px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
}

/* Spinner */
.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-blue);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  animation: spin 1s linear infinite;
  margin: 1.5rem auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .main-wrapper {
    margin: 1rem auto;
    padding: 0 0.85rem;
  }

  .portal-header {
    padding: 1rem 0.85rem;
    border-radius: 0 0 16px 16px;
  }

  .portal-header-content {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .portal-title-area {
    width: 100%;
    align-items: center;
    gap: 0.75rem;
  }

  .portal-logo-icon, .portal-title-area i.portal-logo-icon {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    padding: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .portal-title-area h1 {
    font-size: 1.15rem;
    line-height: 1.3;
    word-break: break-word;
  }

  .portal-title-area p {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .portal-meta-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }

  .sync-badge, .user-badge {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.85rem;
    font-size: 0.8rem;
    justify-content: flex-start;
  }

  .portal-nav-actions {
    width: 100%;
    display: flex;
    gap: 0.5rem;
  }

  .portal-nav-actions .btn-portal-action,
  .portal-nav-actions .btn-portal-logout,
  .portal-meta-area .btn-portal-logout {
    flex: 1 1 0;
    justify-content: center;
    box-sizing: border-box;
    padding: 0.6rem 0.4rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .query-card {
    padding: 1.15rem;
    border-radius: 14px;
    margin-bottom: 1.25rem;
  }

  .sorgula-btn-wrap {
    width: 100% !important;
    justify-content: stretch !important;
  }

  .btn-sorgula {
    width: 100%;
    justify-content: center;
    padding: 0.85rem 1rem;
    font-size: 1rem;
  }

  .filter-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .action-summary-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0 0.25rem;
  }

  .action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .btn-quick-filter {
    width: 100%;
    justify-content: center;
    padding: 0.65rem 0.5rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .results-card {
    border-radius: 14px;
  }

  .portal-table th, .portal-table td {
    padding: 0.65rem 0.6rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  .portal-header {
    padding: 0.85rem 0.65rem;
  }

  .portal-title-area h1 {
    font-size: 1.05rem;
  }

  .portal-nav-actions {
    flex-wrap: wrap;
  }

  .portal-nav-actions .btn-portal-action,
  .portal-nav-actions .btn-portal-logout,
  .portal-meta-area .btn-portal-logout {
    flex: 1 1 calc(50% - 0.25rem);
  }

  .portal-nav-actions .btn-portal-danger,
  .portal-meta-area .btn-portal-logout#btnLogout {
    flex: 1 1 100%;
  }

  .filter-row {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .action-buttons {
    grid-template-columns: 1fr;
  }
}
