/* 
  Antigravity Studio - CSS Theme 
  Premium dark mode with vivid accents, glassmorphism and modern typography 
*/
:root {
  --bg-dark: #0a0a0f;
  --bg-panel: rgba(20, 20, 25, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-glass: rgba(255, 255, 255, 0.1);
  --text-main: #f0f0f5;
  --text-muted: #a0a0b0;
  --accent: #ff2a5f;
  --accent-hover: #ff4d79;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-neon: 0 0 20px rgba(255, 42, 95, 0.4);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  background-image: radial-gradient(circle at 50% -20%, rgba(255, 42, 95, 0.15) 0%, transparent 50%),
                    radial-gradient(circle at -20% 120%, rgba(42, 120, 255, 0.1) 0%, transparent 40%);
  background-attachment: fixed;
  overflow: hidden;
  height: 100vh;
}

/* Base Layout */
.app-container {
  display: grid;
  grid-template-columns: 90px 1fr 300px;
  height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
  z-index: 10;
}

.logo {
  color: var(--accent);
  font-size: 28px;
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-shadow: 0 0 10px rgba(255,42,95,0.5);
}

.logo span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  position: relative;
}

.nav-links a i {
  font-size: 24px;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-main);
}

.nav-links a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  width: 4px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  box-shadow: var(--shadow-neon);
}

.user-profile {
  margin-top: auto;
  position: relative;
}

.user-profile img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

.user-info {
  display: none;
}

/* Main Workspace */
.studio-main {
  display: flex;
  flex-direction: column;
  padding: 24px 32px;
  overflow-y: auto;
}

.studio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.header-title h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  margin-top: 4px;
  letter-spacing: 1px;
}

.status-badge.offline {
  background: rgba(255, 255, 255, 0.1);
  color: #aaa;
}

.status-badge.live {
  background: rgba(255, 42, 95, 0.2);
  color: #ff2a5f;
  animation: pulse 2s infinite;
  box-shadow: 0 0 10px rgba(255,42,95,0.3);
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.header-actions {
  display: flex;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 14px rgba(255, 42, 95, 0.4);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 42, 95, 0.6);
}

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

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px dashed var(--accent);
  width: 100%;
  justify-content: center;
}

.btn-outline:hover {
  background: rgba(255,42,95,0.1);
}

/* Main Canvas Layer */
.video-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.canvas-container {
  width: 100%;
  aspect-ratio: 16/9;
  background-color: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  border: 1px solid var(--border-glass);
  display: flex;
  justify-content: center;
  align-items: center;
}

.canvas-container canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  padding: 24px;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}

.brand-watermark {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255,255,255,0.1);
}

/* Individual Camera Feeds */
.feeds-container {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.feeds-container::-webkit-scrollbar {
  height: 8px;
}
.feeds-container::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 4px;
}

.feed-item {
  width: 240px;
  aspect-ratio: 16/9;
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.feed-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror for local view */
}

/* Guest video doesn't need mirror mostly, but we define generic */
.feed-item.guest-feed video {
  transform: none; /* remove mirror for guests */
}

.feed-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feed-name {
  font-size: 12px;
  font-weight: 500;
  background: rgba(0,0,0,0.5);
  padding: 4px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

.feed-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: 0.2s;
  backdrop-filter: blur(4px);
}

.icon-btn:hover {
  background: rgba(255,255,255,0.2);
}

.icon-btn.muted {
  background: rgba(255, 42, 95, 0.8);
}

/* Config Sidebar */
.config-panel {
  background: var(--bg-panel);
  border-left: 1px solid var(--border-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.config-panel h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.panel-desc {
  font-size: 13px;
  color: #777;
  margin-bottom: 20px;
  line-height: 1.4;
}

.destinations-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.destination-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  padding: 12px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dest-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.dest-icon {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 16px;
}

.dest-remove {
  color: #ff2a5f;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  opacity: 0.7;
  transition: 0.2s;
}
.dest-remove:hover { opacity: 1; }

.add-destination-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-destination-form input,
.branding-controls input[type="text"] {
  width: 100%;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-glass);
  padding: 12px;
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.2s;
}

.add-destination-form input:focus,
.branding-controls input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.divider {
  height: 1px;
  background: var(--border-glass);
  margin: 30px 0;
}

.branding-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.branding-controls label {
  font-size: 13px;
  color: #ccc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-picker-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: none;
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: 2px solid var(--border-glass);
  border-radius: 8px;
}

/* Guest View Styles */
body.guest-mode .config-panel,
body.guest-mode #broadcastStatus,
body.guest-mode #brandNameText {
  display: none;
}
body.guest-mode #recordLocalBtn,
body.guest-mode #copyInviteBtn,
body.guest-mode #toggleLiveBtn {
  display: none !important;
}
body.guest-mode .app-container {
  grid-template-columns: 90px 1fr;
}
body.guest-mode .feed-name {
  background: var(--accent);
}

/* Toast logic */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
  padding: 14px 24px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  font-size: 14px;
  transform: translateY(100px);
  opacity: 0;
  transition: 0.3s;
  z-index: 1000;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Modal & Extra Styles */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(5px);
  z-index: 30000;
  display: flex;
  justify-content: center;
  align-items: center;
}
.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  padding: 24px;
  border-radius: var(--radius-lg);
  width: 400px;
  max-width: 90%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
}
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-group label {
  font-size: 13px;
  color: #ccc;
}
select, .file-input {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-glass);
  padding: 12px;
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 13px;
}
select option {
  background: #222;
  color: #fff;
}
.recording {
  color: #fff !important;
  background: #e60000 !important;
  animation: pulse 2s infinite;
}
.file-input {
    padding: 8px;
    cursor: pointer;
}
.file-input::-webkit-file-upload-button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

/* Tabs y Personalización Visual Avanzada */
.panel-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.panel-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: #777;
  padding: 10px 0;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s;
}
.panel-tab i {
  font-size: 20px;
  margin-bottom: 4px;
}
.panel-tab.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  background: rgba(255, 42, 95, 0.1);
}
.tab-content {
  display: none;
  animation: fadeIn 0.3s;
}
.tab-content.active {
  display: block;
}
.live-toggles-container {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.feed-actions .in-stream-btn {
  background: #333;
}
.feed-actions .in-stream-btn.active {
  background: var(--primary-color);
  color: white;
}

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

[contenteditable="true"] {
    outline: none;
    border-bottom: 1px dashed rgba(255,42,95,0.5);
    padding-bottom: 2px;
}

/* Sala de Espera para el Guest */
body.waiting-room::after {
  content: "Estás en el Backstage. Espera a que el Anfitrión te dé el paso.";
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: black;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: bold;
  z-index: 9999;
}

/* --- LOGIN SCREEN STYLES --- */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-dark);
  background-image: radial-gradient(circle at 50% 50%, rgba(255, 42, 95, 0.2) 0%, transparent 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000000;
  transition: opacity 0.5s ease;
}

.login-card {
  background: rgba(20, 20, 25, 0.8);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 50px;
  border-radius: 30px;
  width: 440px;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,0.6), 0 0 100px rgba(255, 42, 95, 0.1);
  animation: loginSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.login-logo {
  font-size: 38px;
  font-weight: 900;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.text-gradient {
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-desc {
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 40px;
}

.app-container.hidden {
  display: none !important;
}
