/*
 * Photo Booth Styles - Compatible con navegadores antiguos
 * Incluye fallbacks para:
 * - CSS Variables (IE11+)
 * - Grid Layout (IE11+ con flexbox fallback)
 * - Aspect Ratio (con calc() y height fallback)
 * - Vendor prefixes para transform, box-shadow, border-radius, animations
 * - Transiciones y animaciones con prefixes
 * Soporte: IE11+, Chrome 20+, Firefox 20+, Safari 6+, Edge 12+
 */

:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --secondary-color: #ec4899;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --dark-bg: #1f2937;
  --darker-bg: #111827;
  --light-text: #f9fafb;
  --gray-text: #9ca3af;
  --border-color: #374151;
}

/* Fallbacks para navegadores sin CSS Variables (IE11 y abajo) */
.primary-color { color: #6366f1; }
.primary-dark { color: #4f46e5; }
.secondary-color { color: #ec4899; }
.success-color { color: #10b981; }
.warning-color { color: #f59e0b; }
.danger-color { color: #ef4444; }
.dark-bg { background: #1f2937; }
.darker-bg { background: #111827; }
.light-text { color: #f9fafb; }
.gray-text { color: #9ca3af; }
.border-color { border-color: #374151; }

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
  color: var(--light-text);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 6rem; /* Espacio para el botón fijo */
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
}

.fullscreen {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 0.5rem 0;
  border-bottom: 2px solid var(--border-color);
}

/* Sections */
.section {
  margin-bottom: 2rem;
}

.section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* Fallback para navegadores sin background-clip */
  background: var(--primary-color);
  color: var(--primary-color);
}

.header p {
  color: var(--gray-text);
  font-size: 1.1rem;
}

/* Sections */
.section {
  margin-bottom: 2rem;
}

.section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 1rem;
}

.status-badge.connected {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success-color);
}

.status-badge.disconnected {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger-color);
}

.status-badge.processing {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  
  50% {
    opacity: 0.5;
  }
}

@-webkit-keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  
  50% {
    opacity: 0.5;
  }
}

@-moz-keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  
  50% {
    opacity: 0.5;
  }
}

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  -webkit-border-radius: 1rem;
  -moz-border-radius: 1rem;
  padding: 2rem;
  margin-bottom: 2rem;
  /* backdrop-filter removido por compatibilidad */
}

.card h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

/* Buttons */
.btn {
  padding: 0.875rem 1.75rem;
  border: none;
  border-radius: 0.5rem;
  -webkit-border-radius: 0.5rem;
  -moz-border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  /* transition removido por rendimiento */
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary-color), #db2777);
  color: white;
}

.btn-large {
  padding: 1.5rem 3rem;
  font-size: 1.25rem;
  border-radius: 0.75rem;
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Grid Layout */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  /* Fallback para navegadores sin grid */
  display: flex;
  flex-wrap: wrap;
}

.grid-3 > * {
  flex: 1 1 300px;
  min-width: 300px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
  /* Fallback para navegadores sin grid */
  display: flex;
  flex-wrap: wrap;
}

.grid-2 > * {
  flex: 1 1 50%;
  min-width: 50%;
}

/* Links Card */
.links-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.link-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  /* transition removido por rendimiento */
}

.link-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary-color);
}

.link-info {
  flex: 1;
}

.link-info h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.link-info p {
  color: var(--gray-text);
  font-size: 0.875rem;
}

/* Session ID Display */
.session-id {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  word-break: break-all;
  border: 1px solid var(--border-color);
}

/* Style Selector */
.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 150px);
  gap: 1rem;
  margin-bottom: 2rem;
  justify-content: center;
  /* Fallback para navegadores sin grid */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.style-grid > * {
  flex: 0 0 150px;
  margin: 0.5rem;
}

.style-btn {
  padding: 1.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-color);
  border-radius: 0.75rem;
  color: var(--light-text);
  cursor: pointer;
  /* transition removido por rendimiento */
  font-size: 1rem;
  font-weight: 600;
}

.style-btn:hover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.style-btn.active {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.2);
}

/* Poster Buttons */
.poster-btn {
  position: relative;
  padding: 0;
  overflow: hidden;
  width: 150px;
  height: 266px; /* Fallback para navegadores sin aspect-ratio */
  height: calc(16 / 9 * 150px); /* Cálculo moderno */
  aspect-ratio: 9 / 16; /* Aspect ratio moderno */
  border: 0;
  border-radius: 0.75rem;
  -webkit-border-radius: 0.75rem;
  -moz-border-radius: 0.75rem;
  cursor: pointer;
  /* transition removido por rendimiento */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.poster-btn span {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.9);
  color: var(--light-text);
  padding: 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0 0 0.5rem 0.5rem;
  /* backdrop-filter removido por rendimiento */
}

.poster-btn:hover {
  border-color: var(--primary-color);
  /* Efectos removidos por rendimiento */
}

.poster-btn.active {
  border-color: var(--primary-color);
  /* Efectos removidos por rendimiento */
}

/* Image Display */
.image-container {
  width: 100%;
  height: 400px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px dashed var(--border-color);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-placeholder {
  text-align: center;
  color: var(--gray-text);
}

.image-placeholder svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Video/Camera Display */
.camera-container {
  flex: 1;
  position: relative;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.camera-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  /* Efecto espejo horizontal */
}

.camera-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  border: 4px solid rgba(99, 102, 241, 0.5);
}

.capture-flash {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}

.capture-flash.active {
  opacity: 1;
}

/* Result Screen - Split View */
.split-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: black;
}

.split-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}

.split-panel.left {
  border-right: 2px solid var(--border-color);
}

.split-label {
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  font-size: 1.25rem;
  font-weight: 700;
  z-index: 10;
}

.split-panel img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Loading Spinner */
.spinner {
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top: 4px solid var(--primary-color);
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -ms-transform: rotate(0deg);
  }
  
  100% {
    transform: rotate(360deg);
    -webkit-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
  }
}

@-webkit-keyframes spin {
  0% {
    -webkit-transform: rotate(0deg);
  }
  
  100% {
    -webkit-transform: rotate(360deg);
  }
}

@-moz-keyframes spin {
  0% {
    -moz-transform: rotate(0deg);
  }
  
  100% {
    -moz-transform: rotate(360deg);
  }
}

/* Notifications */
.notification {
  position: fixed;
  top: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--border-color);
  /* box-shadow removido por rendimiento */
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    -webkit-transform: translateX(400px);
    -moz-transform: translateX(400px);
    -ms-transform: translateX(400px);
    opacity: 0;
  }
  
  to {
    transform: translateX(0);
    -webkit-transform: translateX(0);
    -moz-transform: translateX(0);
    -ms-transform: translateX(0);
    opacity: 1;
  }
}

@-webkit-keyframes slideIn {
  from {
    -webkit-transform: translateX(400px);
    opacity: 0;
  }
  
  to {
    -webkit-transform: translateX(0);
    opacity: 1;
  }
}

@-moz-keyframes slideIn {
  from {
    -moz-transform: translateX(400px);
    opacity: 0;
  }
  
  to {
    -moz-transform: translateX(400px);
    opacity: 1;
  }
}

.notification.success {
  border-color: var(--success-color);
}

.notification.error {
  border-color: var(--danger-color);
}

.notification.warning {
  border-color: var(--warning-color);
}

/* Responsive */
@media (max-width:768px) {
  .header h1 {
    font-size: 2rem;
  }
  
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .split-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  
  .split-panel.left {
    border-right: none;
    border-bottom: 2px solid var(--border-color);
  }
  
  .style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 150px);
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
    align-items: start;
  }

  /* Botón fijo en móviles */
  .capture-btn-fixed {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    width: auto;
    max-width: calc(100vw - 2rem);
  }

  .capture-info-fixed {
    bottom: 0.5rem;
    right: 1rem;
    left: 1rem;
    width: auto;
    max-width: calc(100vw - 2rem);
    text-align: center;
  }

  body {
    padding-bottom: 8rem; /* Más espacio en móviles */
  }
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

/* Botón de captura fijo */
.capture-btn-fixed {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border-radius: 1rem;
  -webkit-border-radius: 1rem;
  -moz-border-radius: 1rem;
  animation: slideInFromBottom 0.5s ease;
}

.capture-info-fixed {
  position: fixed;
  bottom: 1rem;
  right: 2rem;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.8);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  animation: slideInFromBottom 0.5s ease 0.1s both;
}

@keyframes slideInFromBottom {
  from {
    transform: translateY(100px);
    -webkit-transform: translateY(100px);
    -moz-transform: translateY(100px);
    opacity: 0;
  }
  
  to {
    transform: translateY(0);
    -webkit-transform: translateY(0);
    -moz-transform: translateY(0);
    opacity: 1;
  }
}

@-webkit-keyframes slideInFromBottom {
  from {
    -webkit-transform: translateY(100px);
    opacity: 0;
  }
  
  to {
    -webkit-transform: translateY(0);
    opacity: 1;
  }
}

@-moz-keyframes slideInFromBottom {
  from {
    -moz-transform: translateY(100px);
    opacity: 0;
  }
  
  to {
    -moz-transform: translateY(100px);
    opacity: 1;
  }
}