/* ===== PamojaMeet Design System ===== */
:root {
  /* Core palette */
  --primary: #6C63FF;
  --primary-light: #8B85FF;
  --primary-dark: #4A42DB;
  --secondary: #00D4AA;
  --secondary-light: #33E0BF;
  --accent: #FF6B6B;
  --accent-light: #FF8E8E;
  --warning: #FFB84D;
  --info: #4FC3F7;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6C63FF, #00D4AA);
  --gradient-accent: linear-gradient(135deg, #6C63FF, #FF6B6B);
  --gradient-warm: linear-gradient(135deg, #FF6B6B, #FFB84D);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 50%;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
  --shadow-glow: 0 0 20px rgba(108,99,255,0.3);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index layers */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
}

/* ===== Dark Theme (default) ===== */
:root,
[data-theme="dark"] {
  --bg-base: #0D0D1A;
  --bg-surface: #14142B;
  --bg-elevated: #1C1C3A;
  --bg-card: #23234A;
  --bg-hover: #2C2C58;
  --bg-input: rgba(255,255,255,0.06);
  --bg-glass: rgba(255,255,255,0.04);

  --text-primary: #F0F0FF;
  --text-secondary: rgba(240,240,255,0.65);
  --text-tertiary: rgba(240,240,255,0.4);
  --text-inverse: #0D0D1A;

  --border-color: rgba(255,255,255,0.08);
  --border-light: rgba(255,255,255,0.04);

  --nav-bg: rgba(13,13,26,0.95);
  --nav-border: rgba(255,255,255,0.06);

  --scrollbar-thumb: rgba(255,255,255,0.15);
  --scrollbar-track: transparent;

  --skeleton-base: rgba(255,255,255,0.05);
  --skeleton-highlight: rgba(255,255,255,0.08);
}

/* ===== Light Theme ===== */
[data-theme="light"] {
  --bg-base: #F5F6FF;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F0F1FF;
  --bg-card: #FFFFFF;
  --bg-hover: #EBECFF;
  --bg-input: rgba(0,0,0,0.04);
  --bg-glass: rgba(255,255,255,0.6);

  --text-primary: #1A1A2E;
  --text-secondary: rgba(26,26,46,0.6);
  --text-tertiary: rgba(26,26,46,0.35);
  --text-inverse: #FFFFFF;

  --border-color: rgba(0,0,0,0.08);
  --border-light: rgba(0,0,0,0.04);

  --nav-bg: rgba(255,255,255,0.95);
  --nav-border: rgba(0,0,0,0.06);

  --scrollbar-thumb: rgba(0,0,0,0.15);
  --scrollbar-track: transparent;

  --skeleton-base: rgba(0,0,0,0.05);
  --skeleton-highlight: rgba(0,0,0,0.08);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.12);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-family);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background var(--transition-base), color var(--transition-base);
  min-height: 100vh;
  min-height: 100dvh;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* ===== App Shell ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Desktop Sidebar */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
  transition: transform var(--transition-base), background var(--transition-base);
}

.sidebar-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: var(--text-lg);
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-3);
  overflow-y: auto;
}

.nav-section {
  padding: var(--space-4) var(--space-3) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(108,99,255,0.12);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: var(--space-3);
  border-top: 1px solid var(--border-color);
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  transition: margin var(--transition-base);
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar-title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.topbar-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.app-content {
  flex: 1;
  padding: var(--space-6);
  overflow-y: auto;
}

/* ===== Mobile Bottom Nav ===== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--nav-border);
  z-index: var(--z-sticky);
  padding: var(--space-1) 0 env(safe-area-inset-bottom, 0);
  transition: transform var(--transition-base);
}

.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 var(--space-2);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 500;
  transition: color var(--transition-fast);
  min-width: 56px;
}

.mobile-nav-item .m-icon {
  font-size: 22px;
  line-height: 1;
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item.active .m-icon {
  filter: drop-shadow(0 0 8px rgba(108,99,255,0.4));
}

/* Mobile Hamburger */
.mobile-hamburger {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text-primary);
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: calc(var(--z-sticky) - 1);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ===== Responsive Breakpoints ===== */
@media (max-width: 1024px) {
  .app-sidebar { width: 220px; }
  .app-main { margin-left: 220px; }
  .app-content { padding: var(--space-4); }
}

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  .app-sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .mobile-bottom-nav { display: block; }
  .mobile-hamburger { display: flex; }
  .sidebar-overlay { display: block; }
  .app-content {
    padding: var(--space-4);
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0));
  }
  .app-topbar {
    padding: var(--space-3) var(--space-4);
  }
  .topbar-subtitle { display: none; }
}

/* ===== Component Styles ===== */

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: rgba(108,99,255,0.2);
  box-shadow: var(--shadow-md);
}

.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.card-gradient {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(108,99,255,0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108,99,255,0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--accent);
  color: #fff;
}

.btn-danger:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: 18px;
}

.btn-round {
  border-radius: var(--radius-xl);
}

/* Form Inputs */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.input-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.input-field {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--text-base);
  outline: none;
  transition: all var(--transition-fast);
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.15);
}

.input-field::placeholder {
  color: var(--text-tertiary);
}

textarea.input-field {
  resize: vertical;
  min-height: 80px;
}

select.input-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b3b3b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.5;
}

.badge-primary {
  background: rgba(108,99,255,0.15);
  color: var(--primary);
}

.badge-success {
  background: rgba(0,212,170,0.15);
  color: var(--secondary);
}

.badge-warning {
  background: rgba(255,184,77,0.15);
  color: var(--warning);
}

.badge-danger {
  background: rgba(255,107,107,0.15);
  color: var(--accent);
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.avatar-xl { width: 72px; height: 72px; font-size: 28px; }

/* Grid Utility */
.grid { display: grid; gap: var(--space-4); }
.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: 1fr 1fr; }
.grid-cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* Flex Utility */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Spacing */
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

/* Text */
.text-center { text-align: center; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* Skeleton Loading */
.skeleton {
  background: var(--skeleton-base);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--skeleton-highlight), transparent);
  animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fade-in { animation: fadeIn 0.4s ease both; }
.animate-slide-up { animation: slideUp 0.5s ease both; }
.animate-scale-in { animation: scaleIn 0.3s ease both; }
.animate-pulse { animation: pulse 2s ease infinite; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  animation: slideUp 0.3s ease, fadeIn 0.3s ease;
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--secondary); }
.toast.error { border-left: 3px solid var(--accent); }
.toast.info { border-left: 3px solid var(--info); }

/* Responsive Grid */
@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: 1fr 1fr; }
  .grid-cols-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    grid-template-columns: 1fr;
  }
  .app-content { padding: var(--space-3); }
  .card { padding: var(--space-4); }
  .btn-lg { padding: var(--space-3) var(--space-5); }
}

/* Utility: hide on mobile/desktop */
.hide-mobile { display: revert; }
.hide-desktop { display: none; }

@media (max-width: 768px) {
  .hide-mobile { display: none; }
  .hide-desktop { display: revert; }
}
