/* ==========================================================================
   CotizaFácil - Hoja de Estilos Moderna y Responsive
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary-navy: #0f2744;
  --primary-dark: #0a192f;
  --primary-blue: #1e40af;
  --primary-accent: #2563eb;
  --accent-light: #eff6ff;
  --whatsapp-green: #25d366;
  --whatsapp-dark: #128c7e;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  
  --font-heading: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: #f8fafc;
  color: var(--slate-800);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-heading);
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Form controls styling */
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--slate-200);
  border-radius: 0.625rem;
  background-color: #ffffff;
  color: var(--slate-800);
  font-size: 0.925rem;
  transition: all 0.2s ease;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

/* Card design */
.app-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 10px 15px -3px rgba(15, 23, 42, 0.03);
  transition: box-shadow 0.2s ease;
}

.app-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-card-body {
  padding: 1.25rem;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
input:checked + .slider {
  background-color: var(--primary-accent);
}
input:checked + .slider:before {
  transform: translateX(22px);
}

/* Botones con estilo táctil */
.btn-primary {
  background: linear-gradient(135deg, #0f2744 0%, #1e3a8a 100%);
  color: #ffffff;
  font-weight: 600;
  border-radius: 0.625rem;
  padding: 0.75rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(15, 39, 68, 0.2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #173255 0%, #2563eb 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 12px -2px rgba(15, 39, 68, 0.25);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: #ffffff;
  font-weight: 600;
  border-radius: 0.625rem;
  padding: 0.75rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(37, 211, 102, 0.25);
}
.btn-whatsapp:hover {
  background: linear-gradient(135deg, #28e06c 0%, #0d6e62 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 12px -2px rgba(37, 211, 102, 0.35);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--slate-700);
  border: 1.5px solid var(--slate-200);
  font-weight: 600;
  border-radius: 0.625rem;
  padding: 0.7rem 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background-color: var(--slate-50);
  border-color: var(--slate-300);
  color: var(--slate-900);
}

/* ==========================================================================
   HOJA A4 DE COTIZACIÓN (VISTA PREVIA Y FORMATO DE IMPRESIÓN/PDF)
   ========================================================================== */

.invoice-preview-container {
  background-color: #475569;
  padding: 1.5rem;
  border-radius: 1rem;
  display: flex;
  justify-content: center;
  overflow: auto;
  max-height: calc(100vh - 120px);
}

.invoice-sheet {
  background: #ffffff;
  width: 100%;
  max-width: 210mm;
  min-height: 297mm;
  padding: 18mm 16mm 20mm 16mm;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  position: relative;
  box-sizing: border-box;
  color: #1e293b;
  font-size: 13px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
}

/* Encabezado elegante de cotización */
.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid #0f2744;
  margin-bottom: 1.25rem;
}

.inv-brand-logo {
  max-width: 150px;
  max-height: 65px;
  object-fit: contain;
}

.inv-badge-number {
  background: #0f2744;
  color: #ffffff;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.03em;
  display: inline-block;
}

/* Tablas de la cotización */
.inv-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 1rem;
  margin-bottom: 1.25rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.inv-table th {
  background-color: #0f2744;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.65rem 0.85rem;
  text-align: left;
}

.inv-table th.text-right {
  text-align: right;
}
.inv-table th.text-center {
  text-align: center;
}

.inv-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.85rem;
  vertical-align: middle;
}

.inv-table tr:nth-child(even) td {
  background-color: #f8fafc;
}

.inv-table tr:last-child td {
  border-bottom: none;
}

/* Caja de Totales */
.inv-totals-box {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  min-width: 260px;
}

.inv-total-highlight {
  background: linear-gradient(135deg, #0f2744 0%, #1e3a8a 100%);
  color: #ffffff;
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  margin-top: 0.5rem;
}

/* Estilos de datos bancarios en documento */
.inv-bank-card {
  background: #f1f5f9;
  border-left: 4px solid #0f2744;
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.8rem;
}

/* Watermark de estado si aplica */
.inv-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  font-size: 0.75rem;
  color: #64748b;
}

/* ==========================================================================
   ESTILOS DE IMPRESIÓN (PRINT A4 PERFECTO)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* Ocultar interfaz de la app en la impresión */
  .no-print, header, #section-form, .app-editor, .bottom-mobile-bar, #toast-container, #toast, .modal-backdrop, #modal-preview {
    display: none !important;
  }
  
  #section-preview {
    display: block !important;
    width: 100% !important;
    position: static !important;
  }
  
  .invoice-preview-container {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    max-height: none !important;
  }
  
  .invoice-sheet {
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    padding: 10mm 12mm !important;
    margin: 0 !important;
    page-break-after: avoid;
  }
  
  @page {
    size: A4 portrait;
    margin: 8mm;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .invoice-preview-container {
    padding: 0.5rem;
  }
  .invoice-sheet {
    padding: 12mm 8mm;
    font-size: 11.5px;
  }
  .inv-header {
    flex-direction: column;
    gap: 1rem;
  }
}

/* ==========================================================================
   SMARTPHONE FRAME & VISTA PREVIA MÓVIL (Mockup Realista)
   ========================================================================== */
.phone-case {
  position: relative;
  width: 375px;
  max-width: 95vw;
  height: 740px;
  max-height: 88vh;
  background: #0f172a;
  border-radius: 48px;
  padding: 11px;
  box-shadow: 
    0 0 0 2px #334155,
    0 0 0 5px #1e293b,
    0 25px 50px -12px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(37, 99, 235, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

/* Dynamic Island / Notch */
.phone-notch-container {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 25px;
  background: #000000;
  border-radius: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
}

.phone-camera-lens {
  width: 10px;
  height: 10px;
  background: #1e293b;
  border-radius: 50%;
  border: 1.5px solid #0f172a;
}

/* Pantalla interna */
.phone-screen {
  flex: 1;
  background: #ffffff;
  border-radius: 38px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}

/* Ocultar barra de scroll interna del teléfono pero permitir scroll */
.phone-screen::-webkit-scrollbar {
  width: 3px;
}
.phone-screen::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* Barra de estado (9:41, wifi, batería) */
.phone-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 22px 4px 22px;
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  background: #ffffff;
  z-index: 30;
}

/* Barra de navegación de safari/chrome en el teléfono */
.phone-browser-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f1f5f9;
  border-radius: 20px;
  padding: 5px 12px;
  margin: 2px 14px 8px 14px;
  font-size: 11px;
  color: #334155;
  font-weight: 500;
}

/* Wave graphic footer */
.phone-wave-bg {
  position: relative;
  width: 100%;
  height: 38px;
  overflow: hidden;
}

/* Botón flotante WhatsApp dentro del frame */
.btn-phone-whatsapp-floating {
  background: #25d366;
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  border-radius: 12px;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
  transition: all 0.2s ease;
}

.btn-phone-whatsapp-floating:hover {
  background: #20ba5a;
  transform: translateY(-1px);
}

.btn-phone-whatsapp-floating:active {
  transform: translateY(1px);
}
