/* Free SOAP Note Generator - Tool-specific Styles */

.tool-page {
  padding-top: 20px;
  min-height: 100vh;
}

.tool-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

/* Screen Management */
.tool-screen {
  display: none;
}
.tool-screen.active {
  display: block;
}

/* Header */
.tool-header {
  text-align: center;
  margin-bottom: 32px;
}
.tool-header h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 8px;
}
.tool-subtitle {
  font-size: 16px;
  color: #6B7280;
}

/* Form Elements */
.tool-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}
.form-row {
  display: flex;
  gap: 16px;
}
.form-group-half {
  flex: 1;
}
.custom-input {
  margin-top: 8px;
}

textarea, select, input[type="email"], input[type="text"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: #1F2937;
  background: #fff;
  transition: border-color 0.2s;
}
textarea:focus, select:focus, input:focus {
  outline: none;
  border-color: #5B9BD5;
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.1);
}
textarea {
  resize: vertical;
  line-height: 1.6;
}

/* Buttons */
.btn-primary {
  background: #5B9BD5;
  color: #fff;
  border: none;
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-primary:hover {
  background: #4A89C4;
}
.btn-full {
  width: 100%;
}
.btn-secondary {
  background: #F3F4F6;
  color: #374151;
  border: 1px solid #D1D5DB;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-secondary:hover {
  background: #E5E7EB;
}
.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}
.btn-back {
  background: none;
  border: none;
  color: #5B9BD5;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
}
.btn-back:hover {
  color: #4A89C4;
}
.btn-add-section {
  width: 100%;
  padding: 12px;
  border: 2px dashed #D1D5DB;
  border-radius: 8px;
  background: transparent;
  color: #5B9BD5;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin: 12px 0 20px;
  transition: border-color 0.2s, color 0.2s;
}
.btn-add-section:hover {
  border-color: #5B9BD5;
}

/* Usage Indicator */
.usage-indicator {
  text-align: center;
  padding: 12px;
  font-size: 13px;
  color: #6B7280;
}

/* Template Builder */
.template-builder-section {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid #E5E7EB;
}
.template-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.template-builder-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  margin: 0;
}
.template-builder-hint {
  font-size: 12px;
  color: #9CA3AF;
}
.template-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.template-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1F2937;
}
.visit-summary-preview {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #6B7280;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.visit-summary-preview strong {
  color: #374151;
}

/* Template Section Items */
.template-sections {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.template-section-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  cursor: grab;
  transition: box-shadow 0.2s;
}
.template-section-item:hover {
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.template-section-item.dragging {
  opacity: 0.5;
}
.section-drag-handle {
  color: #9CA3AF;
  font-size: 18px;
  cursor: grab;
  user-select: none;
}
.section-toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #D1D5DB;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.section-toggle:checked {
  background: #5B9BD5;
  border-color: #5B9BD5;
}
.section-toggle:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 45%;
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}
.section-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}
.section-meta {
  font-size: 12px;
  color: #9CA3AF;
}
.section-edit-btn {
  background: none;
  border: none;
  color: #9CA3AF;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}
.section-edit-btn:hover {
  color: #5B9BD5;
}

/* Loading Screen */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  padding: 40px 20px;
}
.loading-spinner-ring {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 24px;
}
.loading-spinner-ring svg {
  animation: spin 2s linear infinite;
}
.loading-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
}
.loading-title {
  font-size: 22px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 8px;
}
.loading-subtitle {
  font-size: 14px;
  color: #9CA3AF;
  margin-bottom: 24px;
}
.quote-container {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 24px 20px;
  max-width: 500px;
  transition: opacity 0.3s;
}
.quote-text {
  font-size: 16px;
  color: #374151;
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 8px;
}
.quote-author {
  font-size: 13px;
  color: #9CA3AF;
  font-weight: 500;
}
.quote-fade-out {
  opacity: 0.3;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Results Screen */
.results-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.results-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1F2937;
}
.results-info {
  background: #E8F2FA;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
  font-weight: 500;
  margin-bottom: 16px;
}
.results-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.btn-action {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #F3F4F6;
  border: 1px solid #D1D5DB;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-action:hover {
  background: #E5E7EB;
}
.btn-action.copied {
  background: #D1FAE5;
  border-color: #10B981;
  color: #065F46;
}

/* Email & Regenerate Input Containers */
.email-input-container, .regenerate-input-container {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}
.email-input {
  margin-bottom: 8px;
}
.email-actions, .regenerate-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Result Sections */
.result-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.note-section {
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.note-section-header {
  display: flex;
  align-items: center;
  padding: 12px;
  background: #F9FAFB;
  cursor: pointer;
  user-select: none;
}
.note-section-header .section-toggle-arrow {
  margin-right: 8px;
  color: #9CA3AF;
  font-size: 12px;
  transition: transform 0.2s;
}
.note-section.expanded .section-toggle-arrow {
  transform: rotate(90deg);
}
.note-section-header .section-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}
.section-actions {
  display: flex;
  gap: 4px;
}
.section-action-btn {
  background: none;
  border: none;
  color: #9CA3AF;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}
.section-action-btn:hover {
  color: #5B9BD5;
  background: #E8F2FA;
}
.section-action-btn.copied {
  color: #10B981;
}
.note-section-content {
  padding: 12px;
  display: none;
}
.note-section.expanded .note-section-content {
  display: block;
}
.section-text {
  font-size: 14px;
  line-height: 1.7;
  color: #374151;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 8px;
  min-height: 60px;
  outline: none;
  transition: border-color 0.2s;
}
.section-text:focus {
  border-color: #5B9BD5;
}
.section-regenerate-input {
  display: none;
  margin-top: 8px;
}
.section-regenerate-input.active {
  display: block;
}
.section-regenerate-input textarea {
  font-size: 13px;
  margin-bottom: 8px;
}
.btn-do-regenerate {
  background: #5B9BD5;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* Results Footer */
.results-footer {
  margin-top: 24px;
}
.upsell-box {
  background: linear-gradient(135deg, #E8F2FA, #F5F9FD);
  border: 1px solid #D1E5F4;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin-top: 16px;
}
.upsell-text {
  font-size: 16px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 12px;
}

/* Limit Reached Screen */
.limit-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 20px;
}
.limit-icon {
  margin-bottom: 20px;
}
.limit-container h2 {
  font-size: 24px;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 12px;
}
.limit-message {
  font-size: 15px;
  color: #6B7280;
  margin-bottom: 12px;
}
.limit-container .btn-primary {
  margin: 20px 0;
  max-width: 400px;
}
.limit-features {
  list-style: none;
  text-align: left;
  margin-top: 16px;
}
.limit-features li {
  padding: 6px 0;
  font-size: 14px;
  color: #374151;
}
.limit-features li::before {
  content: "\2713 ";
  color: #10B981;
  font-weight: 700;
  margin-right: 8px;
}

/* Edit Section Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 16px;
}
.modal-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-row .form-group {
  flex: 1;
}
.modal-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}
.btn-danger {
  background: none;
  border: none;
  color: #EF4444;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
}
.btn-danger:hover {
  color: #DC2626;
}

/* Add Section Modal */
.add-section-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
  max-height: 200px;
  overflow-y: auto;
}
.add-section-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.add-section-option:hover {
  background: #F3F4F6;
}
.add-section-divider {
  text-align: center;
  color: #9CA3AF;
  font-size: 13px;
  margin: 12px 0;
}

/* SEO Content Section */
.seo-content {
  background: #F9FAFB;
  padding: 60px 16px;
  margin-top: 40px;
}
.seo-container {
  max-width: 800px;
  margin: 0 auto;
}
.seo-content h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 24px;
  text-align: center;
}
.seo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 48px;
}
.seo-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 24px;
}
.seo-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 8px;
}
.seo-card p {
  font-size: 14px;
  color: #6B7280;
  line-height: 1.6;
}
.seo-text {
  margin-top: 16px;
  margin-bottom: 48px;
  padding: 24px 28px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
}
.seo-text h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 10px;
}
.seo-text p {
  font-size: 14px;
  color: #6B7280;
  line-height: 1.7;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1F2937;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  transition: transform 0.3s;
  white-space: nowrap;
}
.toast.visible {
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 640px) {
  .tool-header h1 { font-size: 24px; }
  .form-row { flex-direction: column; gap: 12px; }
  .seo-grid { grid-template-columns: 1fr; }
  .results-actions { flex-direction: column; }
  .btn-action { justify-content: center; }
}
