/* ================================================
   CUSTOM CSS FOUNDATION - REPLACING PICOCSS
   Color Palette: ColorHunt + Professional Green (#F79B72, #2A4759, #3B8C88, #DDDDDD, #EEEEEE)
   ================================================ */

/* CSS Reset & Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* CSS Variables - ColorHunt Palette + Professional Green */
:root {
  --color-primary: #F79B72;     /* Naranja cálido */
  --color-secondary: #2A4759;   /* Azul oscuro */
  --color-tertiary: #3B8C88;    /* Verde azulado profesional */
  --color-light-gray: #DDDDDD;  /* Gris claro */
  --color-bg-light: #EEEEEE;    /* Gris muy claro */
  
  /* Primary colors */
  --primary: var(--color-primary);
  --primary-hover: #E6804F;
  --primary-focus: rgba(247, 155, 114, 0.125);
  --primary-inverse: #FFFFFF;
  
  /* Secondary colors */
  --secondary: var(--color-secondary);
  --secondary-hover: #1F3342;
  --secondary-focus: rgba(42, 71, 89, 0.125);
  --secondary-inverse: #FFFFFF;
  
  /* Tertiary colors (Professional Green) */
  --tertiary: var(--color-tertiary);
  --tertiary-hover: #2F6B67;
  --tertiary-focus: rgba(59, 140, 136, 0.125);
  --tertiary-inverse: #FFFFFF;
  
  /* Neutral colors */
  --muted-color: var(--color-secondary);
  --muted-border-color: var(--color-light-gray);
  --card-background-color: #FFFFFF;
  --card-border-color: var(--color-light-gray);
  
  /* Background colors */
  --background-color: #F8F9FA;
  --color: var(--color-secondary);
  
  /* Interactive colors */
  --del-color: #E74C3C;
  --del-hover-color: #C0392B;
  --success-color: var(--color-tertiary); /* Usando el verde profesional para success */
  --warning-color: #F39C12;
  
  /* Spacing & Layout */
  --border-radius: 8px;
  --spacing-unit: 1rem;
  --container-max-width: 1200px;
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-size-base: 1rem;
  --line-height-base: 1.5;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(42, 71, 89, 0.08);
  --shadow-md: 0 4px 6px rgba(42, 71, 89, 0.1);
  --shadow-lg: 0 8px 32px rgba(42, 71, 89, 0.15);
  --shadow-xl: 0 20px 40px rgba(42, 71, 89, 0.2);
}

/* Base HTML Elements */
html {
  font-size: 100%;
  line-height: var(--line-height-base);
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-base);
  color: var(--color);
  background: linear-gradient(135deg, #F8F9FA 0%, #E9ECEF 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  margin-bottom: var(--spacing-unit);
  color: var(--secondary);
}

h1 {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid var(--primary);
  position: relative;
}

h1::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

p {
  margin-bottom: var(--spacing-unit);
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Navigation Header Styles */
.nav-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--muted-border-color);
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--card-background-color);
  border: 2px solid var(--muted-border-color);
  border-radius: var(--border-radius);
  color: var(--secondary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.back-button:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-inverse);
  text-decoration: none;
  transform: translateX(-2px);
  box-shadow: var(--shadow-md);
}

.back-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-focus);
}

/* Hero Section Styles - Diseño integrado */
.hero-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--tertiary) 100%);
  border-radius: 12px;
  margin: 1.5rem 0 2rem 0;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  color: white;
  overflow: hidden;
  position: relative;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><defs><radialGradient id="a" cx="50%" cy="0%"><stop offset="0%" style="stop-color:rgba(255,255,255,0.1)"/><stop offset="100%" style="stop-color:rgba(255,255,255,0)"/></radialGradient></defs><rect width="100" height="20" fill="url(%23a)"/></svg>');
  pointer-events: none;
  z-index: 1;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  position: relative;
  z-index: 2;
}

.hero-text h1 {
  margin-bottom: 1rem;
  color: white;
  text-align: left;
  border: none;
  padding: 0;
  font-size: 2.2rem;
}

.hero-text h1::after {
  display: none;
}

.hero-subtitle {
  font-size: 1.1rem;
  opacity: 0.95;
  line-height: 1.5;
  margin-bottom: 0;
}

.hero-image {
  text-align: center;
}

.hero-img {
  max-width: 100%;
  height: auto;
  max-height: 250px;
  border-radius: var(--border-radius);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.hero-img:hover {
  transform: scale(1.05);
}

/* Layout Components */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

main {
  max-width: 560px;
  margin-inline: auto;
  padding: 2rem 1rem;
}

/* Form Elements */
form {
  background: var(--card-background-color);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--card-border-color);
}

label {
  display: block;
  font-weight: var(--font-weight-semibold);
  color: var(--secondary);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

input,
textarea,
select {
  display: block;
  width: 100%;
  padding: 0.75rem;
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  line-height: var(--line-height-base);
  color: var(--color);
  background-color: #FFFFFF;
  border: 2px solid var(--muted-border-color);
  border-radius: var(--border-radius);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  margin-bottom: var(--spacing-unit);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem var(--primary-focus);
}

input::placeholder,
textarea::placeholder {
  color: #999;
  opacity: 1;
}

input[type="file"] {
  padding: 0.5rem;
  background-color: transparent;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Button Styles */
button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
}

/* Primary Button */
button[type="submit"],
button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-inverse);
  font-weight: var(--font-weight-semibold);
  font-size: 1.1rem;
  padding: 0.75rem 2rem;
  width: 100%;
  margin-top: var(--spacing-unit);
}

button[type="submit"]:hover,
button.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(247, 155, 114, 0.4);
}

button[type="submit"]:disabled,
button.primary:disabled {
  opacity: 0.6;
  transform: none;
  box-shadow: none;
  cursor: not-allowed;
}

/* Outline Button */
button.outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: var(--font-weight-medium);
}

button.outline:hover:not(:disabled) {
  background: var(--primary);
  color: var(--primary-inverse);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(247, 155, 114, 0.3);
}

button.outline:disabled {
  opacity: 0.5;
  background: transparent;
  color: var(--muted-color);
  border-color: var(--muted-border-color);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Secondary Button */
button.secondary {
  background: var(--secondary);
  border-color: var(--secondary);
  color: var(--secondary-inverse);
}

button.secondary:hover {
  background: var(--secondary-hover);
  border-color: var(--secondary-hover);
}

/* Tertiary Button (Professional Green) */
button.tertiary {
  background: var(--tertiary);
  border-color: var(--tertiary);
  color: var(--tertiary-inverse);
}

button.tertiary:hover {
  background: var(--tertiary-hover);
  border-color: var(--tertiary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(59, 140, 136, 0.3);
}

button.tertiary:disabled {
  opacity: 0.6;
  transform: none;
  box-shadow: none;
  cursor: not-allowed;
}

/* Danger Button */
button.danger {
  background: var(--del-color);
  border-color: var(--del-color);
  color: white;
}

button.danger:hover {
  background: var(--del-hover-color);
  border-color: var(--del-hover-color);
}

/* Status Messages */
#status {
  margin-top: var(--spacing-unit);
  font-weight: var(--font-weight-semibold);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  background: var(--card-background-color);
  border: 1px solid var(--muted-border-color);
  text-align: center;
  font-size: 1.1rem;
}

/* Photo Section Styles */
.photos-section {
  margin: 1.5rem 0;
  padding: 1.5rem;
  border: 1px solid var(--muted-border-color);
  border-radius: var(--border-radius);
  background: var(--card-background-color);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease;
}

.photos-section:hover {
  box-shadow: var(--shadow-md);
}

.photos-section > label {
  font-size: 1.1rem;
  font-weight: var(--font-weight-bold);
  margin-bottom: 1rem;
  color: var(--secondary);
}

.photo-upload {
  margin-bottom: 1rem;
}

/* Photos Grid and Container */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  min-height: 100px;
  transition: all 0.3s ease;
}

.photos-grid.has-photos {
  background: transparent;
}

/* Empty State Styles */
.empty-state {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--bg-light) 0%, #ffffff 100%);
  border: 2px dashed var(--muted-border-color);
  border-radius: 12px;
  padding: 2.5rem 1rem;
  text-align: center;
  transition: all 0.3s ease;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
  box-shadow: 0 2px 12px rgba(42, 71, 89, 0.04);
}

.empty-state:hover {
  border-color: var(--primary);
  background: linear-gradient(135deg, #ffffff 0%, var(--bg-light) 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.empty-state-content {
  max-width: 400px;
}

.empty-state-content h3 {
  color: var(--secondary);
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
  font-weight: var(--font-weight-semibold);
}

.empty-state-content p {
  color: var(--muted-color);
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.empty-state-img {
  max-width: 120px;
  height: auto;
  margin-bottom: 1.5rem;
  opacity: 0.8;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 2px 8px rgba(59, 140, 136, 0.1));
}

.empty-state:hover .empty-state-img {
  transform: scale(1.05);
  opacity: 1;
}

.empty-state-tips {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.tip {
  background: var(--primary);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  user-select: none;
}

.tip.clickable {
  cursor: pointer;
  background: var(--primary);
}

.tip.clickable:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(247, 155, 114, 0.3);
}

.tip.clickable:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.tip.clickable:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.tip.info {
  background: var(--tertiary);
  color: white;
}

.tip.info:hover {
  background: var(--tertiary-hover);
  transform: translateY(-1px);
}

@media (max-width: 576px) {
  .empty-state {
    padding: 1.5rem 0.5rem;
    min-height: 180px;
  }
  .empty-state-img {
    max-width: 80px;
  }
  .empty-state-content h3 {
    font-size: 1.1rem;
  }
  .empty-state-content p {
    font-size: 0.9rem;
  }
}

/* Hide empty state when photos are present */
.has-photos .empty-state {
  display: none;
}

.photo-item {
  border: 1px solid var(--muted-border-color);
  border-radius: var(--border-radius);
  padding: 1rem;
  background: var(--card-background-color);
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease;
}

.photo-item:hover {
  box-shadow: var(--shadow-md);
}

.photo-preview {
  width: 100%;
  max-height: 300px;
  height: auto;
  object-fit: contain;
  border-radius: var(--border-radius);
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-sm);
  background: #fff;
}

.photo-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.photo-number {
  font-weight: var(--font-weight-semibold);
  color: var(--primary);
  font-size: 0.9rem;
}

.delete-photo {
  background: var(--del-color);
  color: white;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: var(--font-weight-medium);
  transition: background-color 0.3s ease;
}

.delete-photo:hover {
  background: var(--del-hover-color);
}

.photo-comment {
  margin: 0.5rem 0;
}

.photo-comment textarea {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Voice Comment Styles */
.voice-comment {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.voice-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.voice-controls button {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.recording-indicator {
  color: var(--del-color);
  font-weight: var(--font-weight-semibold);
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

.voice-playback {
  width: 100%;
  height: 30px;
}

/* Audio Recorder Styles */
.audio-recorder {
  margin: 1.5rem 0;
  padding: 1.5rem;
  border: 1px solid var(--muted-border-color);
  border-radius: var(--border-radius);
  background: var(--card-background-color);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease;
}

.audio-recorder:hover {
  box-shadow: var(--shadow-md);
}

.audio-recorder > label {
  font-size: 1.1rem;
  font-weight: var(--font-weight-bold);
  margin-bottom: 1rem;
  color: var(--secondary);
}

.recorder-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.recording-status-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.audio-visualizer {
  width: 40px;
  height: 30px;
  opacity: 0.8;
}

#audioVisualizerContainer {
  transition: opacity 0.3s ease;
}

#audioVisualizerContainer.recording {
  opacity: 1;
}

#audioPlayback {
  width: 100%;
  margin-top: 1rem;
}

/* Loading Styles */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  background: var(--card-background-color);
  border: 2px solid var(--primary);
  border-radius: var(--border-radius);
  margin: 1rem 0;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.loading-icon {
  width: 60px;
  height: 60px;
  opacity: 0.9;
  filter: drop-shadow(0 2px 4px rgba(247, 155, 114, 0.3));
}

.loading-text {
  font-size: 1.1rem;
  font-weight: var(--font-weight-semibold);
  color: var(--secondary);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Camera Modal Styles */
.camera-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.camera-content {
  background: var(--card-background-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-xl);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#cameraVideo {
  width: 100%;
  max-width: 480px;
  height: auto;
  border-radius: var(--border-radius);
  background: #000;
}

.camera-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.camera-controls button {
  min-width: 120px;
  font-weight: var(--font-weight-semibold);
}

#captureBtn {
  background: var(--tertiary);
  border-color: var(--tertiary);
  color: var(--tertiary-inverse);
}

#captureBtn:hover {
  background: var(--tertiary-hover);
  border-color: var(--tertiary-hover);
}

#closeCameraBtn {
  background: var(--del-color);
  border-color: var(--del-color);
  color: white;
}

#closeCameraBtn:hover {
  background: var(--del-hover-color);
  border-color: var(--del-hover-color);
}

/* Indicador de procesamiento de imagen */
.processing-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--primary);
  color: var(--primary-inverse);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  font-weight: var(--font-weight-semibold);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive adjustments for camera modal */
@media (max-width: 768px) {
  .camera-content {
    padding: 1rem;
    margin: 1rem;
  }
  
  #cameraVideo {
    max-width: 100%;
  }
  
  .camera-controls {
    flex-direction: column;
    width: 100%;
  }
  
  .camera-controls button {
    width: 100%;
    min-width: auto;
  }
  
  /* Hero responsive */
  .hero-banner {
    padding: 1.5rem;
    margin: 1rem 0 1.5rem 0;
  }
  
  .hero-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }
  
  .hero-text h1 {
    font-size: 1.8rem;
    text-align: center;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .hero-img {
    max-height: 200px;
  }
}

@media (max-width: 576px) {
  .container,
  main {
    padding: 0.5rem 0.25rem;
  }
  
  form {
    padding: 1rem;
    margin: 0.5rem;
  }
  
  .hero-banner {
    margin: 0.5rem 0 1rem 0;
    padding: 1rem;
  }
  
  .hero-text h1 {
    font-size: 1.6rem;
  }
  
  .hero-subtitle {
    font-size: 0.95rem;
  }
  
  .hero-img {
    max-height: 150px;
  }
  
  .photos-section,
  .audio-recorder {
    padding: 1rem;
    margin: 1rem 0;
  }
  
  .audio-visualizer {
    width: 35px;
    height: 25px;
  }
  
  .loading-icon {
    width: 50px;
    height: 50px;
  }
  
  .loading-text {
    font-size: 1rem;
  }
  
  button {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
  }
  
  input,
  textarea,
  select {
    padding: 0.625rem;
    font-size: 0.9rem;
  }
}
