/* ============================================================
   OTOGARIM.COM — Admin Panel Tasarımı
   ============================================================ */

/* ---------- Temel Ayarlar ---------- */
.admin-body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Giriş Ekranı (Auth Wrapper) ---------- */
.auth-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
}

.auth-topbar {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 20;
  display: flex;
  gap: 10px;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(15, 20, 22, 0.06);
}

.auth-back.primary {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
  border-color: transparent;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 40px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--amber), var(--amber-2));
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.auth-logo img {
  height: 44px;
}

.auth-card h2 {
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-subtitle {
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}

.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.25s ease;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 48px;
}

.toggle-pwd-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  outline: none;
}

.toggle-pwd-btn:hover {
  color: var(--text);
}

.btn-block {
  width: 100%;
}

.alert-box {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.88rem;
  margin-bottom: 20px;
  font-weight: 500;
  line-height: 1.4;
}

.alert-box.error {
  background: var(--red-soft);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.alert-box.success {
  background: var(--green-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
}

/* ---------- Dashboard Layout ---------- */
.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-logo {
  height: 32px;
}

.admin-badge {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  color: var(--text-2);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
  outline: none;
}

.nav-item:hover {
  background: var(--glass);
  color: var(--text);
}

.nav-item.active {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.1rem;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-avatar {
  width: 40px;
  height: 40px;
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.admin-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-info .name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-info .email {
  font-size: 0.75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 48px;
  max-width: 1200px;
  width: calc(100% - 280px);
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

.pane-header {
  margin-bottom: 36px;
}

.pane-header h1 {
  font-size: 2.2rem;
  font-weight: 950;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.pane-header p {
  color: var(--muted);
  font-size: 1.05rem;
}

/* ---------- Stats Grid (Genel Bakış) ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.stat-icon {
  width: 56px;
  height: 56px;
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--amber);
}

.stat-icon.green {
  background: var(--green-soft);
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--green);
}

.stat-icon.blue {
  background: var(--blue-soft);
  border-color: rgba(59, 130, 246, 0.25);
  color: var(--blue);
}

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

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-number {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1.2;
}

.system-logs-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
}

.system-logs-card h3 {
  font-size: 1.3rem;
  font-weight: 750;
  margin-bottom: 8px;
}

.logs-intro {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.live-connection {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 600;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background-color: var(--green);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.6s infinite;
}

/* ---------- Table UI (Listeler) ---------- */
.table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.search-wrapper {
  flex: 1;
  max-width: 400px;
}

.search-wrapper input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 30px;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-wrapper input:focus {
  border-color: var(--amber);
  background: var(--surface-2);
}

.filter-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-wrapper select {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 30px;
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
}

.table-responsive {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.admin-table td {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  font-size: 0.92rem;
  vertical-align: middle;
}

.admin-table tbody tr {
  transition: background 0.15s ease;
}

.admin-table tbody tr:hover {
  background: var(--glass);
}

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

.loading-row {
  text-align: center;
  padding: 48px !important;
  color: var(--muted);
  font-weight: 500;
}

.empty-row {
  text-align: center;
  padding: 48px !important;
  color: var(--faint);
  font-weight: 500;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.badge.pro {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--amber);
}

.badge.trial {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--blue);
}

.badge.starter {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-2);
}

.badge.enterprise {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--green);
}

.badge.none {
  background: var(--red-soft);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--red);
}

.badge.active {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--green);
}

.badge.suspended,
.badge.blocked {
  background: var(--red-soft);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--red);
}

.countdown-indicator {
  font-size: 0.8rem;
  margin-top: 4px;
  display: block;
}

.countdown-indicator.warning {
  color: var(--amber);
  font-weight: 600;
}

.countdown-indicator.danger {
  color: var(--red);
  font-weight: 700;
}

.countdown-indicator.success {
  color: var(--green);
}

.stripe-info-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: monospace;
  font-size: 0.78rem;
}

.stripe-info-cell span {
  display: inline-block;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stripe-info-cell .no-stripe {
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--faint);
  background: none;
  border: none;
  padding: 0;
}

.actions-col {
  width: 140px;
  text-align: right !important;
}

.btn-group {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ---------- Modals (Dialog) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.25s ease;
}

.modal-card {
  width: 100%;
  max-width: 580px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 750;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.8rem;
  line-height: 1;
  outline: none;
  transition: color 0.15s ease;
}

.modal-close:hover {
  color: var(--text);
}

.modal-card form {
  padding: 28px;
}

.form-help {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
}

.modal-footer {
  margin-top: 28px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ---------- Toaster Component ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 320px;
  max-width: 420px;
  background: var(--surface-2);
  border-left: 4px solid var(--amber);
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success {
  border-left-color: var(--green);
}

.toast.error {
  border-left-color: var(--red);
}

.toast-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.toast-msg {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 1rem;
  line-height: 1;
  padding: 2px;
  outline: none;
}

.toast-close:hover {
  color: var(--text);
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* ---------- split-pane-layout & Activation Codes ---------- */
.split-pane-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 32px;
  align-items: start;
}

.form-card-small {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.form-card-small h3 {
  font-size: 1.1rem;
  font-weight: 750;
  margin-bottom: 20px;
}

.table-responsive-wrapper {
  min-width: 0;
}

.badge.used {
  background: var(--red-soft);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--red);
}

.badge.unused {
  background: var(--green-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--green);
}

/* ---------- Responsive Layout ---------- */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .split-pane-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-wrapper {
    max-width: none;
  }
  
  .filter-wrapper {
    justify-content: space-between;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 80px;
  }
  
  .sidebar-logo {
    display: none;
  }
  
  .admin-badge {
    font-size: 0.5rem;
    padding: 2px 4px;
  }
  
  .nav-item {
    padding: 12px;
    justify-content: center;
  }
  
  .nav-item span:last-child {
    display: none;
  }
  
  .admin-avatar {
    width: 32px;
    height: 32px;
  }
  
  .admin-info {
    display: none;
  }
  
  .logout-btn {
    font-size: 0;
    padding: 10px;
  }
  
  .logout-btn::after {
    content: "🚪";
    font-size: 1.1rem;
  }
  
  .main-content {
    margin-left: 80px;
    width: calc(100% - 80px);
    padding: 24px;
  }
  
  .pane-header h1 {
    font-size: 1.8rem;
  }
}

/* ---------- Flutter marka diliyle admin yenilemesi ---------- */
.admin-body {
  background:
    radial-gradient(circle at 10% 0%, rgba(37, 99, 235, 0.08), transparent 30rem),
    linear-gradient(180deg, #ffffff 0%, #f5f7f8 100%);
}

.auth-card,
.sidebar,
.stat-card,
.system-logs-card,
.table-responsive,
.form-card-small,
.modal-card {
  background: rgba(255, 255, 255, 0.94);
  border-color: var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(15, 20, 22, 0.09);
}

.auth-card::before {
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

.auth-logo img,
.sidebar-logo {
  height: 28px;
}

.admin-badge {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  border-radius: 6px;
}

.sidebar {
  background: rgba(255, 255, 255, 0.9);
}

.sidebar-header,
.sidebar-footer,
.modal-header,
.admin-table th,
.admin-table td {
  border-color: var(--line);
}

.nav-item {
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 10px;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--brand);
}

.nav-item.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.admin-avatar,
.stat-icon {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--brand);
  border-radius: 10px;
}

.stat-icon.green {
  background: var(--green-soft);
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--green);
}

.stat-icon.blue {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.pane-header h1,
.auth-card h2,
.system-logs-card h3,
.form-card-small h3,
.modal-header h3,
.admin-info .name,
.stat-number,
.toast-title {
  color: var(--brand);
}

.form-group input,
.form-group select,
.search-wrapper input,
.filter-wrapper select {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
  border-radius: 10px;
}

.form-group input:focus,
.form-group select:focus,
.search-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.admin-table th {
  background: #f8fafc;
  color: var(--brand);
}

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

.stripe-info-cell span,
.live-connection {
  background: var(--surface-2);
  border-color: var(--line);
}

.badge.pro,
.badge.trial {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.modal-overlay {
  background: rgba(15, 20, 22, 0.38);
}

.toast {
  background: #ffffff;
  border-color: var(--line);
  border-left-color: var(--accent);
  box-shadow: 0 18px 40px rgba(15, 20, 22, 0.14);
}

@media (max-width: 520px) {
  .auth-wrapper {
    padding: 96px 16px 24px;
    overflow-x: hidden;
  }

  .auth-topbar {
    top: 16px;
    left: 16px;
    right: 16px;
    justify-content: center;
  }

  .auth-back {
    flex: 1;
    max-width: 150px;
  }

  .auth-card {
    width: 100%;
    max-width: 440px;
    flex: 0 1 440px;
    padding: 32px 24px;
  }

  .auth-subtitle {
    max-width: 260px;
    margin-left: auto;
    margin-right: auto;
  }

  .auth-card .form-group input,
  .auth-card .btn-block {
    width: calc(100% - 24px);
  }
}

/* Sidebar sekme sayacı — okunmamış demo talebi rozeti */
.nav-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: var(--red, #ef4444);
}
.nav-item { display: flex; align-items: center; gap: 8px; }
