/* ==========================================================================
   Infinity Meet - Design System & Modern Dark-Mode Glassmorphism Styles
   ========================================================================== */

:root {
  /* Color Palette - Emerald / Jade Theme matching the new icon (Dark Default) */
  --bg-dark: #070D0B;
  --bg-surface: rgba(13, 27, 22, 0.75);
  --bg-surface-elevated: rgba(18, 38, 31, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(16, 185, 129, 0.6);
  --border-glow: rgba(5, 150, 105, 0.35);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --accent-primary: #10B981;
  --accent-primary-hover: #059669;
  --accent-gradient: linear-gradient(135deg, #10B981 0%, #059669 50%, #047857 100%);
  --accent-gradient-hover: linear-gradient(135deg, #34D399 0%, #10B981 50%, #059669 100%);

  --danger: #EF4444;
  --danger-hover: #DC2626;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --danger-border: rgba(239, 68, 68, 0.35);

  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.15);

  /* Shadows & Glass */
  --glass-blur: blur(20px);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  --shadow-ambient: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 16px 36px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);

  /* Typography */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Mode Overrides */
html[data-theme="light"],
html:not(.dark)[data-theme="light"] {
  --bg-dark: #F0FDF4;
  --bg-surface: rgba(255, 255, 255, 0.85);
  --bg-surface-elevated: rgba(240, 253, 244, 0.95);
  --border-subtle: rgba(16, 185, 129, 0.15);
  --border-focus: rgba(16, 185, 129, 0.7);
  --border-glow: rgba(16, 185, 129, 0.2);

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;

  --shadow-ambient: 0 20px 40px -12px rgba(5, 150, 105, 0.12);
  --shadow-card: 0 16px 36px rgba(5, 150, 105, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --glass-border: 1px solid rgba(16, 185, 129, 0.18);
}

html[data-theme="light"] .form-control {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(148, 163, 184, 0.4);
  color: #0F172A;
}

html[data-theme="light"] .meet-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: rgba(16, 185, 129, 0.2);
}

html[data-theme="light"] .room-indicator {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
}

html[data-theme="light"] .room-name {
  color: #065F46;
}

html[data-theme="light"] .brand-title {
  color: #0F172A;
}

html[data-theme="light"] .brand-logo-icon {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.1);
}

html[data-theme="light"] .header-user-profile {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
}

html[data-theme="light"] .header-name {
  color: #0F172A;
}

html[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.98);
  color: #0F172A;
  box-shadow: 0 10px 25px rgba(5, 150, 105, 0.2);
  border-color: rgba(16, 185, 129, 0.3);
}

html[data-theme="light"] .ambient-glow {
  opacity: 0.2;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ambient Animated Glow Spots */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  transition: opacity 0.8s ease;
}

.glow-1 {
  width: 500px;
  height: 500px;
  top: -120px;
  left: -100px;
  background: radial-gradient(circle, #10b981 0%, rgba(16, 185, 129, 0) 70%);
}

.glow-2 {
  width: 650px;
  height: 650px;
  bottom: -150px;
  right: -100px;
  background: radial-gradient(circle, #059669 0%, rgba(5, 150, 105, 0) 70%);
}

.glow-3 {
  width: 350px;
  height: 350px;
  top: 40%;
  left: 60%;
  background: radial-gradient(circle, #34d399 0%, rgba(52, 211, 153, 0) 70%);
  opacity: 0.2;
}

/* App Shell */
.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* View States */
.view {
  width: 100%;
  height: 100%;
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.view.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   1. Landing / Entry View
   ========================================================================== */

.landing-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  overflow-y: auto;
}

.brand-hero {
  text-align: center;
  max-width: 520px;
  margin-bottom: 2rem;
  animation: fadeInDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #A7F3D0;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 9999px;
  margin-bottom: 1.25rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-primary);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-primary);
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.brand-logo-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: var(--glass-border);
  border-radius: 14px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.brand-logo-icon img {
  width: 38px;
  height: 38px;
  display: block;
}

.brand-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.brand-tagline {
  color: var(--text-secondary);
  font-size: 0.975rem;
  line-height: 1.6;
}

/* Glass Card */
.glass-card {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
}

.join-card {
  width: 100%;
  max-width: 460px;
  padding: 2.25rem;
  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.join-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(16, 185, 129, 0.15);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Form Styling */
.join-form {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.required-badge {
  font-size: 0.65rem;
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.btn-text-action {
  background: none;
  border: none;
  color: #6EE7B7;
  font-size: 0.775rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: color var(--transition-fast), transform var(--transition-fast);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.btn-text-action:hover {
  color: #D1FAE5;
  background: rgba(255, 255, 255, 0.05);
}

.btn-text-action svg {
  width: 14px;
  height: 14px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.form-control {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  background: rgba(10, 18, 14, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  background: rgba(14, 25, 20, 0.9);
}

.form-control:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--accent-primary);
}

.form-control::placeholder {
  color: var(--text-muted);
}

#room-name {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 0.925rem;
  font-weight: 600;
  border-radius: 12px;
  padding: 0.85rem 1.4rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-block {
  width: 100%;
}

.btn svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #FFFFFF;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.55);
  transform: translateY(-1px);
}

.btn-primary:hover svg {
  transform: translateX(3px);
}

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

.btn-danger {
  background: var(--danger-bg);
  color: #FCA5A5;
  border: 1px solid var(--danger-border);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-danger:hover {
  background: var(--danger);
  color: #FFFFFF;
  border-color: var(--danger);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

/* Feature Strip */
.feature-strip {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

/* User Profile Badge in Landing Card */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 12px;
  animation: fadeInDown 0.3s ease;
}

.user-profile-badge.hidden {
  display: none !important;
}

.user-badge-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.user-badge-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.user-badge-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-badge-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: #A7F3D0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.user-badge-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success);
}

/* Header User Profile in Meeting Shell */
.header-user-profile {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.65rem 0.3rem 0.35rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  transition: all var(--transition-fast);
}

.header-user-profile.hidden {
  display: none !important;
}

.header-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--accent-primary);
}

.header-name {
  font-size: 0.825rem;
  font-weight: 600;
  color: #F1F5F9;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.feature-icon {
  font-size: 0.9rem;
}

/* ==========================================================================
   2. Meeting View & Custom App Shell
   ========================================================================== */

.meeting-view {
  display: flex;
  flex-direction: column;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  position: fixed;
  top: 0;
  left: 0;
  background-color: #0d1117;
  z-index: 10;
  overflow: hidden;
}

.meet-header {
  height: 52px;
  min-height: 52px;
  padding: 0 1rem;
  padding-top: env(safe-area-inset-top, 0px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(13, 17, 23, 0.94);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 20;
}

.meet-header-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.header-logo-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-logo-icon svg {
  width: 24px;
  height: 24px;
}

.header-app-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.meet-header-center {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.room-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.status-live {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
}

.room-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.room-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: #E0E7FF;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-icon-copy {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  border-radius: 4px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.btn-icon-copy:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.btn-icon-copy svg {
  width: 16px;
  height: 16px;
}

.meet-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Meet Container (iFrame wrapper) */
.meet-container {
  flex: 1 1 0%;
  width: 100%;
  height: 0;
  min-height: 0;
  position: relative;
  background-color: #000000;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.meet-container iframe {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  display: block;
}

/* Loader */
.meet-loader {
  position: absolute;
  inset: 0;
  background: #090B10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  z-index: 5;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

.meet-loader.hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

.meet-loader p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(28, 34, 52, 0.95);
  border: 1px solid var(--border-focus);
  color: var(--text-primary);
  padding: 0.75rem 1.4rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Animations */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* Responsive adjustments */
@media (max-width: 640px) {
  .join-card {
    padding: 1.5rem 1.25rem;
  }
  .brand-title {
    font-size: 1.75rem;
  }
  .meet-header {
    height: 48px;
    min-height: 48px;
    padding: 0 0.65rem;
  }
  .header-app-title {
    display: none;
  }
  .room-name {
    max-width: 110px;
    font-size: 0.78rem;
  }
  .room-indicator {
    padding: 0.25rem 0.5rem;
    gap: 0.35rem;
  }
  .room-label {
    display: none;
  }
  .meet-header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }
  .header-user-profile {
    display: none !important;
  }
  .btn-danger {
    padding: 0.35rem 0.6rem;
    font-size: 0.74rem;
    gap: 0.25rem;
  }
  .btn-danger span {
    display: none;
  }
  .btn-danger svg {
    width: 16px;
    height: 16px;
  }
  .meet-container {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
  }
}
