@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* =========================================
   1. GLOBAL VARIABLES & THEMES
========================================= */
:root {
  /* Vercel & Linear inspired palette (Light) */
  --bg-light: #F8FAFC;
  --text-light: #0B1020;
  --text-muted-light: #64748B;
  --glass-bg-light: rgba(255, 255, 255, 0.7);
  --glass-border-light: rgba(0, 0, 0, 0.06);
  
  /* Dark Mode Palette */
  --bg-dark: #060816;
  --text-dark: #F8FAFC;
  --text-muted-dark: #9CA3AF;
  --glass-bg-dark: rgba(11, 16, 32, 0.6);
  --glass-border-dark: rgba(255, 255, 255, 0.08);

  /* Primary Colors */
  --primary: #5e6ad2;
  --primary-hover: #7b86e8;
  --secondary: #8B5CFF;
  --danger: #ef4444;
  --success: #10b981;
  
  /* Shadows */
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.1);
  
  /* Set Default to Dark Mode (Atau mengikuti data-theme) */
  --bg: var(--bg-dark);
  --text: var(--text-dark);
  --text-muted: var(--text-muted-dark);
  --glass-bg: var(--glass-bg-dark);
  --glass-border: var(--glass-border-dark);
  
  /* Admin Panel Variables */
  --admin-bg: #0B0E14;
  --admin-surface: rgba(20, 24, 34, 0.7);
  --admin-border: rgba(255, 255, 255, 0.05);
  --admin-accent: #6366f1;
}

[data-theme="light"] {
  --bg: var(--bg-light);
  --text: var(--text-light);
  --text-muted: var(--text-muted-light);
  --glass-bg: var(--glass-bg-light);
  --glass-border: var(--glass-border-light);
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.1);
}

/* =========================================
   2. BASE & RESET
========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body {
  background-color: var(--bg); color: var(--text);
  transition: background-color 0.4s ease, color 0.4s ease;
  min-height: 100vh; display: flex; flex-direction: column;
  overflow-x: hidden; scroll-behavior: smooth;
}

/* =========================================
   3. REUSABLE COMPONENTS
========================================= */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  border-radius: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: rgba(94, 106, 210, 0.3); }

.container { max-width: 1100px; margin: 0 auto; width: 100%; padding: 20px; }

/* Buttons & Inputs */
input, textarea, select {
  width: 100%; padding: 16px 20px; border-radius: 16px;
  background: rgba(0,0,0,0.02); border: 1px solid var(--glass-border);
  color: var(--text); outline: none; transition: 0.3s; font-size: 15px; margin-bottom: 15px;
}
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select { background: rgba(255,255,255,0.02); }
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(94, 106, 210, 0.15); background: var(--glass-bg); }

.btn {
  width: 100%; padding: 16px; border-radius: 16px; border: none;
  background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white;
  font-weight: 600; cursor: pointer; position: relative; overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; justify-content: center; align-items: center; gap: 8px;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(94, 106, 210, 0.3); }
.btn:active { transform: translateY(0); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); box-shadow: none; }
.btn-danger:hover { background: var(--danger); color: white; box-shadow: 0 10px 20px rgba(239, 68, 68, 0.2); }
.btn-glass { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text); box-shadow: none; }
.btn-glass:hover { background: rgba(255,255,255,0.05); color: var(--text); box-shadow: var(--shadow-sm); }

/* Typography Gradients */
.gradient-text { background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gradient-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* =========================================
   4. ANIMATIONS & EFFECTS
========================================= */
.fade-in { animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.slide-up { opacity: 0; transform: translateY(30px); animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.stagger-1 { animation-delay: 0.1s; } .stagger-2 { animation-delay: 0.2s; } .stagger-3 { animation-delay: 0.3s; }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes slideUp { to { opacity: 1; transform: translateY(0); } }

/* Radar Searching Animation (Fitur Lama Tetap Ada) */
.radar-container { position: relative; width: 150px; height: 150px; margin: 0 auto; display: flex; justify-content: center; align-items: center; }
.radar-pulse { position: absolute; width: 100%; height: 100%; background: var(--primary); border-radius: 50%; opacity: 0; animation: pulseWave 2s infinite cubic-bezier(0.16, 1, 0.3, 1); }
.radar-pulse:nth-child(2) { animation-delay: 0.5s; }
.radar-pulse:nth-child(3) { animation-delay: 1s; }
@keyframes pulseWave { 0% { transform: scale(0.5); opacity: 0.8; } 100% { transform: scale(2); opacity: 0; } }

/* =========================================
   5. MODALS, TOASTS & OVERLAYS
========================================= */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); z-index: 9999; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: 0.4s; }
.overlay.active { opacity: 1; pointer-events: auto; }
.modal { background: var(--bg); padding: 30px; border-radius: 24px; width: 90%; max-width: 450px; transform: scale(0.95); transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1); border: 1px solid var(--glass-border); box-shadow: var(--shadow-lg); }
.overlay.active .modal { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.close-modal { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; font-size: 20px;}
.close-modal:hover { background: var(--danger); color: white; border-color: var(--danger); }
.modal-lg { max-width: 600px !important; width: 95%; max-height: 90vh; overflow-y: auto; }

.toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 10000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--surface); border: 1px solid var(--glass-border); color: var(--text); padding: 14px 24px; border-radius: 100px; font-weight: 500; font-size: 14px; box-shadow: var(--shadow-lg); animation: slideUp 0.3s forwards; display: flex; align-items: center; gap: 10px;}

/* =========================================
   6. LANDING PAGE & AUTH STYLES
========================================= */
.lp-navbar { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); width: 90%; max-width: 1000px; padding: 15px 24px; border-radius: 100px; z-index: 1000; display: flex; justify-content: space-between; align-items: center; transition: 0.4s; background: transparent; border: 1px solid transparent; }
.lp-navbar.scrolled { background: var(--glass-bg); backdrop-filter: blur(20px); border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm); }
.lp-nav-links { display: flex; gap: 30px; }
.lp-nav-links a { color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 500; transition: 0.3s; }
.lp-nav-links a:hover { color: var(--text); }

.auth-wrapper { flex-grow: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; position: relative; overflow: hidden; }
.auth-wrapper .container { position: relative; z-index: 10; width: 100%; max-width: 420px; margin: 0 auto; }

.hero { position: relative; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; overflow: hidden; }
.hero-title { font-size: clamp(40px, 8vw, 84px); font-weight: 800; letter-spacing: -2px; line-height: 1.1; margin-bottom: 24px; z-index: 10; }
.hero-subtitle { font-size: clamp(16px, 2vw, 20px); color: var(--text-muted); max-width: 600px; margin-bottom: 40px; line-height: 1.6; z-index: 10; }
.hero-bg-blob { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.3; z-index: 0; animation: blobFloat 10s infinite alternate; }
.hero-blob-1 { top: 20%; left: 20%; width: 400px; height: 400px; background: var(--primary); }
.hero-blob-2 { bottom: 20%; right: 20%; width: 400px; height: 400px; background: var(--secondary); animation-delay: -5s; }
@keyframes blobFloat { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(50px, 50px) scale(1.1); } }

.features { padding: 100px 20px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; margin-top: 50px; }
.feature-card { padding: 40px 30px; text-align: left; }
.feature-icon { width: 50px; height: 50px; border-radius: 16px; background: linear-gradient(135deg, rgba(91,95,251,0.2), rgba(139,92,255,0.2)); display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 20px; color: var(--primary); }

.chat-preview-section { padding: 100px 20px; display: flex; justify-content: center; }
.chat-mockup { width: 100%; max-width: 400px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 30px; padding: 20px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.mockup-bubble { padding: 14px 18px; border-radius: 20px; font-size: 14px; margin-bottom: 12px; width: fit-content; max-width: 80%; }
.mockup-bubble.left { background: rgba(128,128,128,0.1); border: 1px solid var(--glass-border); border-bottom-left-radius: 4px; }
.mockup-bubble.right { background: var(--primary); color: white; margin-left: auto; border-bottom-right-radius: 4px; }

/* =========================================
   7. DASHBOARD USER & CHAT ROOM
========================================= */
.dash-navbar { display: flex; justify-content: space-between; align-items: center; padding: 20px; margin-bottom: 30px; }
.dash-user-nav { display: flex; align-items: center; gap: 15px; }
.theme-toggle { background: var(--glass-bg); border: 1px solid var(--glass-border); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.3s; color: var(--text); }
.theme-toggle:hover { background: rgba(255,255,255,0.05); }

.welcome-banner { position: relative; padding: 40px; border-radius: 30px; background: linear-gradient(135deg, rgba(91,95,251,0.1), rgba(139,92,255,0.05)); border: 1px solid var(--glass-border); overflow: hidden; margin-bottom: 30px; display: flex; justify-content: space-between; align-items: center; }
.welcome-blob { position: absolute; right: -50px; top: -50px; width: 200px; height: 200px; background: var(--primary); filter: blur(60px); opacity: 0.3; border-radius: 50%; pointer-events: none; }

.dash-grid-main { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; }
.action-card { padding: 50px 40px; text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; border-radius: 32px; }
.action-card::before { content: ''; position: absolute; inset: 0; border-radius: 32px; padding: 2px; background: linear-gradient(135deg, var(--primary), transparent, var(--secondary)); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0.5; transition: 0.5s; }
.action-card:hover::before { opacity: 1; }
.pulse-circle { width: 80px; height: 80px; background: rgba(91,95,251,0.1); border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 32px; margin-bottom: 24px; position: relative; }
.pulse-circle::after { content:''; position:absolute; inset:-10px; border-radius:50%; border:1px solid var(--primary); opacity:0; animation:ping 2s infinite cubic-bezier(0, 0, 0.2, 1); }

.mini-profile { padding: 30px; text-align: center; border-radius: 32px; }
.mini-avatar { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; margin-bottom: 15px; border: 3px solid var(--glass-bg); box-shadow: 0 0 0 2px var(--primary); }
.status-dot { display: inline-block; width: 8px; height: 8px; background: var(--success); border-radius: 50%; box-shadow: 0 0 8px var(--success); margin-right: 6px; }

.profile-edit-wrap { width: 100px; height: 100px; border-radius: 50%; margin: 0 auto 25px; position: relative; cursor: pointer; overflow: hidden; border: 2px solid var(--primary); }
.profile-edit-wrap img { width: 100%; height: 100%; object-fit: cover; }
.profile-edit-wrap .cam-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; color: white; opacity: 0; transition: 0.3s; }
.profile-edit-wrap:hover .cam-overlay { opacity: 1; }

/* Fitur Lama Chat Bubbles (Tetap Ada) */
.chat-container { display: flex; flex-direction: column; gap: 12px; padding: 20px 0; overflow-y: auto; }
.bubble { max-width: 75%; padding: 14px 18px; border-radius: 20px; font-size: 14px; line-height: 1.5; box-shadow: var(--shadow-sm); animation: slideUp 0.3s ease; }
.bubble.sender { background: var(--primary); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.receiver { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }

/* =========================================
   8. ADMIN PANEL PREMIUM V4.0 (FIXED)
========================================= */
body:has(.admin-layout) { background-color: var(--admin-bg); }

.admin-layout { display: flex; height: 100vh; width: 100%; overflow: hidden; background: var(--admin-bg); color: var(--text); }
.admin-sidebar { width: 260px; background: var(--admin-surface); backdrop-filter: blur(20px); border-right: 1px solid var(--admin-border); display: flex; flex-direction: column; transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 100; }
.admin-sidebar-header { padding: 24px; border-bottom: 1px solid var(--admin-border); }
.admin-menu { flex: 1; overflow-y: auto; padding: 15px 10px; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.admin-menu li a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text-muted); text-decoration: none; border-radius: 12px; transition: all 0.2s; font-size: 14px; font-weight: 500; }
.admin-menu li a:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.admin-menu li a.active { background: var(--admin-accent); color: white; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3); }

.admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.admin-topbar { height: 70px; background: rgba(11, 14, 20, 0.8); backdrop-filter: blur(20px); border-bottom: 1px solid var(--admin-border); display: flex; align-items: center; justify-content: space-between; padding: 0 30px; z-index: 90; position: sticky; top: 0; }
.topbar-search { background: var(--admin-surface); border: 1px solid var(--admin-border); padding: 8px 16px; border-radius: 20px; color: white; outline: none; width: 250px; transition: 0.3s; margin-bottom: 0; }
.topbar-search:focus { border-color: var(--admin-accent); width: 300px; }
.notif-btn { position: relative; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.notif-badge { position: absolute; top: -5px; right: -5px; background: var(--danger); color: white; font-size: 10px; font-weight: bold; padding: 2px 6px; border-radius: 10px; animation: pulseWave 2s infinite; }

.admin-content { flex: 1; overflow-y: auto; padding: 30px; }
.admin-view { display: none; animation: fadeIn 0.4s ease; }
.admin-view.active { display: block; }

.dash-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card-premium { background: linear-gradient(145deg, var(--admin-surface), rgba(255,255,255,0.02)); border: 1px solid var(--admin-border); padding: 24px; border-radius: 20px; position: relative; overflow: hidden; transition: 0.3s; }
.stat-card-premium:hover { transform: translateY(-5px); border-color: var(--admin-accent); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.stat-card-premium h3 { font-size: 36px; margin: 10px 0 5px; background: linear-gradient(to right, #fff, #a1a1aa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card-premium p { color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.stat-icon { position: absolute; right: -10px; bottom: -10px; font-size: 80px; opacity: 0.05; transform: rotate(-15deg); }

/* Table Premium (FIXED MOBILE SCROLL) */
.table-wrapper { background: var(--admin-surface); border: 1px solid var(--admin-border); border-radius: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admin-table { width: 100%; border-collapse: collapse; text-align: left; min-width: 800px; }
.admin-table th, .admin-table td { white-space: nowrap; }
.admin-table th { padding: 16px 24px; background: rgba(0,0,0,0.2); color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; border-bottom: 1px solid var(--admin-border); }
.admin-table td { padding: 16px 24px; border-bottom: 1px solid var(--admin-border); font-size: 14px; vertical-align: middle; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }

.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.status-active { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }
.status-banned { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.status-pending { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.2); }

/* Room Viewer Messenger Style */
.room-viewer-container { display: flex; height: 70vh; background: var(--bg); border-radius: 20px; border: 1px solid var(--admin-border); overflow: hidden; }
.room-info-sidebar { width: 280px; background: var(--admin-surface); border-right: 1px solid var(--admin-border); padding: 20px; overflow-y: auto; }
.room-chat-area { flex: 1; display: flex; flex-direction: column; background: #000; position: relative; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.msg-bubble { max-width: 70%; padding: 12px 16px; border-radius: 16px; position: relative; font-size: 14px; line-height: 1.5; }
.msg-bubble.left { align-self: flex-start; background: var(--admin-surface); border: 1px solid var(--admin-border); border-bottom-left-radius: 4px; }
.msg-bubble.right { align-self: flex-end; background: var(--admin-accent); color: white; border-bottom-right-radius: 4px; }
.msg-meta { font-size: 11px; opacity: 0.7; margin-bottom: 4px; font-weight: 600; display: block; }
.del-msg-btn { position: absolute; top: 50%; transform: translateY(-50%); background: var(--danger); color: white; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; opacity: 0; transition: 0.2s; display: flex; align-items: center; justify-content: center; font-size: 12px;}
.msg-bubble:hover .del-msg-btn { opacity: 1; }
.msg-bubble.left .del-msg-btn { right: -35px; }
.msg-bubble.right .del-msg-btn { left: -35px; }

/* Media Center Grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.media-card { background: var(--admin-surface); border: 1px solid var(--admin-border); border-radius: 16px; overflow: hidden; position: relative; }
.media-card img { width: 100%; height: 160px; object-fit: cover; }
.media-card audio { width: 100%; padding: 10px; height: 50px; background: rgba(0,0,0,0.5); outline: none; }
.media-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 5px; opacity: 0; transition: 0.2s; }
.media-card:hover .media-actions { opacity: 1; }

/* =========================================
   9. MOBILE RESPONSIVE QUERIES
========================================= */
@media (max-width: 768px) {
  .lp-nav-links { display: none; }
  .dash-grid-main { grid-template-columns: 1fr; }
  .welcome-banner { flex-direction: column; text-align: center; gap: 20px; padding: 30px 20px; }
  .action-card { padding: 40px 20px; }
  .hero-title { font-size: 40px; }
  
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--admin-border); position: sticky; top:0; }
  .admin-menu { flex-direction: row; overflow-x: auto; padding: 10px; }
  .admin-menu li a { white-space: nowrap; padding: 8px 12px; }
  .admin-topbar { padding: 0 15px; }
  .topbar-search { width: 150px; }
  .room-viewer-container { flex-direction: column; }
  .room-info-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--admin-border); height: 150px; }
}