/* -----------------------------
   VARIABLES & DESIGN TOKENS
----------------------------- */
:root {
  /* Colors */
  --bg-dark: #0f1115;
  --bg-darker: #090a0c;
  --bg-panel: rgba(25, 27, 34, 0.6);
  --panel-border: rgba(255, 255, 255, 0.08);
  
  --primary: #7c3aed; /* Vibrant purple */
  --primary-glow: rgba(124, 58, 237, 0.4);
  --primary-hover: #6d28d9;
  
  --secondary: #0ea5e9; /* Vibrant Blue */
  --accent: #10b981;   /* Emerald */
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h: 70px;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;

  /* Typography */
  --font-family: 'Inter', sans-serif;
  
  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* -----------------------------
   RESET & BASE
----------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: auto;
}

a { text-decoration: none; color: inherit; }
li { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; border: none; outline: none; }

/* -----------------------------
   LAYOUT
----------------------------- */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  background-color: var(--bg-darker);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 200;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Add a subtle background glow effect */
.main-content::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  filter: blur(80px);
  z-index: -1;
  opacity: 0.5;
  pointer-events: none;
}

/* -----------------------------
   SIDEBAR
----------------------------- */
.brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.logo-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 6px;
  margin-right: 12px;
  box-shadow: 0 0 10px var(--primary-glow);
}

.nav-links {
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-links li a {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-links li a i {
  font-size: 1.25rem;
  margin-right: 12px;
  transition: var(--transition);
}

.nav-links li:hover a {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.nav-links li.active a {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.15), transparent);
  color: var(--primary);
  border-left: 3px solid var(--primary);
}

.nav-links li.active a i {
  color: var(--primary);
}

.badge {
  background-color: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 20px;
  margin-left: auto;
}

/* -----------------------------
   TOPBAR
----------------------------- */
.topbar {
  height: var(--topbar-h);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(15, 17, 21, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 5;
}

.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--bg-darker);
  border: 1px solid var(--panel-border);
  border-radius: 30px;
  padding: 8px 16px;
  width: 320px;
  transition: var(--transition);
}

.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.search-bar i {
  color: var(--text-muted);
  margin-right: 8px;
}

.search-bar input {
  background: transparent;
  color: var(--text-main);
  width: 100%;
  font-size: 0.9rem;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 20px;
}

.icon-btn {
  color: var(--text-muted);
  font-size: 1.25rem;
  position: relative;
  transition: var(--transition);
}

.icon-btn:hover {
  color: var(--text-main);
}

.icon-btn .dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background-color: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-dark);
}

.avatar-container {
  position: relative;
  cursor: pointer;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--panel-border);
}

.status-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-dark);
}
.status-indicator.online { background-color: var(--success); }

/* -----------------------------
   VIEWS CONTAINER & COMMON
----------------------------- */
.views-container {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
}

/* Sidebar overlay (mobile) */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 150;
  backdrop-filter: blur(4px);
}

/* Mobile hamburger button */
#btn-menu {
  display: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  padding: 4px;
  transition: var(--transition);
}
#btn-menu:hover { color: var(--text-main); }

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
}

.view-header h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.view-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.p-xl {
  padding: 40px;
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--primary-glow);
}

/* Utilities */
.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* -----------------------------
   MODALS
----------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  background: rgba(15, 17, 21, 0.95);
  border-radius: var(--radius-lg);
  padding: 0; /* Padding inside elements */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* -----------------------------
   SCROLLBAR
----------------------------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ─────────────────────────────── 
   RESPONSIVE — TABLET (≤ 1024px)
   ──────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 200px; }

  .topbar { padding: 0 20px; }

  .search-bar { width: 220px; }

  .views-container { padding: 28px; }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  /* Profile grid: 2 col → 1 col */
  #mi-perfil > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ─────────────────────────────── 
   RESPONSIVE — MOBILE (≤ 768px)
   ──────────────────────────────── */
@media (max-width: 768px) {

  /* ── Layout ── */
  #btn-menu { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 280px;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-open #sidebar-overlay {
    display: block;
  }

  .main-content {
    width: 100%;
    min-width: 0;
  }

  /* ── Topbar ── */
  .topbar {
    padding: 0 16px;
    gap: 12px;
  }

  .search-bar {
    display: none;
  }

  .user-info-block {
    display: none;
  }

  /* ── Content ── */
  .views-container { padding: 16px; }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
  }

  .view-header h2 { font-size: 1.35rem; }

  .actions-group {
    flex-wrap: wrap;
    width: 100%;
  }

  .actions-group .btn {
    flex: 1;
    justify-content: center;
    min-width: 120px;
  }

  /* ── Modals ── */
  .modal-content {
    max-width: 100%;
    margin: 0 12px;
    border-radius: 16px;
  }

  .modal-body { padding: 16px; }
  .modal-header { padding: 16px 20px; }
  .modal-footer { padding: 12px 16px; }

  /* Profile page */
  #mi-perfil > div[style*="grid-template-columns"],
  #mi-perfil > div > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Subscription panel */
  #sub-panel { padding: 24px 16px !important; }
}

/* ─────────────────────────────── 
   RESPONSIVE — SMALL (≤ 480px)
   ──────────────────────────────── */
@media (max-width: 480px) {
  .btn { padding: 9px 14px; font-size: 0.85rem; }
  .avatar { width: 34px; height: 34px; }
  .user-profile { gap: 12px; }
}
