/* ZPL Label Generator - Styles */

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --background: #f1f5f9;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 8px;
}

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

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

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

/* Header */
.header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
  border-radius: var(--radius);
  color: white;
  box-shadow: var(--shadow-lg);
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.header .subtitle {
  opacity: 0.9;
  font-size: 0.95rem;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

/* Top Grid - Form + Preview side by side */
.top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Main Grid - CSV + ZPL */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder {
  color: #94a3b8;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Font Config Grid */
.font-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.font-grid .form-group {
  margin-bottom: 0;
}

.font-grid input {
  text-align: center;
}

/* Font Config inside preview */
.font-config {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.font-config h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Buttons */
.button-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow);
}

.btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

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

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

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

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

.btn-small {
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* Label Preview - Design Profissional */
.label-preview-container {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: #f8fafc;
  border-radius: var(--radius);
  border: 2px dashed var(--border-color);
}

.label-preview {
  width: 400px;
  height: 320px;
  background: white;
  border: 3px solid #1e293b;
  border-radius: 4px;
  padding: 0;
  font-family: 'Arial', 'Helvetica', sans-serif;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  /* Proporção 100:80 (10cm x 8cm) */
  aspect-ratio: 100 / 80;
}

/* Header Section */
.label-header {
  display: flex;
  align-items: flex-start;
  padding: 12px 15px;
  gap: 15px;
}

.label-logo {
  width: 55px;
  height: 55px;
  background: #1e293b;
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 1px;
}

.label-company-info {
  flex: 1;
}

.company-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}

.company-detail {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.4;
}

/* Separator Line */
.label-separator {
  height: 2px;
  background: #1e293b;
  margin: 0 10px;
}

/* Product Section */
.label-product-section {
  display: flex;
  justify-content: space-between;
  padding: 12px 15px;
  gap: 10px;
}

.label-product-info {
  flex: 1;
}

.product-code {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.product-detail {
  font-size: 0.8rem;
  color: #374151;
  line-height: 1.5;
}

.label-serial-box {
  width: 90px;
  height: 70px;
  border: 2px solid #1e293b;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.serial-label {
  font-size: 0.65rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.serial-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  margin-top: 2px;
}

/* Barcode Section */
.label-barcode-section {
  padding: 10px 15px;
  display: flex;
  justify-content: center;
  background: #fafafa;
}

.label-barcode-section svg {
  max-width: 100%;
  height: auto;
}

/* Footer Section */
.label-footer-simple {
  border-top: 2px solid #1e293b;
  padding: 8px 15px;
}

.ref-item {
  font-size: 0.75rem;
  color: #374151;
  line-height: 1.6;
  font-weight: 500;
}

/* Export Buttons */
.export-buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  justify-content: center;
}

.csv-export-buttons {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.csv-export-buttons .btn {
  flex: 1;
}

/* CSV Section */
.info-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-family: monospace;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 4px;
  word-break: break-all;
}

.file-upload {
  margin-bottom: 16px;
}

.file-upload input[type="file"] {
  display: none;
}

.file-upload label {
  display: inline-block;
  cursor: pointer;
}

.csv-info {
  font-size: 0.9rem;
  color: var(--success-color);
  margin-bottom: 12px;
  min-height: 20px;
}

.csv-navigation {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.csv-navigation span {
  font-weight: 500;
  color: var(--text-secondary);
}

/* ZPL Section */
.zpl-container {
  background: #1e293b;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  max-height: 250px;
  overflow: auto;
}

.zpl-container pre {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

/* Log Section */
.log-section {
  margin-bottom: 20px;
}

.status-log {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px;
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.log-entry {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.log-entry:last-child {
  margin-bottom: 0;
}

.log-entry.info {
  background: #e0f2fe;
  color: #0369a1;
}

.log-entry.success {
  background: #dcfce7;
  color: #15803d;
}

.log-entry.error {
  background: #fee2e2;
  color: #b91c1c;
}

.log-entry.warning {
  background: #fef3c7;
  color: #b45309;
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .top-grid,
  .main-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .container {
    padding: 12px;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .card {
    padding: 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

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

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

  .btn {
    width: 100%;
  }

  .label-preview {
    padding: 12px 15px;
  }

  .label-code {
    font-size: 1.2rem;
  }

  .label-field {
    font-size: 0.75rem;
  }

  .label-row {
    flex-direction: column;
    gap: 4px;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}
