/* Broadband Label Maker Styles */

* {
  box-sizing: border-box;
}

body {
  background: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  margin: 0;
}

.app-header {
  text-align: center;
  margin-bottom: 2rem;
}

.app-title {
  font-size: 2.5rem;
  color: #333;
  margin: 0 0 0.5rem 0;
}

.app-subtitle {
  color: #666;
  font-size: 1.1rem;
  margin: 0 0 2rem 0;
}

.control-panel {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 1.5rem;
  margin-bottom: 2rem;
  max-width: 800px;
  margin: 0 auto 2rem;
}

.control-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.control-row:last-child {
  margin-bottom: 0;
}

.export-btn {
  background: #007cba;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 4px;
  font-weight: 500;
  transition: background 0.2s;
  flex: 1;
  min-width: 150px;
}

.export-btn:hover {
  background: #005a8b;
}

.export-btn:disabled,
.template-btn:disabled,
.clear-btn:disabled {
  background: #ccc !important;
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

.export-btn.secondary {
  background: #6c757d;
}

.export-btn.secondary:hover {
  background: #545b62;
}

.template-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 4px;
  font-weight: 500;
  transition: background 0.2s;
  flex: 1;
  min-width: 150px;
}

.template-btn:hover {
  background: #218838;
}

.clear-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 4px;
  font-weight: 500;
  transition: background 0.2s;
  flex: 1;
  min-width: 150px;
}

.clear-btn:hover {
  background: #c82333;
}

/* Main Label Styles - Frontend Rendering */
.broadband-label-container {
  max-width: 650px;
  margin: 0 auto;
  background: white;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  border-radius: 0px;
  overflow: hidden;
  page-break-inside: avoid; /* For printing */
  container-type: inline-size; /* Enable container queries */
}

.broadband-label {
  border: 4px solid black;
  background: white;
  padding: 0;
  font-family: Arial, sans-serif;
  font-size: clamp(0.875rem, 2.5cqw, 1rem); /* Responsive base font size - container based */
}

.broadband-label-header {
  background: black;
  color: white;
  padding: 1rem;
  text-align: center;
}

.broadband-label-title {
  font-size: clamp(1.5rem, 4cqw, 1.8rem); /* Responsive title - container based */
  font-weight: bold;
  margin: 0;
  text-decoration: underline;
}

.broadband-provider-info {
  padding: 0.75rem 1rem;
  line-height: 1.4;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.broadband-label-section,
.broadband-label section {
  border-top: 4px solid black;
  padding: 1rem;
}

.broadband-section-header,
.broadband-label h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  color: black;
  padding: 0.5rem 0;
  margin: -1rem 0 1rem 0;
  font-weight: bold;
  font-size: clamp(1rem, 2.5cqw, 1.1rem); /* Responsive section header - container based */
  border-bottom: 2px solid black;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.broadband-monthly-price {
  font-size: clamp(1.25rem, 3.5cqw, 1.5rem); /* Responsive price - container based */
  font-weight: bold;
}

.broadband-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  font-size: clamp(0.8rem, 2cqw, 0.9rem); /* Responsive row text - container based */
  border-bottom: 1px solid #ddd;
  gap: 0.5rem;
}

.broadband-row:last-child {
  border-bottom: none;
}

.broadband-row-label {
  flex: 1;
  margin-right: 1rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.broadband-row-value {
  text-align: right;
  min-width: 100px;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  max-width: 60%;
}

.broadband-row-value a {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-all;
  hyphens: auto;
}

.broadband-fee-group {
  margin: 1rem 0;
}

.broadband-fee-group-title {
  font-weight: bold;
  margin-bottom: 0.5rem;
  padding-left: 1rem;
  font-size: clamp(0.85rem, 2cqw, 0.9rem); /* Container based */
}

.broadband-fee-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 2rem;
  font-size: clamp(0.8rem, 2cqw, 0.9rem); /* Container based */
  gap: 0.5rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.broadband-speeds-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-size: clamp(0.8rem, 2cqw, 0.9rem); /* Container based */
}

.broadband-footer-info {
  padding: 1rem;
  font-size: clamp(0.75rem, 2cqw, 0.85rem); /* Container based */
  background: #f8f8f8;
  border-top: 1px solid #ddd;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.broadband-footer-link {
  color: #007cba;
  text-decoration: none;
  font-weight: bold;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-all;
  hyphens: auto;
  display: inline-block;
  max-width: 100%;
}

.broadband-footer-link:hover {
  text-decoration: underline;
}

.broadband-plan-id {
  font-family: monospace;
  font-size: clamp(0.7rem, 1.8cqw, 0.8rem); /* Container based */
  margin-top: 0.5rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-all;
}

/* Admin Editor Styles */
.label-container {
  max-width: 650px;
  margin: 0 auto;
  background: white;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  border-radius: 0px;
  overflow: hidden;
}

.label {
  border: 4px solid black;
  background: white;
  padding: 0;
  font-family: Arial, sans-serif;
}

.label .header {
  background: black;
  color: white;
  padding: 1rem;
  text-align: center;
}

.label .label-title {
  font-size: 1.8rem;
  font-weight: bold;
  color:#fff;
  margin: 0;
  text-decoration: underline;
}

.label .provider-info {
  padding: 0.75rem 1rem;
  line-height: 1.4;
}

.label .section {
  border-top: 4px solid black;
  padding: 1rem;
}

.label .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  color: black;
  padding: 0.5rem 0;
  margin: -1rem 0 1rem 0;
  font-weight: bold;
  font-size: 1.1rem;
  border-bottom: 2px solid black;
}

.label .monthly-price {
  font-size: 1.5rem;
  font-weight: bold;
}

.label .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid #ddd;
}

.label .row:last-child {
  border-bottom: none;
}

.label .row-label {
  flex: 1;
  margin-right: 1rem;
}

.label .row-value {
  text-align: right;
  min-width: 100px;
}

.label .fee-group {
  margin: 1rem 0;
}

.label .fee-group-title {
  font-weight: bold;
  margin-bottom: 0.5rem;
  padding-left: 1rem;
}

.label .fee-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 2rem;
  font-size: 0.9rem;
}

.add-fee-btn {
  background: #007cba;
  color: white;
  border: none;
  padding: 0.3rem 0.8rem;
  margin: 0.5rem 2rem;
  cursor: pointer;
  font-size: 0.8rem;
  border-radius: 3px;
  transition: background 0.2s;
}

.add-fee-btn:hover {
  background: #005a8b;
}

.remove-fee-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 0.2rem 0.5rem;
  margin-left: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  border-radius: 3px;
  transition: background 0.2s;
}

.remove-fee-btn:hover {
  background: #c82333;
}

.inline-input {
  font: inherit;
  padding: 2px 6px;
  border: 1px solid #ccc;
  border-radius: 2px;
  background: white;
  transition: border-color 0.2s;
}

.inline-input:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.price-input {
  text-align: right;
  width: 80px;
}

.editable-text {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
  min-height: 1.2em;
  display: inline-block;
  min-width: 50px;
  transition: background 0.2s;
}

.editable-text:hover {
  background-color: #e3f2fd;
}

.editable-text.placeholder {
  color: #888;
  font-style: italic;
}

/* Notification styles */
.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  background: #28a745;
  color: white;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-weight: 500;
  animation: slideIn 0.3s ease-out;
  z-index: 9999;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* List view styles */
.label-list-container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  padding: 1rem;
  border-radius: 0px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.label-list-container table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.label-list-container th {
  text-align: left;
  padding: 12px;
  background: #000 !important;
  color: #fff !important;
  font-weight: 600;
  border-bottom: 2px solid #ddd;
  white-space: nowrap;
}

.label-list-container td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  background: #fff !important;
  color: #000 !important;
  vertical-align: middle;
}

/* Column widths */
.label-list-container th:nth-child(1),
.label-list-container td:nth-child(1) {
  width: 15%;
}

.label-list-container th:nth-child(2),
.label-list-container td:nth-child(2) {
  width: 15%;
}

.label-list-container th:nth-child(3),
.label-list-container td:nth-child(3) {
  width: 8%;
}

.label-list-container th:nth-child(4),
.label-list-container td:nth-child(4) {
  width: 10%;
}

.label-list-container th:nth-child(5),
.label-list-container td:nth-child(5) {
  width: 13%;
}

.label-list-container th:nth-child(6),
.label-list-container td:nth-child(6) {
  width: 13%;
}

.label-list-container th:nth-child(7),
.label-list-container td:nth-child(7) {
  width: 26%;
}

.label-list-container tr:hover {
  background: #f9f9f9;
}

.label-list-container code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.85em;
  word-break: break-all;
  display: inline-block;
  max-width: 100%;
  line-height: 1.4;
}

.label-list-container .button {
  margin-right: 4px;
  margin-bottom: 4px;
  white-space: nowrap;
  font-size: 0.85em;
  padding: 4px 8px;
}

.label-list-container .button-link-delete {
  color: #dc3545;
}

.label-list-container .button-link-delete:hover {
  color: #c82333;
}

.label-list-container td {
  white-space: nowrap;
}

.label-list-container td:first-child {
  white-space: normal;
  word-wrap: break-word;
}

.label-list-container td:nth-child(2) {
  white-space: normal;
}

/* Actions column - allow wrapping */
.label-list-container td:nth-child(7) {
  white-space: normal;
  line-height: 1.8;
}

.speeds-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

/* Print styles */
/* Print Styles - Fixed sizes for consistent printing */
@media print {
  .broadband-label-container {
    box-shadow: none;
  }
  
  .broadband-label {
    border: 3px solid black;
    font-size: 10pt !important; /* Fixed size for print */
  }
  
  .broadband-label-section {
    border-top: 3px solid black;
    padding: 10px;
  }

  .broadband-label-title {
    font-size: 18pt !important;
  }

  .broadband-section-header {
    font-size: 11pt !important;
  }

  .broadband-monthly-price {
    font-size: 14pt !important;
  }

  .broadband-row {
    font-size: 9pt !important;
  }

  .broadband-fee-item,
  .broadband-fee-group-title {
    font-size: 9pt !important;
  }

  .broadband-footer-info {
    font-size: 8pt !important;
  }

  .broadband-plan-id {
    font-size: 8pt !important;
  }

  /* Ensure links break properly when printed */
  .broadband-footer-link,
  .broadband-row-value a {
    word-break: break-all;
  }
}

/* ============================================
   DESIGN MODE STYLES
   ============================================ */

.design-mode-btn {
  background: #6f42c1;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 4px;
  font-weight: 500;
  transition: background 0.2s;
  flex: 1;
  min-width: 150px;
}

.design-mode-btn:hover {
  background: #5a32a3;
}

.design-mode-btn.active {
  background: #5a32a3;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.design-mode-hint {
  text-align: center;
  padding: 1rem;
  background: #f8f4ff;
  border: 2px dashed #6f42c1;
  border-radius: 8px;
  margin: 1rem auto;
  max-width: 800px;
  color: #6f42c1;
  font-weight: 500;
}

/* Design Mode Active - Designable Elements */
.design-mode .designable-element {
  position: relative;
  transition: outline 0.2s;
  cursor: pointer;
}

.design-mode .designable-element:hover {
  outline: 2px dashed #6f42c1;
  outline-offset: 2px;
}

.design-mode .designable-element.selected {
  outline: 3px solid #6f42c1;
  outline-offset: 2px;
}

/* Disable editing of editable elements when in design mode */
.design-mode .editable-text,
.design-mode .inline-input,
.design-mode input,
.design-mode select,
.design-mode textarea {
  pointer-events: none;
  user-select: none;
}

/* Design Toolbar */
.design-toolbar {
  position: fixed;
  background: white;
  border: 2px solid #6f42c1;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 10000;
  min-width: 320px;
  max-width: 400px;
  font-size: 0.9rem;
  max-height: 80vh;
  overflow-y: auto;
}

.design-toolbar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  color: #6f42c1;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0d4f7;
  font-size: 0.95rem;
}

.toolbar-close-btn {
  background: transparent;
  border: none;
  color: #6f42c1;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.toolbar-close-btn:hover {
  background: #e0d4f7;
}

.design-control {
  margin-bottom: 12px;
}

.design-control:last-child {
  margin-bottom: 0;
}

.design-control-label {
  display: block;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 4px;
  font-weight: 500;
}

.design-control-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
}

.design-control-input:focus {
  outline: none;
  border-color: #6f42c1;
  box-shadow: 0 0 0 2px rgba(111, 66, 193, 0.1);
}

.design-control-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  background: white;
}

.design-control-select:focus {
  outline: none;
  border-color: #6f42c1;
  box-shadow: 0 0 0 2px rgba(111, 66, 193, 0.1);
}

.design-control-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.color-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-preview {
  width: 30px;
  height: 30px;
  border: 2px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
}

.color-text-input {
  flex: 1;
}

/* Provider Settings Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  max-height: 90vh;
  overflow-y: auto;
  width: 90%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #ddd;
}

.modal-body {
  padding: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: #333;
}

.form-group input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

.form-group input:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

/* Section Visibility Toggle */
.section-visibility-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.section-visibility-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.section-visibility-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.visibility-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.hidden-badge {
  font-size: 0.75rem;
  color: #dc3545;
  font-weight: normal;
  padding: 0.15rem 0.4rem;
  background: #fff3cd;
  border-radius: 3px;
  border: 1px solid #ffc107;
}


