:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --background: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.8);
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --border-color: rgba(229, 231, 235, 0.7);
  --button-bg: #f3f4f6;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --control-button-size: 48px;
  --blur-amount: 16px;
  --animation-duration: 0.3s;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Animated Gradient Background */
.blob-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.3;
  animation: blob-float 20s infinite linear alternate;
}

.blob1 {
  width: 45vw;
  height: 45vw;
  top: -15vw;
  left: -15vw;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.5) 0%, rgba(99, 102, 241, 0.2) 100%);
  animation-delay: -10s;
}

.blob2 {
  width: 50vw;
  height: 50vw;
  top: 50%;
  right: -20vw;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.5) 0%, rgba(244, 114, 182, 0.2) 100%);
  animation-delay: -5s;
}

.blob3 {
  width: 35vw;
  height: 35vw;
  bottom: -10vw;
  left: 30%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.5) 0%, rgba(52, 211, 153, 0.2) 100%);
}

@keyframes blob-float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(5%, 5%) scale(1.1);
  }
  66% {
    transform: translate(-5%, 2%) scale(0.9);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

/* Container Styling */
.container {
  width: 100%;
  min-height: 100vh;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 0;
  left: 0;
  padding: 1rem;
  overflow: hidden;
}

.container.active {
  display: flex;
}

/* Glass Card Styling */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 2.5rem;
  width: 90%;
  max-width: 550px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s, box-shadow 0.3s;
  opacity: 0;
  animation: fadeIn 0.6s ease-out forwards;
}

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

/* Animated Gradient Text */
.animated-gradient-text {
  font-size: 2.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  text-align: center;
  background: linear-gradient(90deg, 
    #4f46e5 0%, 
    #8b5cf6 25%, 
    #ec4899 50%, 
    #8b5cf6 75%, 
    #4f46e5 100%);
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientText 6s linear infinite;
}

@keyframes gradientText {
  to {
    background-position: 200% center;
  }
}

.header {
  margin-bottom: 2rem;
}

.subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 1.1rem;
}

/* Video Preview Styling */
.preview-container {
  margin-bottom: 2rem;
  width: 100%;
}

.video-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background-color: rgba(0, 0, 0, 0.6);
  margin-bottom: 1rem;
  width: 100%;
  aspect-ratio: 16/9;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, transparent 85%, rgba(0, 0, 0, 0.3));
}

#local-video-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* Form Styling */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

input[type="text"],
select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  font-size: 1rem;
  color: var(--text-primary);
  transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.primary-button {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.primary-button:hover {
  background-color: var(--primary-hover);
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Control Buttons */
.control-button {
  width: var(--control-button-size);
  height: var(--control-button-size);
  border-radius: 50%;
  background-color: var(--button-bg);
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: all 0.3s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.control-button i {
  font-size: 1.25rem;
  color: var(--text-primary);
  transition: color 0.3s;
}

.control-button:hover {
  background-color: rgba(243, 244, 246, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.control-button.active {
  background-color: rgba(243, 244, 246, 0.9);
}

.control-button.inactive {
  background-color: rgba(239, 68, 68, 0.1);
}

.control-button.inactive i {
  color: var(--danger-color);
}

.control-button .tooltip {
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.control-button:hover .tooltip {
  opacity: 1;
}

.control-button.danger {
  background-color: var(--danger-color);
}

.control-button.danger i {
  color: white;
}

.control-button.danger:hover {
  background-color: var(--danger-hover);
}

/* Controls container in call */
.controls-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Error Message */
.error-message {
  color: var(--danger-color);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  background-color: rgba(239, 68, 68, 0.1);
  border-radius: 4px;
  display: none;
}

/* Call Screen Styles */
.call-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.call-header {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.5rem;
  position: relative;
}

.room-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin: 0 auto;
}

.leave-call-btn {
  position: absolute;
  right: 20px;
  background-color: var(--danger-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
}

.leave-call-btn:hover {
  background-color: var(--danger-hover);
}

/* Participants Grid */
.participants-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  grid-auto-rows: minmax(200px, auto);
  gap: 1rem;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 1400px;
  min-height: 280px;
  height: calc(100vh - 240px);
  overflow-y: auto;
  padding: 0.5rem;
}

.participant-container {
  position: relative;
  height: 100%;
  min-height: 200px;
  border-radius: 16px;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  width: 100%;
  transition: all 0.3s ease;
}

.video-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.participant-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Mirrored local video */
.mirrored {
  transform: scaleX(-1);
}

.participant-info {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}

.status-icon {
  font-size: 0.8rem;
  color: var(--danger-color);
}

.participant-name {
  word-break: break-word;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* No Video Placeholder */
.no-video-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #374151;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 5;
}

.no-video-placeholder i {
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.5);
}

/* Loading Overlay */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  color: white;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 20px;
}

.loading-text {
  font-size: 1.1rem;
}

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

/* Screen Share Styles */
.screen-share-container {
  grid-column: 1 / -1;
  grid-row: 1;
  z-index: 2;
}

/* Special styling when screen share is active */
.screen-share-active {
  grid-template-rows: minmax(220px, 1fr) repeat(auto-fill, minmax(120px, 160px));
}

.screen-share-active .participant-container:not(.screen-share-container) {
  grid-row: auto;
  min-height: 120px;
}

/* Quality Indicators */
.quality-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 2px;
  z-index: 10;
}

.quality-bar {
  width: 4px;
  height: 12px;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.quality-bar.poor {
  background-color: var(--danger-color);
}

.quality-bar.fair {
  background-color: var(--warning-color);
}

.quality-bar.good {
  background-color: var(--success-color);
}

/* Toast notification for errors */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: rgba(239, 68, 68, 0.95);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 350px;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Media queries for responsiveness */
@media (max-width: 768px) {
  .glass-card {
    padding: 1.5rem;
    width: 95%;
  }
  
  .animated-gradient-text {
    font-size: 2rem;
  }
  
  .controls-container {
    gap: 0.5rem;
  }
  
  .control-button {
    width: 40px;
    height: 40px;
  }
  
  .participants-area {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(180px, auto);
    height: calc(100vh - 200px);
  }
  
  .participant-container {
    min-height: 180px;
  }

  .screen-share-active {
    grid-template-rows: minmax(180px, 1fr) repeat(auto-fill, 120px);
  }
}

@media (min-width: 769px) and (max-width: 1200px) {
  .participants-area {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (min-width: 1201px) {
  .participants-area {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}
