/* ==================== CSS RESET & BASE ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --secondary: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-elevated: #334155;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border: #334155;
  --border-light: #475569;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  --transition: all 0.2s ease;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Visually-hidden helper for accessible labels */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Utility to hide elements without inline styles (used instead of style="display:none") */
.is-hidden {
  display: none !important;
}

/* ==================== HEADER ==================== */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ==================== CONTAINER & LAYOUT ==================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.main-content {
  padding: 2rem 0 4rem;
}

.section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.section:hover {
  box-shadow: var(--shadow-lg);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: -1rem;
  margin-bottom: 1rem;
}

/* ==================== UPLOAD SECTION ==================== */
.upload-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: var(--transition);
}

.upload-box:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
  transform: translateY(-2px);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.upload-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.upload-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
}

.file-icon {
  font-size: 1.5rem;
}

.file-name {
  flex: 1;
  color: var(--primary);
  font-weight: 500;
}

.btn-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: var(--transition);
}

.btn-remove:hover {
  color: var(--danger);
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card);
  border-color: var(--primary);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon {
  font-size: 1.1rem;
}

/* ==================== LOADING SPINNER ==================== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

/* ==================== TABS ==================== */
.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ==================== DATA PREVIEW ==================== */
.data-preview {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  min-height: 200px;
}

.data-preview h3 {
  color: var(--primary);
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.data-preview p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.data-preview .info-group {
  margin-bottom: 1.5rem;
}

.data-preview .info-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.data-preview .info-value {
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state.large {
  min-height: 400px;
  flex-direction: column;
  gap: 1rem;
}

.empty-icon {
  font-size: 4rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
}

/* ==================== CODE AREAS ==================== */
.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.code-title {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.btn-copy {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-copy:hover {
  background: var(--bg-card);
  color: var(--primary);
  border-color: var(--primary);
}

.code-textarea {
  width: 100%;
  min-height: 200px;
  padding: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  resize: vertical;
}

.code-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==================== TEMPLATE GRID ==================== */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.template-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.template-card:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.template-card:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.template-card.active {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
}

.template-preview {
  height: 150px;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

/* Template Previews */
.classic-preview {
  background: linear-gradient(to bottom, #fff 20%, #f5f5f5 20%);
  padding: 0.5rem;
}

.prev-header {
  background: #333;
  height: 15%;
  margin-bottom: 0.5rem;
  border-radius: 2px;
}

.prev-line {
  background: #999;
  height: 8px;
  margin-bottom: 0.5rem;
  border-radius: 2px;
}

.prev-line.short {
  width: 60%;
}

.modern-preview {
  background: #fff;
  display: flex;
}

.prev-sidebar {
  width: 35%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.prev-main {
  flex: 1;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.creative-preview {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  padding: 0.5rem;
}

.prev-accent {
  background: rgba(255, 255, 255, 0.9);
  height: 20%;
  margin-bottom: 0.5rem;
  border-radius: 2px;
}

.tech-preview {
  background: #1a1a2e;
  padding: 0.5rem;
}

.prev-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  height: 100%;
}

.prev-box {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 2px;
}

.executive-preview {
  background: #2c3e50;
  padding: 0.5rem;
}

.prev-header.elegant {
  background: linear-gradient(to right, #bdc3c7, #ecf0f1);
  height: 25%;
}

.compact-preview {
  background: #ecf0f1;
  padding: 0.5rem;
}

.prev-columns {
  display: flex;
  gap: 0.5rem;
  height: 100%;
}

.prev-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.minimal-preview {
  background: #fff;
  padding: 0.5rem;
  border: 1px solid #ddd;
}

.minimal-preview .prev-header {
  background: #f5f5f5;
  height: 20%;
  margin-bottom: 0.5rem;
}

.colorful-preview {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 0.5rem;
}

.colorful-preview .prev-accent {
  background: linear-gradient(90deg, #ff6b6b, #ffa07a);
  height: 15%;
  margin-bottom: 0.5rem;
}

.colorful-preview .prev-box {
  background: rgba(255, 255, 255, 0.3);
  height: 35%;
  margin-bottom: 0.5rem;
}

.dark-preview {
  background: #1a1a1a;
  padding: 0.5rem;
}

.dark-preview .prev-header {
  background: #00bcd4;
  height: 25%;
  margin-bottom: 0.5rem;
}

.dark-preview .prev-line {
  background: #e0e0e0;
}

.ats-preview {
  background: #fff;
  padding: 0.5rem;
  border: 1px solid #999;
}

.ats-preview .prev-title {
  background: #000;
  height: 20%;
  margin-bottom: 0.5rem;
}

.academic-preview {
  background: #fafafa;
  padding: 0.5rem;
}

.academic-preview .prev-center {
  background: #bdc3c7;
  height: 15%;
  margin: 0 auto 0.5rem;
  width: 60%;
}

.corporate-preview {
  background: #f8f9fa;
  padding: 0.5rem;
  display: flex;
  gap: 0.5rem;
}

.corporate-preview .prev-sidebar {
  background: #003366;
  width: 25%;
}

.corporate-preview .prev-main {
  flex: 1;
}

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

.template-info h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.template-info p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ==================== RESUME CONTAINER ==================== */
.resume-container {
  background: transparent;
  border-radius: 0;
  padding: 0;
  min-height: 500px;
  box-shadow: none;
  color: #333;
}

/* ==================== PREVIEW SECTION - CLEAN BORDERLESS ==================== */
.preview-section {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
}

.preview-section:hover {
  box-shadow: none !important;
}

/* ==================== ACTION BUTTONS ==================== */
.action-btns {
  display: flex;
  gap: 0.75rem;
}

/* ==================== FOOTER ==================== */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  margin-top: 4rem;
}

.footer p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.privacy-note {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .header h1 {
    font-size: 1.5rem;
  }

  .section {
    padding: 1.5rem;
  }

  .template-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .resume-container {
    padding: 2rem 1.5rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .action-btns {
    width: 100%;
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }
}

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

/* ==================== PRINT STYLES ==================== */
@media print {
  html,
  body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .header,
  .footer,
  .section:not(.preview-section) {
    display: none !important;
  }

  .preview-section {
    background: white !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
  }

  .preview-section .section-header {
    display: none !important;
  }

  .resume-container {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
  }

  .resume-content {
    border: none !important;
    border-top: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
  }

  .action-btns {
    display: none !important;
  }

  .section {
    border: none !important;
    border-top: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
  }

  @page {
    margin: 0.5in;
  }
}
