/* =========================================================
   AutoLike Admin Dashboard - 60-30-10 Light Theme & Mobile-First
   ========================================================= */

:root {
  /* 60% Dominant Neutral Light Backgrounds */
  --bg-primary: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F5F9;

  /* 30% Secondary Structure, Borders & Typography */
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border-light: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);

  /* 10% Vibrant Accents */
  --accent-primary: #4F46E5; /* Indigo */
  --accent-primary-hover: #4338CA;
  --accent-secondary: #0284C7; /* Cyan/Sky */
  --accent-success: #10B981; /* Emerald */
  --accent-warning: #F59E0B; /* Amber */
  --accent-danger: #EF4444; /* Rose */

  --font-family: 'Prompt', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container */
.app-viewport {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 90px; /* Space for mobile bottom bar */
}

@media (min-width: 768px) {
  .app-viewport {
    padding: 24px;
    padding-bottom: 40px;
  }
}

/* Header Navbar */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 22px;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-text span {
  font-size: 12px;
  color: var(--text-muted);
}

.user-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 10px;
  height: 10px;
  background-color: var(--accent-success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-success);
  display: inline-block;
  flex-shrink: 0;
}

.header-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
  white-space: nowrap;
}

.header-action-btn:hover {
  background: var(--bg-surface);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.btn-refresh-all:hover {
  background: rgba(2, 132, 199, 0.08);
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
}

.btn-logout:hover {
  background: var(--accent-danger);
  color: #ffffff;
  border-color: var(--accent-danger);
}

.spinning {
  animation: spin 0.8s linear infinite;
}

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

@media (max-width: 640px) {
  .top-nav {
    padding: 10px 12px;
  }
  
  .brand-badge {
    gap: 8px;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .brand-text h1 {
    font-size: 14px;
  }

  .brand-text span {
    display: none;
  }

  .user-status {
    gap: 6px;
  }

  .header-action-btn {
    padding: 6px 10px;
    min-height: 36px;
    font-size: 12px;
  }

  .header-action-btn .nav-btn-text {
    display: none;
  }

  .header-action-btn i {
    font-size: 16px;
  }
}

/* Tabs Header Desktop */
.nav-tabs-desktop {
  display: none;
  gap: 8px;
  background: var(--bg-surface);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .nav-tabs-desktop {
    display: flex;
  }
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Navigation Bottom Mobile */
.mobile-bottom-bar {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  padding: 8px 12px;
  z-index: 100;
  box-shadow: 0 -4px 15px rgba(15, 23, 42, 0.08);
}

@media (min-width: 768px) {
  .mobile-bottom-bar {
    display: none;
  }
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
}

.mobile-nav-item i {
  font-size: 20px;
}

.mobile-nav-item.active {
  color: var(--accent-primary);
}

/* Grid & Cards */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-info span {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
}

.stat-info h3 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-top: 4px;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-icon.indigo {
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent-primary);
}

.stat-icon.sky {
  background: rgba(2, 132, 199, 0.1);
  color: var(--accent-secondary);
}

.stat-icon.emerald {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-success);
}

.stat-icon.amber {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-warning);
}

/* Content Sections */
.card-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .card-section {
    padding: 28px;
  }
}

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

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.section-title i {
  color: var(--accent-primary);
  font-size: 22px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  box-shadow: 0 6px 15px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: #E2E8F0;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: var(--accent-danger);
  color: #ffffff;
}

/* Form Inputs */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-main);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 44px;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.custom-table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
}

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

.custom-table tr:hover {
  background: rgba(241, 245, 249, 0.5);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-pending { background: rgba(245, 158, 11, 0.15); color: #B45309; }
.badge-queued { background: rgba(2, 132, 199, 0.15); color: #0369A1; }
.badge-processing { background: rgba(79, 70, 229, 0.15); color: #4338CA; }
.badge-completed { background: rgba(16, 185, 129, 0.15); color: #047857; }
.badge-failed { background: rgba(239, 68, 68, 0.15); color: #B91C1C; }

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

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

.modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-surface);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  animation: slideIn 0.3s ease;
}

.toast.success { border-left-color: var(--accent-success); }
.toast.error { border-left-color: var(--accent-danger); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Login Page Styling */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #ffffff;
  font-size: 32px;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.login-card h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.login-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* =========================================================
   Responsive Desktop vs Mobile Card Views
   ========================================================= */
.desktop-table-view {
  display: none;
}

.mobile-card-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 768px) {
  .desktop-table-view {
    display: block;
  }
  .mobile-card-list {
    display: none;
  }
}

/* Mobile Card Styling */
.mobile-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.mobile-card-title .page-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
  line-height: 1.3;
}

.mobile-card-title .page-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.mobile-card-title .post-id {
  font-family: monospace;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
  word-break: break-all;
}

.mobile-card-title .post-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.mobile-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.mobile-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-card-row .row-label {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.mobile-card-row .row-value {
  font-weight: 600;
  color: var(--text-main);
  text-align: right;
}

.post-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
}

.error-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--accent-danger);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  margin-top: 4px;
}

.mobile-card-footer {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.btn-flex {
  flex: 1;
  min-height: 40px;
  font-size: 13px;
}

.btn-sm {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
}

/* =========================================================
   Reports & Analytics Filter Bar
   ========================================================= */
.filter-bar {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-preset-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

.preset-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-preset {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-preset:hover, .btn-preset.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.filter-inputs-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.date-range-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.input-date-picker {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}

/* Fix browser date picker rendering overflow on mobile Safari/Chrome */
input[type="date"].form-control {
  box-sizing: border-box;
  max-width: 100%;
  padding-right: 4px;
}

.btn-report-search {
  width: 100%;
  min-height: 40px;
  font-size: 14px;
}

@media (min-width: 768px) {
  .filter-preset-container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .filter-inputs-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr auto;
    align-items: end;
    gap: 14px;
  }
}

/* Pull to Refresh Indicator */
.pull-refresh-banner {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-primary);
  transition: all 0.25s ease;
  opacity: 0;
  box-shadow: var(--shadow-sm);
}

.pull-refresh-banner.active {
  height: 44px;
  margin-bottom: 12px;
  opacity: 1;
}

.pull-refresh-banner i {
  font-size: 18px;
  transition: transform 0.2s ease;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-top: 16px;
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination-buttons .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}


