/* Cold Email Personalizer - Professional UI */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary-navy: #1e293b;
  --primary-white: #ffffff;
  --secondary-blue: #3b82f6;
  --light-gray: #f8fafc;
  --border-gray: #e2e8f0;
  --text-dark: #334155;
  --text-light: #64748b;
  --success-green: #10b981;
  --error-red: #ef4444;
  --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-large: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: linear-gradient(135deg, var(--light-gray) 0%, #e0f2fe 100%);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* Header */
.header {
  text-align: center;
  margin-bottom: 3rem;
}

.header h1 {
  color: var(--primary-navy);
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.header p {
  color: var(--text-light);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Card Components */
.card {
  background: var(--primary-white);
  border-radius: 16px;
  box-shadow: var(--shadow-medium);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-gray);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-large);
  transform: translateY(-2px);
}

.card-header {
  margin-bottom: 1.5rem;
}

.card-title {
  color: var(--primary-navy);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.card-description {
  color: var(--text-light);
  font-size: 0.95rem;
}

/* Navigation Tabs */
.tab-navigation {
  display: flex;
  background: var(--primary-white);
  border-radius: 12px;
  padding: 0.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--border-gray);
}

.tab-button {
  flex: 1;
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.tab-button.active {
  background: var(--primary-navy);
  color: var(--primary-white);
  box-shadow: var(--shadow-light);
}

.tab-button:hover:not(.active) {
  background: var(--light-gray);
  color: var(--text-dark);
}

/* Form Elements */
.form-section {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-gray);
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 1.5rem;
}

.form-section-title {
  color: var(--primary-navy);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--secondary-blue);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  color: var(--text-dark);
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-gray);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s ease;
  background: var(--primary-white);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--secondary-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

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

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  font-family: inherit;
  gap: 0.5rem;
}

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

.btn-primary:hover {
  background: #0f172a;
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

.btn-secondary {
  background: var(--secondary-blue);
  color: var(--primary-white);
}

.btn-secondary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

.btn-outline {
  background: transparent;
  color: var(--primary-navy);
  border: 2px solid var(--primary-navy);
}

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

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

/* File Upload */
.file-upload {
  border: 2px dashed var(--border-gray);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  background: var(--light-gray);
}

.file-upload:hover {
  border-color: var(--secondary-blue);
  background: rgba(59, 130, 246, 0.05);
}

.file-upload.dragover {
  border-color: var(--secondary-blue);
  background: rgba(59, 130, 246, 0.1);
}

.file-upload-icon {
  font-size: 3rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.file-upload-text {
  color: var(--text-dark);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.file-upload-subtext {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Results */
.results-container {
  background: var(--primary-white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--border-gray);
}

.email-preview {
  background: var(--light-gray);
  border-radius: 8px;
  padding: 1.5rem;
  border-left: 4px solid var(--secondary-blue);
  font-family: 'Courier New', monospace;
  white-space: pre-wrap;
  line-height: 1.5;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.results-table th,
.results-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-gray);
}

.results-table th {
  background: var(--light-gray);
  font-weight: 600;
  color: var(--text-dark);
}

.results-table tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

/* Loading States */
.loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-gray);
  border-top: 2px solid var(--secondary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 500;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  .header h1 {
    font-size: 2rem;
  }
  
  .card {
    padding: 1.5rem;
  }
  
  .tab-navigation {
    flex-direction: column;
  }
  
  .tab-button {
    margin-bottom: 0.5rem;
  }
  
  .results-table {
    font-size: 0.9rem;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.gap-2 {
  gap: 0.5rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

/* Enriched Email Styles */
.enrichment-score {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.enrichment-score h3 {
  color: var(--primary-navy);
  margin-bottom: 1rem;
}

.enrichment-sources {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.source-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  background: rgba(156, 163, 175, 0.2);
  color: var(--text-gray);
  border: 1px solid rgba(156, 163, 175, 0.3);
}

.source-badge.active {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success-green);
  border-color: rgba(34, 197, 94, 0.3);
}

.email-versions {
  display: grid;
  gap: 2rem;
  margin-top: 2rem;
}

.email-version {
  border: 1px solid var(--border-gray);
  border-radius: 12px;
  padding: 1.5rem;
  background: white;
}

.version-header {
  color: var(--primary-navy);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.version-angle {
  background: rgba(59, 130, 246, 0.1);
  color: var(--secondary-blue);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: normal;
}

.email-content {
  margin-bottom: 1.5rem;
}

.email-subject {
  background: rgba(243, 244, 246, 0.8);
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  border-left: 3px solid var(--secondary-blue);
}

.email-body {
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-dark);
}

.version-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-loading {
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.btn.loading .btn-text {
  display: none;
}

.btn.loading .btn-loading {
  display: flex;
}

.text-center {
  text-align: center;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mt-2 {
  margin-top: 1rem;
}

.flex {
  display: flex;
}

.justify-between {
  justify-content: space-between;
}

.items-center {
  align-items: center;
}

.gap-2 {
  gap: 1rem;
}

/* Source badges */
.source-badge {
    background: var(--light-gray);
    color: var(--dark-gray);
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    margin-right: 0.5rem;
    transition: all 0.3s ease;
}

.source-badge.active {
    background: var(--secondary-blue);
    color: white;
}

/* Enrichment score styling */
.enrichment-score {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
}

.enrichment-score h3 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.enrichment-details {
    margin-top: 1rem;
}

.enrichment-sources {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .tab-navigation {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .tab-button {
        min-width: 150px;
    }
    
    .bulk-results-table {
        font-size: 0.8rem;
    }
    
    .bulk-results-table th,
    .bulk-results-table td {
        padding: 0.5rem 0.25rem;
    }
}

/* Enhanced Card Styling for Visual Differentiation */
/* Single Email Card Styling */
#single-tab .card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-left: 5px solid #3b82f6;
  position: relative;
}

#single-tab .card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-radius: 0 0 0 100%;
  opacity: 0.3;
}

#single-tab .card-header {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-bottom: 1px solid #bfdbfe;
  position: relative;
  z-index: 1;
}

#single-tab .card-title {
  color: #1e40af;
  position: relative;
}

#single-tab .card-title::before {
  content: '👤';
  margin-right: 0.75rem;
  font-size: 1.2em;
}

#single-tab .enrichment-toggle {
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  padding: 1rem;
}

/* Bulk Email Card Styling */
#bulk-tab .card {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border-left: 5px solid #059669;
  position: relative;
}

#bulk-tab .card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border-radius: 0 0 0 100%;
  opacity: 0.3;
}

#bulk-tab .card-header {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-bottom: 1px solid #a7f3d0;
  position: relative;
  z-index: 1;
}

#bulk-tab .card-title {
  color: #065f46;
  position: relative;
}

#bulk-tab .card-title::before {
  content: '📊';
  margin-right: 0.75rem;
  font-size: 1.2em;
}

#bulk-tab .enrichment-toggle {
  background: rgba(5, 150, 105, 0.05);
  border: 1px solid rgba(5, 150, 105, 0.2);
  border-radius: 12px;
  padding: 1rem;
}

/* Enhanced Form Styling for Each Tab */
#single-tab .form-input:focus,
#single-tab .form-textarea:focus,
#single-tab .form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#bulk-tab .form-input:focus,
#bulk-tab .form-textarea:focus,
#bulk-tab .form-select:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* Button Styling per Tab */
#single-tab .btn-primary {
  background: linear-gradient(135deg, #3b82f6, #1e40af);
  border: none;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

#single-tab .btn-primary:hover {
  background: linear-gradient(135deg, #1e40af, #1e3a8a);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

#bulk-tab .btn-primary {
  background: linear-gradient(135deg, #059669, #047857);
  border: none;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

#bulk-tab .btn-primary:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.4);
}

/* File Upload Area Styling for Bulk Tab */
#bulk-tab .file-upload {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 2px dashed #059669;
  color: #065f46;
}

#bulk-tab .file-upload:hover {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #047857;
}

#bulk-tab .file-upload.dragover {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #059669;
  transform: scale(1.02);
}