/* ============================================
   arwuchivo - Minimal Mobile First
   ============================================ */

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

/* Variables */
:root {
  --bg: #ffffff;
  --text: #000000;
  --text-muted: #666666;
  --border: #e0e0e0;
  --overlay-bg: rgba(0, 0, 0, 0.9);
  
  /* Espaciado minimal */
  --header-h: 8dvh;
  --legend-size: 80px;
  --upload-btn-size: 56px;
  
  /* Bordes menos redondeados */
  --radius: 4px;
  --radius-sm: 2px;
}

/* Body */
html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

/* ============================================
   HEADER - Mes/Año centrado
   ============================================ */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.date-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.2s ease;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.date-btn:hover {
  background: #f5f5f5;
}

.date-btn:active {
  background: #e0e0e0;
}

/* ============================================
   CANVAS - Espacio completo para videos
   ============================================ */
.canvas {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden; /* Sin scroll */
}

.empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

/* Videos flotantes */
.video-item {
  position: absolute;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.video-item:hover {
  transform: scale(1.05);
  z-index: 10;
}

.video-item:active {
  transform: scale(0.98);
}

.video-item video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Indicador de color (línea inferior) */
.video-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--video-color, #000);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* ============================================
   LEYENDA - Pequeñita abajo derecha
   ============================================ */

.legend {
  position: fixed;
  bottom: 16px;
  right: 16px;
  max-width: var(--legend-size);
  font-size: 10px;
  color: var(--text-muted);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   BOTÓN DE SUBIDA - Flotante abajo izquierda
   ============================================ */

.upload-btn {
  position: fixed;
  bottom: 16px;
  left: 16px;
  width: var(--upload-btn-size);
  height: var(--upload-btn-size);
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.upload-btn:active {
  transform: scale(0.95);
}

/* ============================================
   MENÚ DE ESTACIONES
   ============================================ */

.season-menu {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.season-menu[hidden] {
  display: none;
}

.season-menu-inner {
  width: min(400px, 100%);
  max-height: 80dvh;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow-y: auto;
}

.season-menu-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 300;
  line-height: 1;
}

.season-menu-close:hover {
  background: #f5f5f5;
  color: var(--text);
}

.season-menu-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  padding: 8px 0;
}

.month-item {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 400;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.month-item:hover {
  background: #f5f5f5;
  border-color: var(--text);
}

.month-item.has-content {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 600;
}

.month-item.has-content:hover {
  background: #333;
}

.month-item.is-current {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

.month-name {
  font-size: 14px;
  font-weight: 600;
}

.month-year {
  font-size: 11px;
  opacity: 0.7;
}

/* ============================================
   OVERLAY DE VIDEO FULLSCREEN
   ============================================ */

.video-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.video-overlay[hidden] {
  display: none;
}

.video-overlay-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 300;
  line-height: 1;
  z-index: 10;
}

.video-overlay-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.video-overlay-body {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.video-overlay-body video {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
}

/* ============================================
   MODAL DE PASSWORD
   ============================================ */

.password-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  padding: 16px;
}

.password-overlay[hidden] {
  display: none;
}

.password-overlay-inner {
  width: min(360px, 100%);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
}

.password-overlay-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 300;
  line-height: 1;
}

.password-overlay-close:hover {
  background: #f5f5f5;
  color: var(--text);
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.password-form label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.password-form input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.password-form input:focus {
  outline: none;
  border-color: var(--text);
}

.password-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.password-actions button {
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.password-actions button:hover {
  background: #f5f5f5;
}

.password-actions button.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.password-actions button.primary:hover {
  background: #333;
}

.password-error {
  font-size: 12px;
  color: #dc2626;
  padding: 8px 12px;
  background: #fee2e2;
  border-radius: var(--radius);
}

/* ============================================
   MODAL DE SUBIDA
   ============================================ */

.upload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  padding: 16px;
}

.upload-overlay[hidden] {
  display: none;
}

.upload-overlay-inner {
  width: min(480px, 100%);
  max-height: 90dvh;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow-y: auto;
}

.upload-overlay-inner h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

.upload-overlay-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 300;
  line-height: 1;
}

.upload-overlay-close:hover {
  background: #f5f5f5;
  color: var(--text);
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="date"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.form-field input:focus {
  outline: none;
  border-color: var(--text);
}

.form-field input[type="file"] {
  font-size: 13px;
}

.upload-people {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.person-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f5f5f5;
  border-radius: var(--radius);
  font-size: 13px;
}

.person-chip-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.person-chip-name {
  flex: 1;
}

.person-chip-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.person-chip-remove:hover {
  background: #e0e0e0;
  color: var(--text);
}

.add-person-btn {
  appearance: none;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.add-person-btn:hover {
  border-color: var(--text);
  color: var(--text);
  background: #f5f5f5;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.form-actions button {
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.form-actions button:hover {
  background: #f5f5f5;
}

.form-actions button.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.form-actions button.primary:hover {
  background: #333;
}

/* ============================================
   MODAL DE NUEVA PERSONA
   ============================================ */

.new-person-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 16px;
}

.new-person-overlay[hidden] {
  display: none;
}

.new-person-overlay-inner {
  width: min(360px, 100%);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
}

.new-person-overlay-inner h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.new-person-overlay-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 300;
  line-height: 1;
}

.new-person-overlay-close:hover {
  background: #f5f5f5;
  color: var(--text);
}

.new-person-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.new-person-form input[type="color"] {
  width: 100%;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

/* ============================================
   MODAL TEMPORAL (Selector de personas)
   ============================================ */

.temp-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 350;
  padding: 16px;
}

.temp-modal-inner {
  width: min(360px, 100%);
  max-height: 80dvh;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow-y: auto;
}

.temp-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 300;
  line-height: 1;
}

.temp-modal-close:hover {
  background: #f5f5f5;
  color: var(--text);
}

.person-selector h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.person-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.person-option {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.person-option:hover:not(:disabled) {
  background: #f5f5f5;
  border-color: var(--text);
}

.person-option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.person-option.selected {
  background: #f5f5f5;
}

.person-option-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.person-option-name {
  flex: 1;
  text-align: left;
}

.new-person-trigger {
  appearance: none;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  width: 100%;
  font-family: inherit;
}

.new-person-trigger:hover {
  border-color: var(--text);
  color: var(--text);
  background: #f5f5f5;
}

.empty-people {
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
  .upload-btn {
    --upload-btn-size: 48px;
    font-size: 28px;
  }
  
  .legend {
    font-size: 9px;
    bottom: 12px;
    right: 12px;
  }
  
  .legend-dot {
    width: 6px;
    height: 6px;
  }
}
