/* SocialSim Pro - Main Styles */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --secondary: #10b981;
  --secondary-dark: #059669;
  --dark: #0f172a;
  --dark2: #1e293b;
  --dark3: #334155;
  --gray: #64748b;
  --light: #f8fafc;
  --border: #e2e8f0;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* Dark mode */
body.dark { background: #0f172a; color: #e2e8f0; }
body.dark .bg-white { background: #1e293b !important; }
body.dark .bg-gray-50 { background: #0f172a !important; }
body.dark .bg-gray-100 { background: #1e293b !important; }
body.dark .bg-gray-200 { background: #334155 !important; }
body.dark .border-gray-200 { border-color: #334155 !important; }
body.dark .border-gray-300 { border-color: #475569 !important; }
body.dark .text-gray-600 { color: #94a3b8 !important; }
body.dark .text-gray-700 { color: #cbd5e1 !important; }
body.dark .text-gray-800 { color: #e2e8f0 !important; }
body.dark .text-gray-900 { color: #f1f5f9 !important; }
body.dark input, body.dark textarea, body.dark select { background: #334155; color: #e2e8f0; border-color: #475569; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Sidebar */
#sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

#sidebar .logo-area {
  padding: 24px 20px 20px;
  border-bottom: 1px solid #334155;
}

#sidebar .logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

#sidebar .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}

#sidebar nav { flex: 1; padding: 12px 0; }

#sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  border-radius: 0;
  cursor: pointer;
}

#sidebar nav a:hover, #sidebar nav a.active {
  color: #fff;
  background: rgba(37, 99, 235, 0.2);
}

#sidebar nav a.active { border-right: 3px solid var(--primary); }
#sidebar nav a i { width: 18px; text-align: center; font-size: 0.95rem; }

.sidebar-section-label {
  padding: 8px 20px 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}

#sidebar .user-area {
  padding: 16px 20px;
  border-top: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

/* Main content */
#main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

/* Top bar */
.topbar {
  height: 64px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

body.dark .topbar { background: #1e293b; border-color: #334155; }

.topbar-title { font-size: 1.125rem; font-weight: 600; flex: 1; }

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 20px;
  transition: all 0.2s;
}
body.dark .card { background: #1e293b; border-color: #334155; }

.card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
body.dark .card:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.4); }

.stat-card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
body.dark .stat-card { background: #1e293b; border-color: #334155; }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--secondary); color: white; }
.btn-success:hover { background: var(--secondary-dark); }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: white; }
.btn-warning:hover { background: #d97706; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: inherit; }
.btn-outline:hover { background: var(--light); }
body.dark .btn-outline:hover { background: #334155; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-xl { padding: 16px 32px; font-size: 1.125rem; font-weight: 600; }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-green { background: #dcfce7; color: #16a34a; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-yellow { background: #fef3c7; color: #d97706; }
.badge-gray { background: #f1f5f9; color: #64748b; }
body.dark .badge-green { background: rgba(22,163,74,0.2); color: #4ade80; }
body.dark .badge-blue { background: rgba(29,78,216,0.2); color: #60a5fa; }
body.dark .badge-gray { background: #334155; color: #94a3b8; }

/* Chat UI */
.chat-container {
  display: flex;
  height: calc(100vh - 64px);
  overflow: hidden;
}

.chat-sidebar {
  width: 320px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

body.dark .chat-sidebar { border-color: #334155; }

.chat-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: white;
}

body.dark .chat-sidebar-header { background: #1e293b; border-color: #334155; }

.chat-list { overflow-y: auto; flex: 1; }

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(226,232,240,0.5);
}

.chat-item:hover, .chat-item.active { background: rgba(37,99,235,0.05); }
body.dark .chat-item.active { background: rgba(37,99,235,0.15); }

.chat-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  position: relative;
}

.chat-avatar .status-dot {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid white;
}

.status-online { background: var(--secondary); }
.status-busy { background: #ef4444; }
.status-offline { background: #94a3b8; }

.chat-info { flex: 1; min-width: 0; }
.chat-name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-preview { font-size: 0.75rem; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-meta { text-align: right; flex-shrink: 0; }
.chat-time { font-size: 0.7rem; color: var(--gray); }
.unread-badge {
  background: var(--secondary);
  color: white;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 4px;
  margin-left: auto;
  padding: 0 5px;
}

/* Chat main area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f1f5f9;
}

body.dark .chat-main { background: #0f172a; }

.chat-header {
  padding: 12px 20px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

body.dark .chat-header { background: #1e293b; border-color: #334155; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message {
  max-width: 65%;
  display: flex;
  flex-direction: column;
}

.message.me { align-self: flex-end; align-items: flex-end; }
.message.contact { align-self: flex-start; align-items: flex-start; }

.message-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  position: relative;
}

.message.me .message-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.contact .message-bubble {
  background: white;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

body.dark .message.contact .message-bubble { background: #1e293b; color: #e2e8f0; }

.message-time {
  font-size: 0.65rem;
  color: var(--gray);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Audio player */
.audio-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: white;
  border-radius: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  min-width: 220px;
}

body.dark .audio-player { background: #334155; }

.audio-play-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.audio-play-btn:hover { background: var(--primary-dark); }

.audio-progress-container { flex: 1; }
.audio-waveform {
  height: 24px;
  position: relative;
  cursor: pointer;
}

.audio-progress-bar {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  margin-top: 10px;
}

.audio-progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.audio-time { font-size: 0.7rem; color: var(--gray); white-space: nowrap; }

/* Chat input */
.chat-input-area {
  padding: 12px 20px;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

body.dark .chat-input-area { background: #1e293b; border-color: #334155; }

.chat-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 24px;
  border: 1px solid var(--border);
  outline: none;
  font-size: 0.875rem;
  background: #f8fafc;
}

body.dark .chat-input { background: #334155; border-color: #475569; color: #e2e8f0; }
.chat-input:focus { border-color: var(--primary); }

/* Premium lock */
.premium-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.premium-lock-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  color: white;
  margin-bottom: 20px;
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}

body.dark .modal { background: #1e293b; }

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

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

.modal-title { font-size: 1.125rem; font-weight: 700; }

/* Form elements */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; color: var(--gray); text-transform: uppercase; letter-spacing: 0.05em; }
.form-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
  background: white;
}
body.dark .form-input { background: #334155; border-color: #475569; color: #e2e8f0; }
.form-input:focus { border-color: var(--primary); }
.form-select { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 0.875rem; outline: none; background: white; }
body.dark .form-select { background: #334155; border-color: #475569; color: #e2e8f0; }
.form-textarea { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 0.875rem; outline: none; resize: vertical; min-height: 80px; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.875rem;
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.3s ease;
  max-width: 360px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.toast.success { background: #059669; }
.toast.error { background: #dc2626; }
.toast.warning { background: #d97706; }
.toast.info { background: var(--primary); }

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

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 16px; text-align: left; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray); border-bottom: 1px solid var(--border); background: #f8fafc; }
body.dark .data-table th { background: #334155; border-color: #475569; }
.data-table td { padding: 12px 16px; font-size: 0.875rem; border-bottom: 1px solid var(--border); }
body.dark .data-table td { border-color: #334155; }
.data-table tr:hover td { background: rgba(37,99,235,0.03); }
body.dark .data-table tr:hover td { background: rgba(37,99,235,0.1); }

/* Login page */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(37,99,235,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(16,185,129,0.1) 0%, transparent 60%);
}

.login-card {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

.login-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 16px;
}

.login-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: white;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.login-input::placeholder { color: rgba(255,255,255,0.4); }
.login-input:focus { border-color: rgba(37,99,235,0.6); background: rgba(255,255,255,0.12); }

/* Responsive */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: inherit;
  font-size: 1.25rem;
}

#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
  .hamburger { display: flex; }
  #sidebar-overlay.visible { display: block; }
  .chat-sidebar { width: 100%; }
  .chat-main { display: none; }
  .chat-main.active { display: flex; }
  .chat-container { position: relative; }
  .stat-card { padding: 16px; }
}

/* Image viewer */
.img-viewer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}

.img-viewer-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  object-fit: contain;
}

/* Premium page */
.premium-hero {
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  color: white;
  padding: 60px 40px;
  text-align: center;
  border-radius: 16px;
  margin-bottom: 32px;
}

/* Animations */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.slide-in { animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Loading spinner */
.spinner {
  border: 3px solid rgba(37,99,235,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Platform icons */
.platform-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: white;
  flex-shrink: 0;
}

.platform-whatsapp { background: #25d366; }
.platform-telegram { background: #0088cc; }
.platform-teams { background: #5558af; }
.platform-instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.platform-discord { background: #5865f2; }
.platform-twitter { background: #000; }
.platform-signal { background: #3a76f0; }
.platform-messenger { background: linear-gradient(45deg, #0084ff, #cc00ff); }

/* Status indicator */
.status-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center; color: var(--gray);
}

.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }

/* Section headers */
.section-header {
  display: flex; align-items: center; justify-content: between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

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

/* Overflow tables */
.table-container { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
body.dark .table-container { border-color: #334155; }

/* Credencial masked */
.credential-masked {
  font-family: monospace;
  letter-spacing: 0.1em;
  color: var(--gray);
}

/* Image card */
.image-card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}
body.dark .image-card { background: #1e293b; border-color: #334155; }

.image-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.3s;
}

.image-card img:hover { transform: scale(1.03); }

/* Social cards */
.social-card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
body.dark .social-card { background: #1e293b; border-color: #334155; }
.social-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.social-card.locked { opacity: 0.85; }

/* Plan badge */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.plan-free { background: #f1f5f9; color: #64748b; }
.plan-premium { background: linear-gradient(135deg, #f59e0b, #ef4444); color: white; }
.plan-admin { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white; }

/* Search input */
.search-input {
  padding: 8px 14px 8px 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.875rem;
  outline: none;
  background: white;
  width: 240px;
}
body.dark .search-input { background: #334155; border-color: #475569; color: #e2e8f0; }
.search-input:focus { border-color: var(--primary); }

.search-wrapper { position: relative; }
.search-wrapper i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray); font-size: 0.85rem; }

/* Tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  margin-bottom: 4px;
}
[data-tooltip]:hover::after { opacity: 1; }
