@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800&display=swap');

:root {
  --pink: #ff0a78;
  --pink-alt: #fe0075;
  --purple: #432655;
  --purple-dark: #431c5d;
  --navy: #1b1464;
  --white: #ffffff;
  --bg: #faf8fb;
  --border: rgba(67, 38, 85, 0.1);
  --shadow: 0 8px 30px rgba(67, 38, 85, 0.08);
  --radius: 14px;
  --sidebar-w: 240px;
}

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

body.admin-body {
  margin: 0;
  min-height: 100vh;
  font-family: "Poppins", sans-serif;
  color: var(--purple);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.admin-body--login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(145deg, #fff 0%, #fdf0f6 45%, #f5eef8 100%);
}

/* Shell layout */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  font-weight: 800;
  font-size: 17px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #7a6b85;
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: rgba(255, 10, 120, 0.06);
  color: var(--pink);
}

.sidebar-link.active {
  background: rgba(255, 10, 120, 0.1);
  color: var(--pink-alt);
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

/* Main area */
.admin-content-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.admin-header__title {
  font-size: 20px;
  font-weight: 800;
}

.admin-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-main {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.section-panel.hidden { display: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn--primary {
  background: var(--pink-alt);
  color: var(--white);
  box-shadow: 0 6px 18px rgba(254, 0, 117, 0.28);
}

.btn--primary:hover {
  background: var(--pink);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--pink);
  border: 1px solid rgba(255, 10, 120, 0.35);
}

.btn--ghost:hover {
  background: rgba(255, 10, 120, 0.08);
}

.btn--danger {
  background: #e53935;
  color: var(--white);
}

.btn--sm {
  padding: 8px 14px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* Login */
.login-card {
  width: min(420px, 100%);
  padding: 40px 36px;
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.login-card__logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 12px;
}

.login-card h1 {
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}

.login-card p {
  text-align: center;
  color: #7a6b85;
  margin-bottom: 28px;
  font-size: 14px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 13px 14px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--purple);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255, 10, 120, 0.12);
}

.field select {
  width: 100%;
  padding: 13px 14px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--purple);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.field select:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255, 10, 120, 0.12);
}

.field textarea {
  width: 100%;
  padding: 13px 14px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--purple);
  outline: none;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255, 10, 120, 0.12);
}

.notify-panel {
  max-width: 560px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-card .btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  font-size: 15px;
}

.login-error {
  display: none;
  margin-top: 14px;
  padding: 10px 12px;
  background: #fff0f3;
  color: #c62828;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
}

.login-error.show { display: block; }

.section-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 18px;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stat-card__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8a7a96;
  margin-bottom: 8px;
}

.stat-card__value {
  font-size: 32px;
  font-weight: 800;
  color: var(--purple);
  line-height: 1;
}

.stat-card--accent .stat-card__value {
  color: var(--pink-alt);
}

.stat-card__hint {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 500;
  color: #a89ab0;
  line-height: 1.35;
}

.chart-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px 18px;
  margin-top: 20px;
}

.chart-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.chart-card__title {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  color: var(--purple);
}

.chart-card__sub {
  font-size: 13px;
  color: #8a7a96;
  margin: 4px 0 0;
}

.chart-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-period {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--purple);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chart-period:hover {
  border-color: rgba(255, 10, 120, 0.35);
}

.chart-period.active {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
}

.chart-wrap {
  position: relative;
  height: 280px;
}

.chart-summary {
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: #7a6b85;
}

/* Instagram panel (inside Ayarlar) */
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 640px;
}

.settings-section-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}

.settings-panel.ig-panel {
  max-width: none;
}

.ig-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.ig-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ig-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.ig-status--on {
  background: #e8f5e9;
  color: #2e7d32;
}

.ig-status--off {
  background: #fce4ec;
  color: #c2185b;
}

.ig-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  align-items: end;
}

.ig-code-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.ig-code-row input {
  flex: 1;
  min-width: 160px;
  padding: 13px 14px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}

.ig-code-row input:focus {
  border-color: var(--pink);
}

/* Settings */
.settings-panel {
  max-width: none;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
}

.settings-note {
  font-size: 13px;
  color: #7a6b85;
  line-height: 1.5;
  margin: 0 0 20px;
  padding: 12px 14px;
  background: #fdf6fa;
  border-radius: 10px;
  border: 1px solid rgba(255, 10, 120, 0.12);
}

.settings-note code {
  font-size: 12px;
  background: rgba(67, 38, 85, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.settings-form .field {
  margin-bottom: 18px;
}

.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #8a7a96;
  line-height: 1.4;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.settings-msg {
  font-size: 13px;
  font-weight: 600;
  color: #7a6b85;
}

/* API Document */
.apidoc-status {
  margin-bottom: 32px;
}

.apidoc-heading {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 16px;
  color: var(--purple);
}

.apidoc-group {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
}

.apidoc-group__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.apidoc-base {
  font-size: 12px;
  color: #8a7a96;
  background: #f8f5fa;
  padding: 4px 10px;
  border-radius: 6px;
  word-break: break-all;
}

.apidoc-desc {
  font-size: 13px;
  color: #7a6b85;
  line-height: 1.55;
  margin: 0 0 16px;
}

.apidoc-table-wrap {
  overflow-x: auto;
}

.apidoc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.apidoc-table th,
.apidoc-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.apidoc-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8a7a96;
  background: #fcfafc;
}

.apidoc-table tr:last-child td {
  border-bottom: none;
}

.api-method {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.api-method--get { background: #e8f5e9; color: #2e7d32; }
.api-method--post { background: #e3f2fd; color: #1565c0; }
.api-method--put { background: #fff3e0; color: #ef6c00; }
.api-method--delete { background: #ffebee; color: #c62828; }
.api-method--socket,
.api-method--emit,
.api-method--listen { background: #f3e5f5; color: #7b1fa2; }
.api-method--db,
.api-method--cron { background: #eceff1; color: #455a64; }

.api-path {
  font-size: 12px;
  background: rgba(67, 38, 85, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-word;
}

/* Sockets */
.socket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.socket-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.socket-section {
  margin-bottom: 28px;
}

.socket-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.socket-section__head .apidoc-heading {
  margin-bottom: 0;
}

.socket-info {
  margin-bottom: 20px;
}

.socket-section .apidoc-heading {
  margin-bottom: 12px;
}

.socket-hint {
  font-size: 12px;
  font-weight: 500;
  color: #8a7a96;
  margin-left: 8px;
}

.socket-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #7a6b85;
}

.socket-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.socket-card__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8a7a96;
  margin-bottom: 6px;
}

.socket-card__value {
  font-size: 15px;
  font-weight: 600;
  word-break: break-all;
}

.socket-card__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
}

.socket-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
}

.socket-dot--on { background: #43a047; }
.socket-dot--off { background: #e53935; }

/* Players */
.players-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.search-box {
  flex: 1;
  min-width: 220px;
  max-width: 360px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  outline: none;
}

.search-box input:focus {
  border-color: var(--pink);
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  opacity: 0.45;
}

.players-table-wrap {
  overflow-x: auto;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.players-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.players-table th,
.players-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.players-table th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8a7a96;
  background: #fcfafc;
}

.players-table tr:last-child td {
  border-bottom: none;
}

.players-table tr:hover td {
  background: rgba(255, 10, 120, 0.03);
}

.player-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: #8a7a96;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--white);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}

.modal h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 20px;
}

.modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

.modal__actions .btn--danger { margin-right: auto; }

.loader {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loader--dark {
  border-color: rgba(67, 38, 85, 0.15);
  border-top-color: var(--pink);
}

@keyframes spin { to { transform: rotate(360deg); } }

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
}

.hidden { display: none !important; }

.stats-grid--secondary {
  margin-top: 12px;
}

.chart-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 0 20px 16px;
}

.chart-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: #8a7a96;
}

.chart-filter {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--purple);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chart-filter.active {
  background: rgba(255, 10, 120, 0.12);
  border-color: rgba(255, 10, 120, 0.35);
  color: var(--pink);
}

.players-table-wrap--wide {
  overflow-x: auto;
}

.players-table--wide {
  min-width: 1100px;
}

.players-actions {
  white-space: nowrap;
}

.players-actions .btn + .btn {
  margin-left: 6px;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.pill--ok {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

.pill--muted {
  background: rgba(67, 38, 85, 0.08);
  color: #7a6b85;
}

.pill--app {
  background: rgba(255, 10, 120, 0.12);
  color: var(--pink);
}

.pill--browser {
  background: rgba(27, 20, 100, 0.1);
  color: var(--navy);
}

.user-type-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(67, 38, 85, 0.08);
  color: #6b5c75;
}

.modal--wide {
  max-width: 720px;
  width: calc(100% - 32px);
}

.modal__head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal__head-row h2 {
  margin: 0;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(67, 38, 85, 0.04);
}

.detail-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #8a7a96;
  margin-bottom: 4px;
}

.detail-block h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.detail-list {
  margin: 0;
  padding-left: 18px;
}

.detail-list li {
  margin-bottom: 6px;
}

.detail-empty {
  margin: 0;
  color: #8a7a96;
  font-size: 13px;
}

@media (max-width: 768px) {
  .admin-sidebar {
    width: 72px;
  }

  .sidebar-brand span,
  .sidebar-link span {
    display: none;
  }

  .sidebar-brand {
    justify-content: center;
    padding: 18px 10px;
  }

  .sidebar-link {
    justify-content: center;
    padding: 12px;
  }

  .admin-content-wrap {
    margin-left: 72px;
  }

  .admin-header { padding: 14px 16px; }
  .admin-main { padding: 20px 16px 40px; }
  .players-table th, .players-table td { padding: 10px 12px; font-size: 13px; }
}
