/**
 * AI Resume Rewriter - Complete Styles
 * Unified CSS for resume-report-section.html, index.html, and dashboard.html
 * Includes: Modal, Persistent Diff Section, Dark Mode, Responsive
 */

/* ============================================================================
   KEYFRAME ANIMATIONS
   ============================================================================ */

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

/* ============================================================================
   PERSISTENT DIFF SECTION STYLES (New Always-Visible Section)
   ============================================================================ */

/* Empty State */
.diff-empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-icon-container {
  margin-bottom: 24px;
}

.empty-icon-container svg {
  margin: 0 auto;
  color: #cbd5e1;
}

.dashboard-page .empty-icon-container svg {
  color: #475569;
}

.diff-state-heading {
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 12px;
}

.dashboard-page .diff-state-heading {
  color: #e2e8f0;
}

.diff-state-description {
  color: #64748b;
  max-width: 600px;
  margin: 0 auto 24px;
}

.dashboard-page .diff-state-description {
  color: #94a3b8;
}

.diff-state-subtext {
  color: #64748b;
  font-size: 14px;
  max-width: 500px;
  margin: 0 auto 32px;
}

.dashboard-page .diff-state-subtext {
  color: #94a3b8;
}

.diff-info-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: #f1f5f9;
  border-radius: 8px;
}

.dashboard-page .diff-info-badge {
  background: #1e293b;
}

.diff-info-badge svg {
  color: #3b82f6;
}

.diff-info-badge span {
  color: #475569;
  font-size: 14px;
}

.dashboard-page .diff-info-badge span {
  color: #cbd5e1;
}

/* Loading State */
.diff-loading-state {
  text-align: center;
  padding: 48px 24px;
}

.diff-loading-state .loading-spinner {
  margin: 0 auto 24px;
}

/* Stats Container */
.diff-stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.diff-stat-item {
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.dashboard-page .diff-stat-item {
  background: linear-gradient(135deg, #1e293b 0%, #2d3748 100%);
  border-color: #334155;
}

.diff-stat-icon {
  font-size: 24px;
  display: block;
  margin-bottom: 8px;
}

.diff-stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #1e293b;
  margin: 8px 0;
}

.dashboard-page .diff-stat-value {
  color: #667eea;
}

.diff-stat-label {
  font-size: 14px;
  color: #64748b;
}

.dashboard-page .diff-stat-label {
  color: #94a3b8;
}

/* Diff View Title */
.diff-view-title {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 20px;
  text-align: center;
}

.dashboard-page .diff-view-title {
  color: #e2e8f0;
}

/* Diff Columns */
.diff-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 16px;
}

@media (max-width: 1024px) {
  .diff-columns {
    grid-template-columns: 1fr;
  }
}

.diff-column-header {
  padding: 12px;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
  text-align: center;
}

.before-header {
  background: #fee2e2;
  color: #991b1b;
}

.after-header {
  background: #d1fae5;
  color: #065f46;
}

.dashboard-page .before-header {
  background: rgba(254, 226, 226, 0.1);
  color: #fca5a5;
}

.dashboard-page .after-header {
  background: rgba(209, 250, 229, 0.1);
  color: #86efac;
}

.diff-content {
  padding: 20px;
  border-radius: 0 0 8px 8px;
  min-height: 200px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
}

.before-content {
  background: #fef2f2;
}

.after-content {
  background: #f0fdf4;
}

.dashboard-page .before-content {
  background: rgba(254, 242, 242, 0.05);
}

.dashboard-page .after-content {
  background: rgba(240, 253, 244, 0.05);
}

/* Diff Legend */
.diff-legend {
  text-align: center;
  font-size: 13px;
  color: #64748b;
}

.dashboard-page .diff-legend {
  color: #94a3b8;
}

.legend-item {
  margin: 0 12px;
}

.removed-sample {
  background: #fee2e2;
  color: #991b1b;
  padding: 2px 6px;
  border-radius: 3px;
  text-decoration: line-through;
}

.added-sample {
  background: #d1fae5;
  color: #065f46;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}

.dashboard-page .removed-sample {
  background: rgba(254, 226, 226, 0.2);
  color: #fca5a5;
}

.dashboard-page .added-sample {
  background: rgba(209, 250, 229, 0.2);
  color: #86efac;
}

/* ============================================================================
   EXPANDING MODAL SECTION (Original Format Selector)
   ============================================================================ */

/* Main rewrite section container - Hidden by default */
.rewrite-section {
  margin-top: 32px;
  padding: 2px; /* For gradient border effect */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.4s ease;
}

/* Expanded state - shown when user clicks button */
.rewrite-section.expanded {
  max-height: 1000px !important;
  opacity: 1 !important;
}

/* Inner container with white background */
.rewrite-section-inner {
  background: #ffffff;
  border-radius: 10px;
  padding: 32px;
  max-width: 100%;
}

/* Dark mode adaptation for dashboard page */
.dashboard-page .rewrite-section-inner {
  background: #1a2332;
  color: #e2e8f0;
}

/* Step container styling */
.rewrite-step h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  color: #1e293b;
}

.dashboard-page .rewrite-step h3 {
  color: #e2e8f0;
}

/* Format options grid */
.format-options {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

/* Format selection buttons */
.format-option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
}

.dashboard-page .format-option-btn {
  background: #2d3748;
  border-color: #4a5568;
  color: #e2e8f0;
}

.format-option-btn:hover {
  border-color: #667eea;
  background: #f8f9ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.dashboard-page .format-option-btn:hover {
  background: #3d4b5f;
  border-color: #667eea;
}

/* Format icon containers */
.format-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.format-icon.docx {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.format-icon.pdf {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* Format details text */
.format-details {
  flex: 1;
}

.format-details h4 {
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 4px;
  color: #1e293b;
}

.dashboard-page .format-details h4 {
  color: #e2e8f0;
}

.format-details p {
  font-size: 14px;
  color: #64748b;
  margin: 0;
}

.dashboard-page .format-details p {
  color: #94a3b8;
}

/* Loading and success step containers */
.loading-step,
.success-step {
  text-align: center;
  padding: 20px;
}

/* Loading spinner */
.loading-spinner {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  border: 4px solid #e2e8f0;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.dashboard-page .loading-spinner {
  border-color: #4a5568;
  border-top-color: #667eea;
}

/* Success icon */
.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Download button */
.download-btn {
  display: inline-block;
  padding: 14px 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
  text-decoration: none;
  color: white;
}

/* Revision input area */
.revision-area {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
}

.dashboard-page .revision-area {
  border-top-color: #4a5568;
}

.revision-area label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #1e293b;
}

.dashboard-page .revision-area label {
  color: #e2e8f0;
}

.revision-area textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
  background: white;
  color: #1e293b;
}

.dashboard-page .revision-area textarea {
  background: #2d3748;
  border-color: #4a5568;
  color: #e2e8f0;
}

.revision-area textarea:focus {
  outline: none;
  border-color: #667eea;
}

.revision-area .help-text {
  font-size: 13px;
  color: #64748b;
  margin-top: 8px;
}

.dashboard-page .revision-area .help-text {
  color: #94a3b8;
}

/* Text color for step descriptions */
.rewrite-step p {
  color: #64748b;
}

.dashboard-page .rewrite-step p {
  color: #94a3b8;
}

/* ========================================
   VISUAL DIFF UI - PRODUCTION STYLES
   ======================================== */

/* Statistics Container - Shows change metrics */
.diff-stats-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0;
  padding: 0;
}

@media (max-width: 768px) {
  .diff-stats-container {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Individual Stat Card */
.diff-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  transition: all 0.3s ease;
  text-align: center;
}

.diff-stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
  border-color: #667eea;
}

/* Dark mode for dashboard */
.dashboard-page .diff-stat-item {
  background: linear-gradient(135deg, #2d3748 0%, #1a2332 100%);
  border-color: #4a5568;
}

.dashboard-page .diff-stat-item:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.diff-stat-icon {
  font-size: 32px;
  margin-bottom: 8px;
  display: block;
}

.diff-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #667eea;
  line-height: 1.2;
  margin-bottom: 4px;
  display: block;
}

.diff-stat-label {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.dashboard-page .diff-stat-label {
  color: #94a3b8;
}

/* Main Diff View Container */
.diff-view-container {
  margin: 32px 0;
  padding: 24px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
}

.dashboard-page .diff-view-container {
  background: #1a2332;
  border-color: #4a5568;
}

.diff-view-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #1e293b;
  text-align: center;
}

.dashboard-page .diff-view-title {
  color: #e2e8f0;
}

/* Side-by-side columns layout */
.diff-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: #e2e8f0; /* Gap color */
  border-radius: 8px;
  overflow: hidden;
}

@media (max-width: 1024px) {
  .diff-columns {
    grid-template-columns: 1fr;
    gap: 16px;
    background: transparent;
  }
}

.dashboard-page .diff-columns {
  background: #4a5568;
}

.diff-column {
  background: #ffffff;
  padding: 20px;
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
}

.dashboard-page .diff-column {
  background: #2d3748;
}

/* Column headers */
.diff-column-header {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e2e8f0;
  color: #64748b;
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 1;
}

.dashboard-page .diff-column-header {
  border-bottom-color: #4a5568;
  color: #94a3b8;
}

.before-column .diff-column-header {
  color: #dc2626;
}

.after-column .diff-column-header {
  color: #059669;
}

/* Diff content area */
.diff-content {
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.8;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Individual diff sections */
.diff-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px dashed #e2e8f0;
}

.diff-section:last-child {
  border-bottom: none;
}

.dashboard-page .diff-section {
  border-bottom-color: #4a5568;
}

.diff-section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #475569;
  padding: 8px 12px;
  background: #f1f5f9;
  border-left: 3px solid #667eea;
  border-radius: 4px;
}

.dashboard-page .diff-section-title {
  color: #cbd5e1;
  background: #334155;
}

.diff-text {
  margin-top: 8px;
}

/* Color-coded highlighting */
.removed {
  background-color: #fee2e2;
  color: #991b1b;
  text-decoration: line-through;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 500;
}

.added {
  background-color: #d1fae5;
  color: #065f46;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
}

.unchanged {
  color: #334155;
}

/* Dark mode color-coded highlighting */
.dashboard-page .removed {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  text-decoration: line-through;
}

.dashboard-page .added {
  background-color: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.dashboard-page .unchanged {
  color: #cbd5e1;
}

/* Legend for color coding */
.diff-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  font-size: 13px;
  color: #64748b;
}

.dashboard-page .diff-legend {
  border-top-color: #4a5568;
  color: #94a3b8;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.removed-sample {
  padding: 2px 8px;
  background-color: #fee2e2;
  color: #991b1b;
  text-decoration: line-through;
  border-radius: 3px;
  font-size: 12px;
}

.added-sample {
  padding: 2px 8px;
  background-color: #d1fae5;
  color: #065f46;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
}

.dashboard-page .removed-sample {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.dashboard-page .added-sample {
  background-color: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

/* Scrollbar styling for diff columns */
.diff-column::-webkit-scrollbar {
  width: 8px;
}

.diff-column::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.diff-column::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.diff-column::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.dashboard-page .diff-column::-webkit-scrollbar-track {
  background: #1e293b;
}

.dashboard-page .diff-column::-webkit-scrollbar-thumb {
  background: #475569;
}

.dashboard-page .diff-column::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Enhanced download button styling */
.download-btn {
  display: inline-block;
  padding: 16px 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  margin-top: 24px;
  text-align: center;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  text-decoration: none;
  color: white;
}

.download-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  .diff-stat-item,
  .download-btn {
    transition: none;
  }

  .diff-stat-item:hover,
  .download-btn:hover {
    transform: none;
  }
}

/* Focus styles for keyboard navigation */
.diff-column:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

.download-btn:focus {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Loading state (if needed) */
.diff-view-container.loading {
  opacity: 0.6;
  pointer-events: none;
}

.diff-view-container.loading::after {
  content: 'Rendering comparison...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  color: #667eea;
  font-weight: 600;
}

.dashboard-page .diff-view-container.loading::after {
  background: #2d3748;
  color: #94a3b8;
}

/* Print styles */
@media print {
  .diff-stats-container,
  .diff-legend,
  .download-btn {
    display: none;
  }

  .diff-columns {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .diff-column {
    max-height: none;
    overflow: visible;
  }
}
