/* ===== GOOGLE FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
  /* Colores principales */
  --primary-color: #1a1a2e;
  --primary-hover: #16213e;
  --accent-color: #e94560;
  --accent-hover: #d63d56;
  
  /* Colores de estado */
  --success-color: #10b981;
  --success-light: #d1fae5;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  
  /* Neutrales */
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;
  --border-focus: #1a1a2e;
  
  /* Fondos */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-light: #f1f5f9;
  --bg-input: #ffffff;
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  
  /* Tipografía */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Espaciado */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  
  /* Bordes */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Transiciones */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== CONTAINER ===== */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* ===== HEADER ===== */
.main-header {
  background: linear-gradient(135deg, var(--bg-card) 0%, #fafafa 100%);
  box-shadow: var(--shadow-md);
  padding: var(--spacing-lg) 0;
  margin-bottom: var(--spacing-xl);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
}

.main-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
}

.logo {
  max-height: 55px;
  transition: transform var(--transition-normal);
}

.logo:hover {
  transform: scale(1.02);
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, var(--accent-color) 0%, var(--primary-color) 100%);
  border-radius: var(--radius-full);
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--spacing-lg);
  border: 1px solid var(--border-color);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* ===== FORMULARIOS ===== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.form-group {
  margin-bottom: var(--spacing-md);
}

label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.form-group:focus-within label {
  color: var(--primary-color);
}

.required {
  color: var(--accent-color);
  margin-left: 2px;
}

/* ===== INPUTS ===== */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: var(--font-family);
  background-color: var(--bg-input);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
}

input::placeholder,
select::placeholder {
  color: var(--text-muted);
}

input:hover,
select:hover {
  border-color: #d1d5db;
}

input:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(26, 26, 46, 0.1);
}

input:invalid:not(:placeholder-shown) {
  border-color: var(--error-color);
}

/* Input de precio especial */
.input-precio {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ===== WHATSAPP CONTROL ===== */
.whatsapp-control {
  display: flex;
  flex-direction: column;
}

.checkbox-wrapper {
  margin-top: var(--spacing-sm);
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: var(--spacing-sm);
  accent-color: var(--primary-color);
  cursor: pointer;
}

.checkbox-wrapper label {
  margin: 0;
  cursor: pointer;
  font-weight: 400;
}

/* ===== SELECTOR DE SERVICIOS ===== */
.service-selector {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  background: linear-gradient(135deg, var(--bg-light) 0%, #eef2f7 100%);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  align-items: flex-end;
  border: 1px solid var(--border-color);
}

.service-selector label {
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.service-selector .form-group-inline {
  flex: 1;
  margin: 0;
}

.service-selector select {
  flex-grow: 1;
}

/* ===== TABLA DE SERVICIOS ===== */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.services-table {
  width: 100%;
  border-collapse: collapse;
}

.services-table th,
.services-table td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.services-table th {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.services-table th:first-child {
  border-top-left-radius: var(--radius-md);
}

.services-table th:last-child {
  border-top-right-radius: var(--radius-md);
}

.services-table tbody tr {
  transition: background-color var(--transition-fast);
}

.services-table tbody tr:hover {
  background-color: var(--bg-light);
}

.services-table tbody tr:last-child td {
  border-bottom: none;
}

.services-table input {
  width: 100%;
  padding: 8px 12px;
  text-align: right;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.services-table input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.1);
  outline: none;
}

/* ===== BOTONES ===== */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-family);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(26, 26, 46, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(26, 26, 46, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  color: white;
  box-shadow: 0 2px 8px 0 rgba(71, 85, 105, 0.3);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px 0 rgba(71, 85, 105, 0.4);
}

.btn-remove {
  background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
  color: white;
  padding: 8px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px 0 rgba(239, 68, 68, 0.3);
}

.btn-remove:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px 0 rgba(239, 68, 68, 0.4);
}

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-outline:hover {
  background-color: var(--primary-color);
  color: white;
}

.btn-large {
  width: 100%;
  padding: 16px 24px;
  font-size: 1.05rem;
}

/* ===== ESTADOS ===== */
.hidden {
  display: none !important;
}

.empty-state {
  text-align: center;
  padding: var(--spacing-2xl) var(--spacing-lg);
  color: var(--text-muted);
  background: linear-gradient(135deg, #fafafa 0%, var(--bg-light) 100%);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
}

.empty-state::before {
  content: '📋';
  display: block;
  font-size: 2.5rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.6;
}

/* ===== RESULTADO ===== */
.result-card {
  text-align: center;
  border: none;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-left: 5px solid var(--success-color);
  animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.success-message {
  margin-bottom: var(--spacing-lg);
}

.success-message h3 {
  color: var(--success-color);
  font-size: 1.3rem;
  margin-bottom: var(--spacing-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

.success-message h3::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--success-color);
  color: white;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: bold;
}

.success-message p {
  color: var(--text-secondary);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: var(--spacing-lg);
}

.result-actions .btn-primary {
  background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.4);
}

.result-actions .btn-primary:hover {
  box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.5);
}

/* ===== ACCIONES DEL FORMULARIO ===== */
.actions {
  margin-top: var(--spacing-md);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--spacing-md);
  }
  
  .main-header .container {
    flex-direction: column;
    gap: var(--spacing-md);
    text-align: center;
  }
  
  h1 {
    font-size: 1.2rem;
  }
  
  .grid-2 {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
  
  .card {
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
  }
  
  .service-selector {
    flex-direction: column;
    align-items: stretch;
  }
  
  .service-selector button {
    width: 100%;
  }
  
  .services-table th,
  .services-table td {
    padding: var(--spacing-sm);
    font-size: 0.85rem;
  }
  
  .result-actions {
    flex-direction: column;
  }
  
  .result-actions .btn {
    width: 100%;
  }
}

/* ===== ANIMACIONES DE CARGA ===== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  animation: pulse 1.5s ease-in-out infinite;
}

/* ===== FOOTER MINIMAL ===== */
main.container {
  padding-bottom: var(--spacing-2xl);
}

/* ===== SCROLL PERSONALIZADO ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-light);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ===== SELECCIÓN DE TEXTO ===== */
::selection {
  background: var(--accent-color);
  color: white;
}
