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

:root {
  --primary: #3b82f6;
  --primary-dark: #1e40af;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f9fafb;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-secondary: #6b7280;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  text-align: center;
  margin-bottom: 40px;
  padding: 30px 0;
  border-bottom: 2px solid var(--border);
}

.header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
  color: var(--primary);
}

.header p {
  font-size: 1.1em;
  color: var(--text-secondary);
}

.extraction-panel {
  background: var(--surface);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.extraction-panel h2 {
  margin-bottom: 20px;
  color: var(--text);
}

.extraction-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 12px 20px;
  font-size: 1em;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
  font-weight: 500;
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
  animation: slideIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

.html-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.9em;
  font-family: monospace;
  resize: vertical;
  transition: border-color 0.3s;
  background: #f9fafb;
}

.html-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#extractHtmlBtn {
  margin-top: 10px;
}

.input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.url-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1em;
  transition: border-color 0.3s;
}

.url-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: var(--primary);
  color: white;
  min-width: 120px;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  background: var(--border);
  color: var(--text-secondary);
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: #d1d5db;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.message {
  padding: 12px 16px;
  border-radius: 8px;
  display: none;
  animation: slideIn 0.3s ease;
}

.message.show {
  display: block;
}

.message.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.message.loading {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.message.warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-wrapper {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 20px;
}

.filters-panel {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  height: fit-content;
  position: sticky;
  top: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filters-panel h3 {
  margin-bottom: 15px;
  color: var(--text);
}

.filter-group {
  margin-bottom: 15px;
}

.filter-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  cursor: pointer;
  color: var(--text-secondary);
}

.filter-group label input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.filter-group select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: white;
}

#resetFilters {
  width: 100%;
  margin-top: 15px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.property-card {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.3s;
  cursor: pointer;
  border: 2px solid transparent;
}

.property-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.property-card.interested {
  border-color: var(--success);
}

.property-card.maybe {
  border-color: var(--warning);
}

.property-card.rejected {
  border-color: var(--danger);
  opacity: 0.7;
}

.property-image {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3em;
  position: relative;
  overflow: hidden;
}

.property-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-count {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85em;
}

.property-info {
  padding: 15px;
}

.property-title {
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.property-price {
  font-size: 1.5em;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 8px;
}

.property-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.9em;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
}

.property-location {
  font-size: 0.9em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.features-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.feature-badge {
  background: #f0f9ff;
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: 500;
}

.property-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.action-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  font-size: 0.85em;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.action-btn.classify-interested {
  background: #d1fae5;
  color: var(--success);
}

.action-btn.classify-maybe {
  background: #fef3c7;
  color: var(--warning);
}

.action-btn.classify-rejected {
  background: #fee2e2;
  color: var(--danger);
}

.action-btn.delete {
  background: #fee2e2;
  color: var(--danger);
}

.action-btn:hover {
  transform: scale(1.05);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 1.1em;
  margin-bottom: 20px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background-color: var(--surface);
  border-radius: 12px;
  padding: 30px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.3s ease;
}

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

.close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: var(--text-secondary);
}

.close:hover {
  color: var(--text);
}

.modal-body {
  margin-top: 20px;
}

.modal-section {
  margin-bottom: 25px;
}

.modal-section h3 {
  color: var(--primary);
  margin-bottom: 10px;
  font-size: 1.2em;
}

.modal-section p {
  color: var(--text-secondary);
  line-height: 1.8;
}

.photos-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.photo-item {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.photo-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  border-color: var(--primary);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s;
}

.photo-item:hover img {
  opacity: 0.9;
}

/* Lightbox para ver fotos en grande */
.photo-lightbox {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  animation: fadeIn 0.3s ease;
}

.photo-lightbox.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox-content {
  max-width: 90%;
  max-height: 90%;
  position: relative;
  animation: slideUp 0.3s ease;
}

.photo-lightbox-content img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
}

.photo-lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 2001;
  transition: all 0.2s;
}

.photo-lightbox-close:hover {
  color: var(--primary);
  transform: scale(1.2);
}

.photo-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 30px;
  cursor: pointer;
  padding: 20px;
  user-select: none;
  transition: all 0.2s;
}

.photo-lightbox-nav:hover {
  color: var(--primary);
  transform: translateY(-50%) scale(1.2);
}

.photo-lightbox-prev {
  left: 20px;
}

.photo-lightbox-next {
  right: 20px;
}

.photo-lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.9em;
}

.modal-actions {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

.classification-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.modal-textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
}

@media (max-width: 768px) {
  .content-wrapper {
    grid-template-columns: 1fr;
  }

  .filters-panel {
    position: static;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .header h1 {
    font-size: 1.8em;
  }

  .input-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .classification-buttons {
    grid-template-columns: 1fr;
  }
}
