.tool-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.tool-header {
  text-align: center;
  margin-bottom: 3rem;
}

.tool-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: #03396c;
  margin-bottom: 1rem;
}

.tool-description {
  font-size: 1.1rem;
  color: #495057;
  max-width: 700px;
  margin: 0 auto;
}

.card {
  background: #f0f9ff;
  border-radius: 15px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(0, 119, 182, 0.1);
}

.card h2 {
  color: #03396c;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.tool-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  color: #03396c;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.form-control {
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
  width: 100%;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: #0077b6;
  box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.color-picker {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.color-picker input[type="color"] {
  width: 60px;
  height: 45px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.color-picker input[type="color"]:hover {
  border-color: #0077b6;
  transform: scale(1.05);
}

.color-picker input[type="text"] {
  flex: 1;
}

.file-upload-wrapper {
  position: relative;
}

.file-input {
  display: none;
}

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #0077b6 0%, #00a8e8 100%);
  color: white;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
}

.file-label:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 119, 182, 0.3);
}

.btn-primary, .btn-secondary, .btn-success {
  padding: 1rem 2rem;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
}

.btn-primary {
  background: linear-gradient(135deg, #0077b6 0%, #00a8e8 100%);
  color: white;
  width: 100%;
  justify-content: center;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 119, 182, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

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

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(40, 167, 69, 0.4);
}

.qrcode-display {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem;
  background: white;
  border-radius: 10px;
}

.download-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.alert {
  padding: 1rem 1.5rem;
  border-radius: 10px;
  margin-top: 1rem;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .tool-header h1 {
    font-size: 2rem;
  }
  
  .download-actions {
    flex-direction: column;
  }
  
  .btn-primary, .btn-secondary, .btn-success {
    width: 100%;
    justify-content: center;
  }
}

/* Editor fixed height + vertical scrollbar */
#editor {
  height: 400px;
  max-height: 400px;
}

#editor .ql-editor {
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
}

.font-family-select {
  padding: 0.5rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  font-size: 0.95rem;
}

/* Prevent long font names from breaking layout */
.ql-font {
  /* keep for backward compatibility but target the picker specifically below */
}

/* Hide the raw <select class="ql-font"> that Quill transforms into a styled picker */
select.ql-font {
  display: none !important;
}

/* Style Quill's generated picker for fonts so it aligns with toolbar buttons */
.ql-toolbar .ql-picker.ql-font,
.ql-picker.ql-font {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  height: 36px;
  display: inline-block;
  vertical-align: middle;
  margin: 0 6px;
  box-sizing: border-box;
}

.ql-picker-label {
  line-height: 36px;
}

/* Fix alignment of font select inside Quill toolbar */
#toolbar .font-family-select,
.ql-toolbar .font-family-select,
.ql-toolbar .ql-font {
  height: 36px !important;
  line-height: 1.1 !important;
  display: inline-block !important;
  vertical-align: middle !important;
  margin: 0 6px !important;
  padding: 6px 8px !important;
  box-sizing: border-box !important;
}

/* Ensure the toolbar doesn't push the select down */
.ql-toolbar button,
.ql-toolbar select {
  vertical-align: middle;
}

/* Blockquote styling for editor view */
#editor .ql-editor blockquote,
.ql-editor blockquote {
  border-left: 6px solid #0077b6;
  margin: 1rem 0;
  padding: 0.6rem 1rem 0.6rem 1rem;
  color: #03396c;
  background: rgba(0,119,182,0.03);
  position: relative;
  font-style: italic;
}

#editor .ql-editor blockquote:before,
.ql-editor blockquote:before {
  content: "“";
  font-size: 3.2rem;
  position: absolute;
  left: 8px;
  top: -12px;
  color: rgba(0,119,182,0.12);
  font-family: Georgia, serif;
}

#editor .ql-editor img { max-width: 100%; height: auto; }

/* Map Quill font classes to actual font-families inside editor */
#editor .ql-editor .ql-font-arial { font-family: Arial, Helvetica, sans-serif; }
#editor .ql-editor .ql-font-helvetica { font-family: Helvetica, Arial, sans-serif; }
#editor .ql-editor .ql-font-times-new-roman { font-family: 'Times New Roman', Times, serif; }
#editor .ql-editor .ql-font-georgia { font-family: Georgia, serif; }
#editor .ql-editor .ql-font-courier-new { font-family: 'Courier New', Courier, monospace; }
#editor .ql-editor .ql-font-trebuchet-ms { font-family: 'Trebuchet MS', Helvetica, sans-serif; }
#editor .ql-editor .ql-font-verdana { font-family: Verdana, Geneva, sans-serif; }
