/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

:root {
  --bg-color: #080b13;
  --panel-bg: rgba(13, 20, 38, 0.6);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.25);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent-blue: #00d2ff;
  --accent-purple: #9d4edd;
  --accent-pink: #ff007f;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --gradient-neon: linear-gradient(135deg, #00d2ff 0%, #9d4edd 100%);
  --gradient-purple: linear-gradient(135deg, #7928ca 0%, #ff0080 100%);
  --gradient-dark: linear-gradient(180deg, #101827 0%, #080b13 100%);
  
  --shadow-neon: 0 8px 32px 0 rgba(0, 210, 255, 0.15);
  --shadow-purple: 0 8px 32px 0 rgba(157, 78, 221, 0.2);
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  justify-content: center;
}

/* Background Glowing Orbs */
.glass-bg-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  background: var(--gradient-dark);
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  animation: float 20s infinite alternate ease-in-out;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: #3b82f6;
  top: -100px;
  right: -50px;
  animation-duration: 25s;
}

.orb-2 {
  width: 600px;
  height: 600px;
  background: #7c3aed;
  bottom: -150px;
  left: -100px;
  animation-duration: 30s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(80px, 50px) scale(1.15);
  }
}

/* Glassmorphism Card Style */
.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  border-color: var(--border-highlight);
}

/* Layout & Container */
.app-container {
  width: 100%;
  max-width: 1280px;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  z-index: 1;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 10px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 8px;
}

.logo-icon {
  font-size: 2.2rem;
  background: var(--gradient-neon);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(0, 210, 255, 0.4));
}

.logo h1 {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

.logo h1 span {
  background: var(--gradient-neon);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.5px;
}

/* Control Panel (Formulaire) */
.control-panel {
  padding: 30px;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.section-title i {
  color: var(--accent-blue);
}

.search-form {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-input-group {
  flex: 2;
  min-width: 280px;
}

.limit-input-group {
  flex: 0.5;
  min-width: 120px;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.input-with-icon {
  position: relative;
  width: 100%;
}

.input-with-icon i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

.input-with-icon input {
  width: 100%;
  padding: 14px 15px 14px 45px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.input-with-icon input:focus {
  border-color: var(--accent-blue);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.15);
}

.input-with-icon input:focus + i {
  color: var(--accent-blue);
}

/* Buttons */
.btn {
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient-neon);
  color: #0b0f19;
  box-shadow: var(--shadow-neon);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px 0 rgba(0, 210, 255, 0.3);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: #fff;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--text-secondary);
  transform: translateY(-2px);
}

/* Progress bar panel */
.progress-container {
  width: 100%;
  margin-top: 30px;
  padding: 20px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.95rem;
  font-weight: 500;
}

#progress-status-text {
  color: var(--accent-blue);
}

.progress-bar-wrapper {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient-neon);
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
  transition: width 0.5s ease-out;
}

.progress-detail {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Actions Bar */
.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: -10px;
  flex-wrap: wrap;
  gap: 15px;
}

.leads-count-badge {
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.2);
  padding: 8px 16px;
  border-radius: 50px;
  color: var(--accent-blue);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

/* Results Panel (Table) */
.results-panel {
  padding: 30px;
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.leads-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 16px 20px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.leads-table td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  white-space: nowrap;
}

.leads-table tbody tr {
  transition: background-color 0.2s ease;
}

.leads-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.leads-table tr.empty-state td {
  text-align: center;
  padding: 60px 20px;
}

.empty-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  color: var(--text-muted);
}

.empty-message i {
  font-size: 3rem;
  background: linear-gradient(180deg, var(--text-muted), transparent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Badges de Statuts */
.badge {
  padding: 5px 12px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Liens site web */
.website-link {
  color: var(--accent-blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter 0.2s ease;
}

.website-link:hover {
  filter: brightness(1.2);
  text-decoration: underline;
}

/* Boutons d'action de ligne */
.btn-row-action {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-ai-pitch {
  background: rgba(157, 78, 221, 0.15);
  color: #c77dff;
  border: 1px solid rgba(157, 78, 221, 0.3);
}

.btn-ai-pitch:hover {
  background: var(--gradient-purple);
  color: #fff;
  box-shadow: var(--shadow-purple);
  transform: translateY(-1px);
}

.actions-header, .actions-cell {
  text-align: right;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 12, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-card {
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScaleUp {
  0% {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 20px 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.modal-header h3 i {
  color: var(--accent-purple);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.btn-close:hover {
  color: #fff;
}

.modal-body {
  padding: 25px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lead-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
}

.lead-info-header h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.lead-info-header p {
  color: var(--accent-blue);
  font-size: 0.9rem;
}

.phone-badge {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 8px;
}

.pitch-editor-container {
  width: 100%;
  height: 250px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.pitch-editor-container textarea {
  width: 100%;
  height: 100%;
  padding: 15px;
  background: transparent;
  border: none;
  outline: none;
  color: #e5e7eb;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: none;
}

.modal-footer {
  padding: 20px 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 15px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--gradient-neon);
  color: #0b0f19;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 210, 255, 0.3);
  z-index: 200;
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Helpers utility */
.hidden {
  display: none !important;
}

/* Leads Grid Layout */
.leads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 20px;
  width: 100%;
  margin-top: 25px;
}

.empty-state-card {
  grid-column: 1 / -1;
  width: 100%;
  padding: 60px 20px;
  text-align: center;
}

/* Lead Card Design */
.lead-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: 18px;
  height: 100%;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lead-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-highlight);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.15);
}

.lead-card-contacted {
  opacity: 0.65;
  border-color: rgba(157, 78, 221, 0.25);
}

.lead-card-contacted:hover {
  opacity: 0.95;
  border-color: rgba(157, 78, 221, 0.5);
  box-shadow: 0 12px 30px rgba(157, 78, 221, 0.15);
}

.lead-card-header {
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 14px;
}

.lead-title-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lead-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-rating {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
}

.lead-card-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex-grow: 1;
}

.info-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.block-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.block-title i {
  color: var(--accent-blue);
}

.info-item {
  font-size: 0.9rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-item i {
  color: var(--text-muted);
  width: 16px;
}

.emails-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 120px;
  overflow-y: auto;
  padding-right: 5px;
  margin-top: 4px;
}

.email-item {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.15);
  color: var(--success);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  gap: 8px;
}

/* Diagnostic Section */
.audit-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 12px;
  border-radius: 10px;
}

.audit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.audit-row span {
  font-weight: 500;
}

/* Lead Card Footer */
.lead-card-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.template-selector {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-selector:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-highlight);
}

.template-selector option {
  background-color: var(--bg-color);
  color: #fff;
}

.btn-ai-pitch {
  margin-top: 10px;
  width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
  .search-form {
    flex-direction: column;
    align-items: stretch;
  }
  .limit-input-group {
    flex: 1;
  }
  .btn {
    width: 100%;
  }
  .actions-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .leads-count-badge {
    justify-content: center;
  }
  .app-container {
    padding: 20px 10px;
  }
}
