﻿/* ============================================================================
   SOURCEBOT — App Component Styles v3
   Bold Decorative Design — steps, fieldsets, companies, progress, email
   ============================================================================ */

/* ---- Loading ---- */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin: 2rem 0;
  border: 1px solid var(--border-light);
}

.loading .spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
}

.loading p {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ---- Results Section ---- */
.results-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-light);
}

.results-stats {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-light);
  background: var(--bg-page);
}

.stat-icon { font-size: 1rem; }

.stat strong {
  font-weight: 700;
}

.stat-purple {
  background: #F5F3FF;
  border-color: #DDD6FE;
  color: var(--accent-purple);
}
.stat-purple strong { color: var(--accent-purple); }

.stat-green {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #059669;
}
.stat-green strong { color: #059669; }

.stat-orange {
  background: #FFF7ED;
  border-color: #FED7AA;
  color: #EA580C;
}
.stat-orange strong { color: #EA580C; }

/* ---- Company Cards ---- */
.company-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 0;
  border: 2px solid var(--border-light);
  border-left: 4px solid var(--primary);
  transition: var(--transition);
  overflow: hidden;
}

.company-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.company-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.company-header:hover {
  background: var(--bg-card-glass);
}

.company-name-section {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.toggle-icon {
  font-size: 0.9rem;
  min-width: 16px;
  margin-top: 0.1rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.company-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
  word-break: break-word;
}

.company-header-badges {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  min-height: 2rem;
  align-content: center;
}

.email-badge {
  display: inline-block;
  background: var(--success);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 9999px;
  white-space: nowrap;
}

.company-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #FEF3C7;
  padding: 0.35rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.company-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  padding: 0 1.5rem 1.5rem;
  font-size: 0.85rem;
  border-top: 1px solid var(--border-light);
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

.company-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--text-light);
}

.company-info-item strong {
  color: var(--text-dark);
  font-weight: 600;
}

.emails-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.email-item {
  background: var(--bg-card);
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--text-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
  border: 1px solid var(--border-light);
}

.email-item a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.email-item a:hover { text-decoration: underline; }

.company-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn-small {
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-weight: 600;
}

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

.btn-small-secondary {
  background: var(--border-light);
  color: var(--text-dark);
}
.btn-small-secondary:hover { background: var(--border); }

/* ---- Error & Empty ---- */
.error-message {
  background: #FEF2F2;
  border: 2px solid var(--error);
  border-left: 4px solid var(--error);
  color: #991b1b;
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-lighter);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

/* ============================================================================
   STEPS INDICATOR
   ============================================================================ */

.steps-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0 2.5rem;
  gap: 0;
  position: relative;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  z-index: 1;
  position: relative;
  opacity: 0.45;
  min-width: 80px;
}

.step.active {
  opacity: 1;
}

.step-number {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  color: var(--text-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.step.active .step-number {
  background: linear-gradient(135deg, var(--primary) 0%, #FF8F47 100%);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 6px var(--primary-light), 0 4px 12px var(--primary-glow);
}

.step-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-lighter);
  transition: var(--transition);
  white-space: nowrap;
}

.step.active .step-label {
  color: var(--text-dark);
  font-weight: 700;
}

.step-connector {
  width: 60px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
  margin-bottom: 1.6rem;
}

/* ============================================================================
   STEP SECTIONS
   ============================================================================ */

.step-section {
  display: none !important;
  animation: fadeSlideIn 0.4s ease-out;
  margin-bottom: 2rem;
}

.step-section.active {
  display: block !important;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   FIELDSETS
   ============================================================================ */

fieldset, .fieldset-modern {
  border: none;
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  background: var(--bg-page);
  border-left: 4px solid var(--primary);
}

legend {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  padding: 0 0.5rem;
  margin-left: -0.5rem;
  margin-bottom: 0.75rem;
  display: block;
}

.legend-icon {
  margin-right: 0.35rem;
}

#charCount {
  color: var(--text-lighter);
  font-size: 0.75rem;
}

/* ---- Checkbox Groups ---- */
.form-group.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.form-group.checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 0.2rem;
  cursor: pointer;
  accent-color: var(--primary);
}

.form-group.checkbox label {
  margin-bottom: 0;
  cursor: pointer;
  font-weight: 500;
}

/* ---- File Preview ---- */
.files-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.file-preview-item {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  background: var(--primary-light);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  border: none;
}

.file-preview-item.error {
  background: #FEE2E2;
  color: #991b1b;
}

.file-preview-remove {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0 0 0 0.5rem;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 700;
}

/* ---- Companies Quick View ---- */
.companies-quick-view {
  margin-top: 0.75rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

/* ============================================================================
   EMAIL PREVIEW
   ============================================================================ */

.email-preview {
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  border: 2px solid var(--border-light);
  margin-bottom: 1.5rem;
}

.email-header {
  background: var(--bg-card);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.email-header p {
  margin: 0.4rem 0;
  color: var(--text-light);
}

.email-body {
  margin-bottom: 1rem;
}

.email-textarea {
  width: 100%;
  padding: 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  resize: vertical;
  background: var(--bg-card);
  color: var(--text-dark);
  min-height: 280px;
  transition: var(--transition);
}

.email-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.email-files {
  background: #DCFCE7;
  border-left: 4px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.email-files h4 {
  color: #166534;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.email-files-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.email-files-list > div {
  padding: 0.5rem 0.75rem;
  background: white;
  border-left: 3px solid var(--success);
  border-radius: 0.25rem;
  font-size: 0.82rem;
  color: #15803d;
}

.email-info {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ============================================================================
   COMPANIES SELECTION (Step 4)
   ============================================================================ */

.companies-selection {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  border: 1px solid var(--border-light);
  margin-bottom: 1.5rem;
}

.companies-selection h3 {
  color: var(--text-dark);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.select-all {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.select-all input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.select-all label {
  margin: 0;
  cursor: pointer;
  font-weight: 600;
}

.companies-list {
  display: grid;
  gap: 0.75rem;
}

.company-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-page);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
}

.company-checkbox-item:hover {
  border-color: var(--primary);
  background: var(--bg-card);
}

.company-checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.company-checkbox-item input[type="checkbox"]:checked ~ .company-checkbox-info {
  color: var(--text-dark);
}

.company-checkbox-info {
  flex: 1;
  font-size: 0.85rem;
}

.company-checkbox-name {
  font-weight: 700;
  color: var(--text-dark);
}

.company-checkbox-email {
  color: var(--text-light);
  font-size: 0.78rem;
}

/* ---- Selection Summary ---- */
.selection-summary {
  background: var(--primary-light);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  text-align: center;
  margin-bottom: 1.5rem;
  font-weight: 600;
  color: var(--text-dark);
}

/* ============================================================================
   STEP NAVIGATION
   ============================================================================ */

.step-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

/* ============================================================================
   PROGRESS BAR
   ============================================================================ */

.sending-progress {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 1.25rem;
  margin-top: 1.5rem;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, #FF8F47 100%);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 9999px;
}

#progressText {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  margin: 0;
}

/* ============================================================================
   SENDING RESULTS
   ============================================================================ */

.sending-results {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  border: 1px solid var(--border-light);
  margin-top: 1.5rem;
}

.sending-results h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.sending-results h4 {
  color: var(--text-dark);
  margin-bottom: 1rem;
  margin-top: 0;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-page);
  border-radius: 0.375rem;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  border-left: 4px solid var(--border);
}

.result-item.success {
  border-left-color: var(--success);
  background: #F0FDF4;
}

.result-item.error {
  border-left-color: var(--error);
  background: #FEF2F2;
}

.result-badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

/* ---- Result Card ---- */
.result-card {
  padding: 1.25rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  transition: var(--transition);
}

.result-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  transform: translateY(-2px);
}

.result-card h4 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.result-card p {
  margin: 0.2rem 0;
  color: var(--text-light);
  font-size: 0.85rem;
}

/* ============================================================================
   RESPONSIVE — APP COMPONENTS
   ============================================================================ */

@media (max-width: 768px) {
  .steps-indicator {
    gap: 0;
  }
  .step-connector {
    width: 30px;
  }
  .step-label {
    font-size: 0.7rem;
  }
  .step-number {
    width: 38px;
    height: 38px;
    font-size: 0.85rem;
  }
  .company-details {
    grid-template-columns: 1fr;
  }
  .step-navigation {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .steps-indicator {
    flex-wrap: wrap;
    justify-content: center;
  }
  .step-connector {
    width: 20px;
  }
  .results-stats {
    flex-direction: column;
  }
}
