:root {
  --bg-primary: radial-gradient(circle at 18% 14%, #1a2458 0%, #161743 32%, #2b1463 68%, #4f1d72 100%);
  --bg-card: rgba(10, 16, 44, 0.82);
  --border: rgba(176, 162, 255, 0.28);
  --purple: #8a63ff;
  --purple-light: #b085ff;
  --teal: #33d1c6;
  --amber: #f5b94f;
  --pink: #ff63c8;
  --green: #4ce6a4;
  --text-primary: #edf0ff;
  --text-muted: rgba(221, 224, 255, 0.72);
  --text-hint: rgba(221, 224, 255, 0.45);
  --radius: 10px;
  --sidebar-w: 220px;
  --shadow-sm: 0 3px 10px rgba(8, 6, 28, 0.35);
  --shadow-card: 0 12px 26px rgba(6, 8, 28, 0.42);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  font-family: "Poppins", system-ui, sans-serif;
  font-weight: 700;
}

.logo-link {
  display: inline-block;
  line-height: 0;
  text-decoration: none;
}
.logo-link:hover {
  text-decoration: none;
  opacity: 0.92;
}
.logo-img {
  display: block;
  height: 36px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  object-position: left center;
}
.landing .logo-img {
  height: clamp(48px, 12vw, 88px);
  max-width: min(320px, 85vw);
  margin: 0 auto;
  object-position: center;
}
.login-card .logo-img {
  height: 52px;
  max-width: 220px;
  margin: 0 auto;
}
.sidebar .logo-img {
  height: 75px;
  max-width: 200px;
}

a {
  color: var(--purple);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Buton görünümlü linkler: mor/metin çakışması ve hover kaybı olmasın */
a.btn,
a.btn:visited {
  color: var(--text-primary);
  text-decoration: none;
}
a.btn:hover,
a.btn:focus-visible {
  color: var(--text-primary);
  text-decoration: none;
}
a.btn-primary,
a.btn-primary:visited {
  color: #fff;
}
a.btn-primary:hover,
a.btn-primary:focus-visible {
  color: #fff;
  text-decoration: none;
}
a.btn-danger,
a.btn-danger:visited {
  color: #ff93db;
}
a.btn-danger:hover,
a.btn-danger:focus-visible {
  color: #ffd2f1;
  text-decoration: none;
}
button.btn {
  color: var(--text-primary);
}
button.btn-primary {
  color: #fff;
}
button.btn-danger {
  color: #ff93db;
}

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
}
.landing .logo-wrap {
  margin: 0;
}

.muted {
  color: var(--text-muted);
  margin: 0;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  background: rgba(8, 12, 37, 0.84);
}
.sidebar .logo {
  padding: 0 1.25rem 1rem;
  margin: 0;
}
.sidebar nav a {
  display: block;
  padding: 0.65rem 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--text-primary);
  background: rgba(138, 99, 255, 0.18);
  border-left-color: var(--purple);
}

.main {
  flex: 1;
  padding: 1.5rem 2rem;
  overflow-x: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  margin: 0;
  font-size: 1.5rem;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.translate-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-translate {
  min-width: 52px;
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
}
.page-tools {
  position: fixed;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 20;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  background: rgba(138, 99, 255, 0.15);
  border-color: rgba(176, 162, 255, 0.5);
  color: var(--text-primary);
}
.btn:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}
.btn-primary {
  background: linear-gradient(135deg, #6e4de9, #9f4cdc);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(112, 73, 232, 0.42);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #6040d2, #8f3dc9);
  filter: none;
  color: #fff;
  box-shadow: 0 10px 24px rgba(112, 73, 232, 0.5);
}
.btn-primary:focus-visible {
  outline-color: var(--purple);
}
.btn-ghost {
  background: transparent;
  box-shadow: none;
}
.btn-ghost:hover {
  background: rgba(138, 99, 255, 0.12);
  border-color: rgba(176, 162, 255, 0.42);
  color: var(--text-primary);
}
.btn-danger {
  border-color: rgba(255, 99, 200, 0.48);
  color: #ff93db;
  background: rgba(44, 12, 58, 0.55);
}
.btn-danger:hover {
  background: rgba(88, 24, 112, 0.6);
  border-color: rgba(255, 99, 200, 0.7);
  color: #ffd2f1;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent, var(--purple)), transparent);
}
.card-accent-purple {
  --accent: var(--purple);
}
.card-accent-teal {
  --accent: var(--teal);
}
.card-accent-amber {
  --accent: var(--amber);
}
.card-accent-pink {
  --accent: var(--pink);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card .label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0 0 0.35rem;
}
.kpi-card .value {
  font-family: "Poppins", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  background: var(--bg-card);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
table.data th,
table.data td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.data th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.data tbody tr:hover {
  background: rgba(138, 99, 255, 0.09);
}
.url-clip {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-active {
  background: rgba(76, 230, 164, 0.18);
  color: var(--green);
}
.badge-inactive {
  background: rgba(144, 150, 198, 0.18);
  color: var(--text-muted);
}
.badge-partner {
  background: rgba(138, 99, 255, 0.22);
  color: var(--purple);
  margin-left: 0.35rem;
  vertical-align: middle;
}
.hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
  line-height: 1.35;
}
.partner-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}
.partner-bar .form-group {
  flex: 1;
  min-width: 220px;
  margin-bottom: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}
.toolbar input,
.toolbar select {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  min-width: 160px;
  box-shadow: var(--shadow-sm);
}
select option {
  color: var(--text-primary);
  background: var(--bg-card);
}

.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
}
.form-group input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 19, 0.68);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-backdrop.open {
  display: flex;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(4, 5, 21, 0.58);
}
.modal h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.alert {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.alert-error {
  background: rgba(255, 99, 200, 0.14);
  border: 1px solid rgba(255, 99, 200, 0.4);
  color: #ffd2f1;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 400px;
}
.login-card .logo {
  text-align: center;
  margin-bottom: 1rem;
}

.pager {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.pager .pager-text {
  color: var(--text-primary);
  font-weight: 500;
}

.source-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}
.source-facebook {
  background: rgba(101, 146, 255, 0.18);
  color: #9ec2ff;
}
.source-telegram {
  background: rgba(76, 230, 164, 0.16);
  color: #7ff0bf;
}
.source-instagram {
  background: rgba(176, 133, 255, 0.18);
  color: #c9abff;
}
.source-google {
  background: rgba(255, 138, 122, 0.18);
  color: #ffb0a3;
}
.source-direct {
  background: rgba(144, 150, 198, 0.15);
  color: var(--text-muted);
}

.unique-yes {
  color: var(--green);
}
.unique-no {
  color: var(--text-hint);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.chart-box {
  min-height: 260px;
}
.chart-box h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 600;
}

/* Analytics: periyot etiketi ve kart başlıkları açık zeminde okunaklı */
.page-analytics .toolbar > label.muted {
  color: rgba(221, 224, 255, 0.84);
  font-weight: 500;
}
.page-analytics .card > h3 {
  color: var(--text-primary);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.row-actions .btn {
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  box-shadow: none;
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  .sidebar nav a {
    border-left: none;
    border-bottom: 3px solid transparent;
    border-radius: var(--radius);
  }
  .sidebar nav a.active {
    border-left-color: transparent;
    border-bottom-color: var(--purple);
  }
  .page-tools {
    top: 0.55rem;
    right: 0.55rem;
  }
}
