/* ========================================================
   AdsHubCloud - Clean Modern Stylesheet & Admin Engine
   100% Fully Responsive for Mobile, Tablet & Desktop
======================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --secondary: #0f172a;
  --accent: #0ea5e9;
  --success: #16a34a;
  --success-hover: #15803d;
  --warning: #f59e0b;
  --warning-dark: #b45309;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --card-border-hover: #cbd5e1;
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text-body);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ========================================================
   HEADER (Left-Aligned Logo with Clean Spacing)
======================================================== */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--card-border);
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.nav-container {
  width: 100%;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  transition: opacity 0.2s;
}

.brand:hover {
  opacity: 0.9;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  display: block;
  flex-shrink: 0;
}

.brand-text {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.4px;
  line-height: 1;
}

.brand-text span {
  color: var(--primary);
}

/* Containers */
.container {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 20px 16px;
}

.container-admin {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Main Area */
.main-content {
  flex: 1;
  width: 100%;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 24px 22px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 20px;
  width: 100%;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 9px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}

.btn-success:hover:not(:disabled) {
  background: var(--success-hover);
}

.btn:disabled {
  background: #cbd5e1 !important;
  color: #64748b !important;
  cursor: not-allowed;
  box-shadow: none !important;
}

/* Form Inputs */
.url-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 9px;
  background: #ffffff;
  border: 1.5px solid var(--card-border);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
}

.url-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.result-box {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg-subtle);
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  display: none;
  width: 100%;
}

.result-box.show {
  display: block;
}

.result-link-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}

@media (min-width: 640px) {
  .result-link-wrapper {
    flex-direction: row;
    align-items: center;
  }
}

.result-url {
  background: #ffffff;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--primary);
  font-family: monospace;
  font-size: 0.88rem;
  flex: 1;
  overflow-x: auto;
  border: 1px solid #cbd5e1;
  white-space: nowrap;
}

/* Toast */
.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  left: 16px;
  max-width: 380px;
  margin: 0 auto;
  background: #0f172a;
  color: white;
  padding: 11px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  transform: translateY(-80px);
  opacity: 0;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (min-width: 640px) {
  .toast {
    left: auto;
    right: 24px;
    top: 24px;
  }
}

/* Footer */
.site-footer {
  background: #ffffff;
  border-top: 1px solid var(--card-border);
  padding: 20px 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: auto;
  width: 100%;
}

.site-footer p {
  margin: 0;
  font-weight: 500;
}

.hidden {
  display: none !important;
}

/* ========================================================
   ADMIN DASHBOARD NAVIGATION TABS & STATS
======================================================== */
.admin-badge {
  background: #fee2e2;
  color: #b91c1c;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.btn-admin-logout {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.btn-admin-logout:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

/* Admin Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.green { background: #ecfdf5; color: #16a34a; }
.stat-icon.purple { background: #faf5ff; color: #9333ea; }
.stat-icon.amber { background: #fffbeb; color: #d97706; }

.stat-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-lbl {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Admin Navigation Tabs */
.admin-nav-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 22px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
  border-radius: 6px 6px 0 0;
}

/* ========================================================
   DEVELOPERS API STYLES (VPLink / ShrinkMe Style)
======================================================== */
.api-token-container {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 18px;
  margin: 16px 0;
}

.api-token-display {
  display: flex;
  gap: 8px;
  flex-direction: column;
  margin-top: 8px;
}

@media (min-width: 640px) {
  .api-token-display {
    flex-direction: row;
    align-items: center;
  }
}

.token-code {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 11px 14px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 1rem;
  color: var(--text-main);
  letter-spacing: 1px;
  flex: 1;
}

/* Code Snippet Box */
.code-box {
  background: #0f172a;
  border-radius: 10px;
  overflow: hidden;
  margin: 14px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.code-box-header {
  background: #1e293b;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 600;
}

.code-box pre {
  padding: 14px 16px;
  color: #38bdf8;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.code-box pre .param-key { color: #f472b6; }
.code-box pre .param-val { color: #a7f3d0; }

.btn-code-copy {
  background: #334155;
  color: #f1f5f9;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}

.btn-code-copy:hover {
  background: var(--primary);
  color: #ffffff;
}

/* API Tester Box */
.api-tester-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 18px;
  margin: 16px 0;
}

/* Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  margin-top: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
  min-width: 580px;
}

.admin-table th {
  background: #f8fafc;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text-body);
  vertical-align: middle;
}

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

.table-action-btn {
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.table-action-btn.copy { background: #eff6ff; color: #2563eb; }
.table-action-btn.copy:hover { background: #2563eb; color: #ffffff; }
.table-action-btn.test { background: #f0fdf4; color: #16a34a; }
.table-action-btn.test:hover { background: #16a34a; color: #ffffff; }
.table-action-btn.del { background: #fee2e2; color: #dc2626; }
.table-action-btn.del:hover { background: #dc2626; color: #ffffff; }

/* Login Modal */
.admin-lock-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
}

.login-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 32px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .nav-container {
    padding: 10px 16px;
  }

  .container-admin {
    padding: 16px 12px;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand-text {
    font-size: 1.2rem;
  }

  .card {
    padding: 18px 14px;
  }

  .tab-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}
