/* Admin Dashboard — Layout */
/* ============================================================
   MUNDLE BDE ADMIN DASHBOARD — Complete CSS
   Dark theme · Glassmorphism · Modern UI
   ============================================================ */

/* ----------------------------------------------------------
   0. DESIGN TOKENS
   ---------------------------------------------------------- */
:root {
  /* Background */
  --bg-primary: #0a0a0a;
  --bg-elevated: #141414;
  --bg-card: #1a1a1a;
  --bg-light: #222222;

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-tertiary: #666666;
  --text-disabled: #444444;

  /* Borders */
  --border-color: #2a2a2a;
  --border-light: #333333;

  /* Brand */
  --primary-color: #C30E6E;
  --primary-hover: #A50C5D;
  --primary-alpha-10: rgba(195, 14, 110, 0.1);
  --primary-alpha-15: rgba(195, 14, 110, 0.15);

  /* Status */
  --success: #10B981;
  --error: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-xxl: 24px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-xxl: 24px;
  --space-xxxl: 32px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 12px 36px rgba(0, 0, 0, 0.5);
}

/* ----------------------------------------------------------
   RESET & BASE
   ---------------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ----------------------------------------------------------
   SCROLLBAR STYLING
   ---------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 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.18);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* ----------------------------------------------------------
   ANIMATIONS (keyframes)
   ---------------------------------------------------------- */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  0% {
    opacity: 0;
    transform: translateX(100%);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateX(100%);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ----------------------------------------------------------
   1. LOADING & LAYOUT
   ---------------------------------------------------------- */
#admin-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  transition: opacity var(--transition-slow);
}

#admin-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

#admin-loading::after {
  content: '';
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.bde-dashboard-layout {
  display: flex;
  min-height: 100vh;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.bde-dashboard-layout.visible {
  opacity: 1;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--transition-normal);
  pointer-events: none;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: all;
}

/* ----------------------------------------------------------
   2. SIDEBAR
   ---------------------------------------------------------- */
.admin-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 270px;
  height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xxl);
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: cover;
}

.sidebar-header-text h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.sidebar-header-text span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg) var(--space-md);
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: var(--space-lg) var(--space-md) var(--space-sm);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
  margin-bottom: 2px;
}

.sidebar-link i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: var(--primary-alpha-10);
  color: var(--primary-color);
  font-weight: 600;
}

.sidebar-link .badge {
  margin-left: auto;
  background: var(--primary-color);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
  line-height: 1.4;
}

.sidebar-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-user img,
.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-alpha-15);
  color: var(--primary-color);
  font-weight: 700;
  font-size: 0.85rem;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-info strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-info span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: var(--space-lg);
  left: var(--space-lg);
  z-index: 101;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-primary);
}

/* ----------------------------------------------------------
   3. DASHBOARD HEADER
   ---------------------------------------------------------- */
.dashboard-main {
  flex: 1;
  margin-left: 270px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.dashboard-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-xl) var(--space-xxxl);
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.dashboard-header-left h1 {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
}

.dashboard-header-left p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.dashboard-content {
  flex: 1;
  padding: var(--space-xxxl);
}

/* ----------------------------------------------------------
   4. TAB CONTENT
   ---------------------------------------------------------- */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

/* ----------------------------------------------------------
   5. OVERVIEW TAB (code card, usage grid, actions)
   ---------------------------------------------------------- */
.code-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xxl);
  margin-bottom: var(--space-xxl);
}

.code-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.code-card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.code-display {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-lg) var(--space-xl);
}

.code-display .code-text {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--primary-color);
  flex: 1;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xxl);
}

.usage-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.usage-item-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.usage-item-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-card:hover {
  background: var(--bg-light);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.action-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-alpha-10);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.action-card-content h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.action-card-content p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   6. ADMIN TAB HEADER
   ---------------------------------------------------------- */
.admin-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-xxl);
  flex-wrap: wrap;
}

.admin-tab-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.admin-tab-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* ----------------------------------------------------------
   7. BUTTONS (primary, secondary, danger, outlined, icon, loading)
   ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  line-height: 1.4;
  position: relative;
}

.btn i {
  font-size: 1rem;
}

/* Primary */
.btn-primary {
  background: var(--primary-color);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(233, 30, 99, 0.35);
}

/* Secondary */
.btn-secondary {
  background: var(--bg-light);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-light);
}

/* Danger */
.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Outlined */
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-light);
}

/* Icon-only */
.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-light);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--border-light);
}

/* Sizes */
.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-lg) var(--space-xxl);
  font-size: 0.95rem;
  border-radius: var(--radius-lg);
}

/* Loading state */
.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: var(--space-sm);
}

/* Full width */
.btn-block {
  width: 100%;
}

