:root {
  --primary: #ff5757;
  --secondary: #667bc6;
  --dark: #1a1a1a;
  --light: #f5f5f5;
  --border: #ddd;
  --success: #4caf50;
  --danger: #ff5252;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--light);
  color: var(--dark);
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* HEADER */
.header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 20px;
  font-weight: bold;
  color: var(--primary);
}

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

.btn-login, .btn-profile {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-login:hover, .btn-profile:hover {
  background: var(--light);
}

/* SCREENS */
.screen {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: none;
  animation: slideIn 0.3s ease;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

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

/* ONBOARDING */
.onboarding-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
}

.onboarding-container h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

/* Onboarding Progressivo */
.onboarding-question {
  display: none;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 350px;
  animation: fadeIn 0.3s ease;
}

.onboarding-question.active {
  display: flex;
}

.question-step.active {
  display: flex;
}

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

.question-step h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--dark);
  margin: 0 0 16px 0;
  line-height: 1.3;
}

.distance-value {
  text-align: center;
  font-size: 32px;
  font-weight: bold;
  color: var(--primary);
  margin: 20px 0;
}

.progress-bar {
  width: 100%;
  height: 2px;
  background: #eee;
  border-radius: 1px;
  overflow: hidden;
  margin-bottom: 0;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 101;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.range-selector {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.range-selector input {
  padding: 16px;
  font-size: 18px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 8px;
}

.hint {
  font-size: 13px;
  color: #999;
  text-align: center;
}

.btn-next {
  padding: 14px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  margin-top: auto;
  transition: all 0.2s;
}

.btn-next:hover {
  background: #ff4444;
  transform: translateY(-2px);
}

.question h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--dark);
}

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

.option {
  display: flex;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.option:hover {
  background: var(--light);
  border-color: var(--primary);
}

.option input {
  margin-right: 8px;
  cursor: pointer;
}

.input-text {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
}

.range-slider {
  display: flex;
  gap: 12px;
  flex-direction: column;
}

.range-slider label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.range-slider input {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.slider {
  width: 100%;
  cursor: pointer;
}

.onboarding-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* BUTTONS */
.btn-primary, .btn-secondary, .btn-danger, .btn-undo, .btn-pass, .btn-like {
  padding: 12px 16px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.btn-primary {
  background: var(--primary);
  color: white;
  flex: 1;
}

.btn-primary:hover {
  background: #ff4444;
  transform: translateY(-2px);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  flex: 1;
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
}

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

.btn-danger:hover {
  background: #ff3333;
}

/* FEED */
.feed-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.card-stack {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  width: 100%;
  max-width: 400px;
  height: 500px;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  position: absolute;
  cursor: grab;
  user-select: none;
  transform: translateX(0) rotateZ(0deg) scale(1);
  transition: transform 0.1s;
}

.card.active {
  z-index: 10;
}

.card:active {
  cursor: grabbing;
}

.card img {
  width: 100%;
  height: 90%;
  object-fit: cover;
}

.card-info {
  padding: 8px 12px;
  height: 10%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 1px;
}

.card-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 2px;
  line-height: 1.2;
}

.card-meta {
  font-size: 12px;
  color: #666;
  margin-bottom: 0;
  line-height: 1;
}

.card-bio {
  font-size: 11px;
  color: #999;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.swipe-controls {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px;
}

.btn-undo, .btn-pass, .btn-like {
  padding: 12px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 16px;
  font-weight: bold;
  background: white;
  border: 2px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
}

.btn-undo {
  color: #666;
}

.btn-undo:hover {
  border-color: #666;
  background: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

.btn-pass:hover {
  border-color: var(--danger);
  background: #ffebee;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255,82,82,0.2);
}

.btn-like {
  color: var(--primary);
  border-color: var(--primary);
  background: #fff5f5;
}

.btn-like:hover {
  border-color: var(--primary);
  background: linear-gradient(135deg, #ff3333 0%, #ff6b35 50%, #ffa500 100%);
  color: white;
  transform: translateY(-2px) scale(1.05);
  box-shadow:
    0 0 30px rgba(255,51,51,0.8),
    0 0 50px rgba(255,107,53,0.6),
    0 0 70px rgba(255,165,0,0.4),
    inset 0 0 20px rgba(255,200,0,0.3);
}

.btn-like:active {
  background: linear-gradient(135deg, #ff0000 0%, #ff4500 40%, #ffa500 70%, #ffff00 100%);
  color: white;
  transform: translateY(-4px) scale(1.1);
  box-shadow:
    0 0 40px rgba(255,0,0,1),
    0 0 60px rgba(255,69,0,0.8),
    0 0 80px rgba(255,165,0,0.6),
    0 0 100px rgba(255,255,0,0.4),
    inset 0 0 30px rgba(255,255,100,0.4);
  animation: fireShake 0.4s ease-in-out;
}

@keyframes fireBlaze {
  0% {
    box-shadow:
      0 4px 12px rgba(255,87,87,0.3),
      0 0 20px rgba(255,87,87,0.4),
      0 0 30px rgba(255,165,0,0.2),
      inset 0 0 10px rgba(255,200,0,0.1);
  }
  50% {
    box-shadow:
      0 4px 12px rgba(255,87,87,0.4),
      0 0 25px rgba(255,87,87,0.6),
      0 0 40px rgba(255,165,0,0.4),
      inset 0 0 15px rgba(255,200,0,0.3);
  }
  100% {
    box-shadow:
      0 4px 12px rgba(255,87,87,0.3),
      0 0 20px rgba(255,87,87,0.4),
      0 0 30px rgba(255,165,0,0.2),
      inset 0 0 10px rgba(255,200,0,0.1);
  }
}

@keyframes fireShake {
  0% { transform: translateY(-4px) scale(1.1) rotate(0deg); }
  10% { transform: translateY(-4px) scale(1.1) rotate(-2deg) translateX(-2px); }
  20% { transform: translateY(-4px) scale(1.1) rotate(2deg) translateX(2px); }
  30% { transform: translateY(-4px) scale(1.1) rotate(-2deg) translateX(-2px); }
  40% { transform: translateY(-4px) scale(1.1) rotate(2deg) translateX(2px); }
  50% { transform: translateY(-4px) scale(1.1) rotate(-1deg) translateX(-1px); }
  60% { transform: translateY(-4px) scale(1.1) rotate(1deg) translateX(1px); }
  70% { transform: translateY(-4px) scale(1.1) rotate(-1deg); }
  80% { transform: translateY(-4px) scale(1.1) rotate(1deg); }
  100% { transform: translateY(-4px) scale(1.1) rotate(0deg); }
}

/* MATCHES */
.matches-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.matches-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.match-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.match-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.match-photo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--light);
}

.match-info {
  flex: 1;
  min-width: 0;
}

.match-name {
  font-weight: bold;
  margin-bottom: 4px;
}

.match-last-message {
  font-size: 13px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-unread {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

/* PROFILE */
.profile-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-weight: 500;
  font-size: 14px;
}

.form-group input,
.form-group textarea {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
}

.photos-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#photo-input {
  display: none;
}

.photos-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.photo-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  aspect-ratio: 1;
}

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

.photo-item .btn-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* MODALS */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  z-index: 1000;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-content {
  background: white;
  width: 100%;
  border-radius: 12px 12px 0 0;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.modal h2 {
  margin-bottom: 16px;
  padding-right: 24px;
}

.login-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 12px 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

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

.tab-content {
  display: none;
  flex-direction: column;
  gap: 12px;
}

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

/* CHAT MODAL */
.chat-modal {
  height: 80vh;
  display: flex;
  flex-direction: column;
}

.chat-profile {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.chat-profile h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message {
  display: flex;
  margin-bottom: 8px;
}

.message.sent {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  word-wrap: break-word;
}

.message.received .message-bubble {
  background: var(--light);
  color: var(--dark);
}

.message.sent .message-bubble {
  background: var(--primary);
  color: white;
}

.chat-input {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.chat-input input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 80px;
  left: 16px;
  right: 16px;
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.3s ease;
  z-index: 500;
}

.toast-btn-create, .toast-btn-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: bold;
}

/* DESKTOP LAYOUT */
body.desktop .container {
  max-width: 100%;
  height: 100vh;
}

.desktop-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  height: calc(100vh - 60px);
  padding: 20px;
}

.filters-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filters-panel h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group label {
  font-weight: 500;
  font-size: 14px;
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-options .option {
  display: flex;
  align-items: center;
  padding: 8px;
  cursor: pointer;
}

.filter-options .option input {
  margin-right: 8px;
}

.filter-group input[type="text"],
.filter-group input[type="number"],
.filter-group input[type="range"] {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
}

.feed-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.card-stack {
  width: 100%;
  height: 500px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.desktop .card {
  width: 100%;
  max-width: 400px;
  height: 500px;
}

body.desktop .swipe-controls {
  display: flex;
  justify-content: center;
  gap: 30px;
  padding: 0;
  width: 100%;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .desktop-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .filters-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

@media (max-width: 768px) {
  body.desktop .container {
    max-width: 600px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .container {
    max-width: 100%;
  }

  .card {
    height: 400px;
  }

  .onboarding-buttons {
    flex-direction: column;
  }

  .photos-list {
    grid-template-columns: repeat(2, 1fr);
  }
}
