/* ============================================================
   FanPage Manager Dashboard — Design System
   Theme: Dark Glassmorphism Premium
   ============================================================ */

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

/* === CSS Variables === */
:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #0f0f23;
  --bg-card: rgba(15, 15, 35, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(102, 126, 234, 0.5);
  --text-primary: #e8e8f0;
  --text-secondary: #8888a8;
  --text-muted: #555570;
  --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-1: #667eea;
  --accent-2: #764ba2;
  --success: #00d4aa;
  --warning: #f0b429;
  --danger: #ef4444;
  --info: #38bdf8;
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.15);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(118, 75, 162, 0.06) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
}
a { color: var(--accent-1); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-2); }

/* === Login Page === */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px; position: relative; z-index: 1;
}
.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl); padding: 48px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-glass); text-align: center;
  animation: fadeInUp 0.6s ease-out;
}
.login-card .logo { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.login-card .logo span { background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-card .subtitle { color: var(--text-secondary); margin-bottom: 32px; font-size: 0.9rem; }
.login-card .form-group { margin-bottom: 16px; text-align: left; }
.login-card label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-size: 0.85rem; font-weight: 500; }
.login-card input {
  width: 100%; padding: 12px 16px; background: var(--bg-input);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 0.95rem; transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.login-card input:focus { outline: none; border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(102,126,234,0.15); }
.login-card .btn-login {
  width: 100%; padding: 14px; margin-top: 8px;
  background: var(--accent-gradient); border: none; border-radius: var(--radius-sm);
  color: white; font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: var(--transition); font-family: 'Inter', sans-serif;
}
.login-card .btn-login:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.login-card .error-msg { color: var(--danger); font-size: 0.85rem; margin-top: 12px; display: none; }

/* === App Layout === */
.app-layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0;
  background: var(--bg-card); backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column; z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-header .logo-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--accent-gradient); display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; color: white;
}
.sidebar-header h1 { font-size: 1rem; font-weight: 700; }
.sidebar-header h1 span { background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-section { margin-bottom: 8px; }
.nav-section-title {
  padding: 8px 12px; font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted);
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer; transition: var(--transition);
  font-size: 0.9rem; font-weight: 500; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--bg-glass-hover); color: var(--text-primary); }
.nav-item.active {
  background: rgba(102, 126, 234, 0.12); color: var(--accent-1);
  border-left: 3px solid var(--accent-1);
}
.nav-item .icon { font-size: 1.15rem; width: 24px; text-align: center; }
.nav-item .badge {
  margin-left: auto; background: var(--accent-gradient); color: white;
  font-size: 0.7rem; padding: 2px 8px; border-radius: 50px; font-weight: 600;
}

.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border-color);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-footer .user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-gradient); display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: white;
}
.sidebar-footer .user-info { flex: 1; }
.sidebar-footer .user-info .name { font-size: 0.85rem; font-weight: 600; }
.sidebar-footer .user-info .role { font-size: 0.7rem; color: var(--text-muted); }
.sidebar-footer .btn-logout {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 1.1rem; padding: 4px; transition: var(--transition);
}
.sidebar-footer .btn-logout:hover { color: var(--danger); }

/* === Main Content === */
.main-content {
  margin-left: var(--sidebar-width); flex: 1; padding: 24px 32px;
  min-height: 100vh;
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 { font-size: 1.5rem; font-weight: 700; }
.page-header .breadcrumb { color: var(--text-muted); font-size: 0.85rem; }

/* === Cards === */
.card {
  background: var(--bg-card); backdrop-filter: blur(12px);
  border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  padding: 24px; margin-bottom: 20px; transition: var(--transition);
}
.card:hover { border-color: var(--border-active); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color);
}
.card-header h3 { font-size: 1rem; font-weight: 600; }

/* === Stat Cards === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); backdrop-filter: blur(12px);
  border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  padding: 20px 24px; transition: var(--transition); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-gradient); opacity: 0; transition: var(--transition);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-glow); }
.stat-card:hover::before { opacity: 1; }
.stat-card .stat-icon { font-size: 2rem; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }

/* === Tables === */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 12px 16px; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}
tbody td {
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.9rem; vertical-align: middle;
}
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--bg-glass-hover); }

/* === Badges === */
.badge {
  display: inline-flex; align-items: center; padding: 4px 10px;
  border-radius: 50px; font-size: 0.75rem; font-weight: 600;
}
.badge-active { background: rgba(0,212,170,0.12); color: var(--success); }
.badge-paused { background: rgba(240,180,41,0.12); color: var(--warning); }
.badge-published { background: rgba(102,126,234,0.12); color: var(--accent-1); }
.badge-pending { background: rgba(240,180,41,0.12); color: var(--warning); }
.badge-draft { background: rgba(136,136,168,0.12); color: var(--text-secondary); }
.badge-rejected { background: rgba(239,68,68,0.12); color: var(--danger); }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm); font-size: 0.85rem;
  font-weight: 600; cursor: pointer; transition: var(--transition);
  border: 1px solid transparent; font-family: 'Inter', sans-serif;
}
.btn-primary { background: var(--accent-gradient); color: white; border: none; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.btn-secondary { background: var(--bg-glass); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--bg-glass-hover); border-color: var(--border-active); }
.btn-danger { background: rgba(239,68,68,0.12); color: var(--danger); border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); background: var(--bg-glass); border: 1px solid var(--border-color); color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.btn-icon:hover { background: var(--bg-glass-hover); color: var(--text-primary); }

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
.form-control {
  width: 100%; padding: 10px 14px; background: var(--bg-input);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 0.9rem; transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.form-control:focus { outline: none; border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(102,126,234,0.12); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238888a8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* === Modal === */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 1000; display: none; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.2s ease;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: var(--radius-xl); width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto; animation: slideUp 0.3s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-muted); font-size: 1.3rem;
  cursor: pointer; padding: 4px; transition: var(--transition);
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; gap: 12px; justify-content: flex-end; }

/* === Toast Notifications === */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 14px 20px; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 10px;
  font-size: 0.85rem; font-weight: 500; animation: slideInRight 0.3s ease;
  backdrop-filter: blur(12px); border: 1px solid;
  min-width: 300px; max-width: 450px;
}
.toast-success { background: rgba(0,212,170,0.12); border-color: rgba(0,212,170,0.3); color: var(--success); }
.toast-error { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: var(--danger); }
.toast-info { background: rgba(56,189,248,0.12); border-color: rgba(56,189,248,0.3); color: var(--info); }

/* === Media Gallery === */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.media-item {
  position: relative; border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--border-color); transition: var(--transition);
  cursor: pointer; aspect-ratio: 1;
}
.media-item:hover { transform: translateY(-4px); border-color: var(--accent-1); box-shadow: var(--shadow-glow); }
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-item .overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  padding: 12px; font-size: 0.8rem;
}
.media-item .use-count {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  padding: 2px 8px; border-radius: 50px; font-size: 0.7rem; font-weight: 600;
}
.media-item .play-icon {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 48px; height: 48px; background: rgba(0,0,0,0.5);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}

/* === Upload Area === */
.upload-zone {
  border: 2px dashed var(--border-color); border-radius: var(--radius-lg);
  padding: 48px; text-align: center; cursor: pointer; transition: var(--transition);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent-1); background: rgba(102,126,234,0.05);
}
.upload-zone .upload-icon { font-size: 2.5rem; margin-bottom: 12px; color: var(--text-muted); }
.upload-zone p { color: var(--text-secondary); font-size: 0.9rem; }

/* === Timeline / Logs === */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 0; bottom: 0;
  width: 2px; background: var(--border-color);
}
.timeline-item { position: relative; margin-bottom: 20px; padding-left: 20px; }
.timeline-item::before {
  content: ''; position: absolute; left: -21px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-1); border: 2px solid var(--bg-secondary);
}
.timeline-item .time { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.timeline-item .event { font-size: 0.85rem; }

/* === Empty State === */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; color: var(--text-muted); }
.empty-state h3 { color: var(--text-secondary); font-weight: 600; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 20px; }

/* === Animations === */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* === Responsive === */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .media-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* === Loading Skeleton === */
.skeleton { background: linear-gradient(90deg, var(--bg-glass) 25%, var(--bg-glass-hover) 50%, var(--bg-glass) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* === Chart Container === */
.chart-container { position: relative; height: 300px; }
.charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 24px; }
@media (max-width: 1024px) { .charts-row { grid-template-columns: 1fr; } }
