/* Admin Panel Styles */
:root {
  --admin-bg: #f8fafc;
  --admin-card: #ffffff;
  --admin-border: #e2e8f0;
  --admin-text: #0f172a;
  --admin-muted: #64748b;
  --admin-primary: #2563eb;
  --admin-primary-hover: #1d4ed8;
  --admin-danger: #ef4444;
  --admin-danger-hover: #dc2626;
  --admin-success: #10b981;
}

body {
  background: var(--admin-bg) !important;
  color: var(--admin-text) !important;
  font-family: 'Inter', system-ui, sans-serif;
  padding: 0 !important;
  margin: 0 !important;
  min-height: 100vh;
}

/* Login Screen */
.login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
}

.login-box {
  background: #ffffff;
  width: 100%;
  max-width: 400px;
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.login-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.login-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.login-header p {
  font-size: 0.88rem;
  color: #64748b;
  margin-bottom: 24px;
}

.login-footer {
  margin-top: 20px;
}

.back-link {
  color: #64748b;
  font-size: 0.85rem;
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

/* Dashboard Layout */
.dashboard-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.dash-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Tabs Container */
.dash-container {
  max-width: 1000px;
  width: 100%;
  margin: 24px auto;
  padding: 0 20px;
  flex: 1;
}

.dash-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--admin-border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 12px 20px;
  border: none;
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--admin-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--admin-primary);
  border-bottom-color: var(--admin-primary);
}

.tab-btn:hover:not(.active) {
  color: var(--admin-text);
}

.tab-content {
  display: none;
}

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

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.section-header p {
  font-size: 0.85rem;
  color: var(--admin-muted);
}

/* Admin Links Cards */
.admin-links-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-link-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s;
}

.admin-link-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.admin-link-card.inactive {
  opacity: 0.55;
  background: #f1f5f9;
}

.admin-card-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.order-controls {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-order {
  background: #f1f5f9;
  border: 1px solid var(--admin-border);
  border-radius: 4px;
  width: 26px;
  height: 22px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-order:hover { background: #e2e8f0; }

.link-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.link-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.link-url-text {
  font-size: 0.78rem;
  color: var(--admin-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.click-counter {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--admin-primary);
  background: #eff6ff;
  padding: 4px 8px;
  border-radius: 6px;
}

.admin-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--admin-text);
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--admin-primary);
}

.form-group small {
  font-size: 0.78rem;
  color: var(--admin-muted);
}

.form-row {
  display: flex;
  gap: 12px;
}
.flex-1 { flex: 1; }

/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary { background: var(--admin-primary); color: #fff; }
.btn-primary:hover { background: var(--admin-primary-hover); }

.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #cbd5e1; }

.btn-danger { background: var(--admin-danger); color: #fff; }
.btn-danger:hover { background: var(--admin-danger-hover); }

.btn-outline { background: transparent; border: 1px solid var(--admin-border); color: var(--admin-text); }
.btn-outline:hover { background: #f1f5f9; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .slider { background-color: var(--admin-success); }
input:checked + .slider:before { transform: translateX(20px); }

.checkbox-group {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 500px;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 { font-size: 1.2rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--admin-muted);
}

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

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .settings-grid { grid-template-columns: 1fr; }
}

.card-box {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 20px;
}

.card-box h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--admin-border);
  padding-bottom: 8px;
}

.full-width { grid-column: 1 / -1; }

.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.theme-card input { display: none; }

.theme-preview {
  padding: 16px;
  border-radius: 10px;
  border: 2px solid var(--admin-border);
  cursor: pointer;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  transition: border-color 0.2s;
}

.theme-card input:checked + .theme-preview {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.avatar-upload-preview {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-msg {
  font-size: 0.85rem;
  font-weight: 600;
}
.status-msg.success { color: var(--admin-success); }
.status-msg.error { color: var(--admin-danger); }
.error-msg { color: var(--admin-danger); font-size: 0.85rem; margin-bottom: 12px; }
