* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f9fafb;
  color: #374151;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  text-align: center;
  margin-bottom: 40px;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: bold;
  color: #1f2937;
  margin-bottom: 8px;
}

.header p {
  color: #6b7280;
  font-size: 1.1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.card-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}

.card-header p {
  color: #6b7280;
  font-size: 0.875rem;
}

.card-content {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
  font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.item-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .item-form {
    grid-template-columns: 1fr;
  }
}

/* Estilos para la sección de imágenes */
.images-section {
  margin: 24px 0;
  padding: 20px;
  background-color: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.images-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 8px;
}

.image-instructions {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 16px;
}

.images-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.image-upload-area {
  position: relative;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-upload-area:hover {
  border-color: #3b82f6;
  background-color: #f8fafc;
}

.image-upload-area.has-image {
  border-color: #10b981;
  background-color: #f0fdf4;
}

.image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #6b7280;
}

.image-placeholder span {
  font-size: 2rem;
}

.image-placeholder p {
  font-weight: 500;
  margin: 0;
}

.image-placeholder small {
  font-size: 0.75rem;
  color: #9ca3af;
}

.image-preview {
  max-width: 100%;
  max-height: 120px;
  border-radius: 4px;
  object-fit: cover;
}

.remove-image {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-image:hover {
  background: #dc2626;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background-color: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background-color: #2563eb;
}

.btn-success {
  background-color: #10b981;
  color: white;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-outline {
  background-color: white;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-outline:hover {
  background-color: #f9fafb;
}

.btn-large {
  padding: 16px 32px;
  font-size: 1rem;
}

.btn-danger {
  background-color: #ef4444;
  color: white;
  padding: 6px 8px;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.table-container {
  overflow-x: auto;
  margin-bottom: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

th {
  background-color: #f9fafb;
  font-weight: 600;
  color: #374151;
}

td {
  color: #6b7280;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.text-red {
  color: #ef4444;
}

/* Estilos para las imágenes en la tabla */
.item-images {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 220px;
  text-align: center;
}

.item-image-thumb {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
}

.items-table .item-description {
  width: 28%;
}

/* Totales */
.totals-section {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.totals-table-professional {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 300px;
}

.totals-table-professional td {
  padding: 8px 12px;
  border: 1px solid #cbd5e0;
}

.totals-table-professional .total-label {
  background: #f7fafc;
  font-weight: bold;
  text-align: right;
}

.totals-table-professional .total-amount {
  text-align: right;
  font-weight: bold;
}

.totals-table-professional .final-total {
  background: #4a5568;
  color: white;
  font-weight: bold;
  font-size: 14px;
}

/* Condiciones */
.conditions-section {
  margin-top: 30px;
  font-size: 11px;
}

.conditions-title {
  font-weight: bold;
  margin-bottom: 10px;
  color: #2d3748;
}

.conditions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.conditions-item {
  margin-bottom: 5px;
}

.conditions-item strong {
  color: #2d3748;
}

.config-note {
  color: #374151;
  font-size: 0.875rem;
  margin-top: 0;
  padding: 16px;
  background-color: #f9fafb;
  border-radius: 6px;
  border-left: 3px solid #3b82f6;
  line-height: 1.6;
}

.config-note strong {
  color: #1f2937;
}

#numero-display {
  font-family: monospace;
  font-weight: 600;
  color: #1f2937;
}

.btn-edit {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  color: #3b82f6;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background-color 0.2s;
}

.btn-edit:hover {
  background-color: #f3f4f6;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.numero-edit-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.numero-edit-container input {
  flex: 1;
}

/* Print Styles */
@media print {
  body {
    background: white;
  }

  .preview-header {
    display: none;
  }

  .cotizacion-document {
    box-shadow: none;
    padding: 0;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .professional-header {
    flex-direction: column;
    gap: 20px;
  }

  .company-logo-section {
    justify-content: center;
  }

  .quote-info-box {
    align-self: center;
  }

  .conditions-grid {
    grid-template-columns: 1fr;
  }

  .cotizacion-document {
    padding: 15px;
  }

  .preview-header {
    flex-direction: column;
    gap: 16px;
  }

  .images-container {
    grid-template-columns: 1fr;
  }
}
