/* CSS Variables for Premium Dark/Light Web UI Theme */
:root {
  --bg-app: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #0f172a;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --success-color: #10b981;
  --success-hover: #059669;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Styles */
.app-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

.logo-accent {
  color: var(--accent-color);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.header-nav a:hover {
  color: var(--text-main);
  background-color: rgba(148, 163, 184, 0.12);
}

.header-nav a[aria-current="page"] {
  color: var(--text-main);
  background-color: rgba(59, 130, 246, 0.18);
}

.header-badges {
  display: flex;
  gap: 0.75rem;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.badge-private {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--accent-color);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* App Container Layout */
.app-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  gap: 0;
  height: calc(100vh - 65px);
  overflow: hidden;
}

.landing-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.landing-hero h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.landing-hero p {
  color: var(--text-muted);
  max-width: 760px;
  margin-bottom: 1rem;
}

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

.landing-features {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.feature-card p {
  color: var(--text-muted);
}

.feature-link {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--accent-color);
  font-weight: 600;
  text-decoration: none;
}

.feature-link:hover {
  color: var(--accent-hover);
}

.article-page {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.article-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 1.5rem;
  align-items: center;
}

.article-hero-copy,
.article-hero-media,
.article-content {
  width: 100%;
}

.article-kicker {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.article-hero h1 {
  font-size: clamp(2rem, 3.8vw, 3.5rem);
  line-height: 1.05;
  margin-bottom: 0.9rem;
}

.article-lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 60ch;
  margin-bottom: 0.8rem;
}

.article-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.article-hero-media {
  margin: 1.5rem auto 2rem;
  width: 100%;
  max-width: 560px;
  justify-self: center;
}

.article-image {
  display: block;
  width: 100%;
  height: 80px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  background: #ffffff;
}

.article-hero-image {
  object-fit: cover;
  aspect-ratio: 4 / 5;
}

.article-inline-image {
  object-fit: cover;
  aspect-ratio: 1 / 1;
  height: auto;
}

.article-hero-media .article-image,
.article-inline-figure .article-image {
  min-height: 260px;
}

.article-hero figcaption,
.article-inline-figure figcaption {
  margin-top: 0.6rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.article-content {
  padding: 2rem;
}

.article-section {
  margin-bottom: 1.6rem;
}

.article-section:last-child {
  margin-bottom: 0;
}

.article-section h2 {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
}

.article-section h3 {
  font-size: 1rem;
  margin: 1rem 0 0.45rem;
  color: var(--text-main);
}

.article-section p {
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

.article-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  color: var(--text-muted);
}

.article-table th,
.article-table td {
  border: 1px solid var(--border-color);
  padding: 0.75rem 0.9rem;
  vertical-align: top;
}

.article-table th {
  background: rgba(15, 23, 42, 0.5);
  color: var(--text-main);
  text-align: left;
}

.article-list {
  margin-left: 1.2rem;
  color: var(--text-muted);
}

.article-list li {
  margin-bottom: 0.6rem;
}

.article-inline-figure {
  margin: 1.75rem auto;
  width: 100%;
  max-width: 520px;
}

.article-inline-figure .article-image {
  margin: 0 auto;
}

.article-cta {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border: 1px solid rgba(59, 130, 246, 0.2);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.05));
}

.article-cta h2 {
  margin-bottom: 0.45rem;
}

.article-cta p {
  color: var(--text-muted);
  max-width: 60ch;
}

.landing-faq {
  margin-top: 0.25rem;
}

/* Panes Styling */
.editor-pane {
  padding: 2rem;
  overflow-y: auto;
  height: 100%;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.preview-pane {
  padding: 2rem;
  overflow-y: auto;
  height: 100%;
  background-color: #0b0f19;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* Cards inside Editor */
.editor-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.editor-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: var(--shadow-lg);
}

.intro-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.intro-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.intro-card strong {
  color: var(--text-main);
}

.editor-card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.card-header-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-header-action h2 {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

/* Forms & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.col-span-2 {
  grid-column: span 2;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

textarea {
  resize: vertical;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

/* Dynamic List Items inside Editor */
.dynamic-item {
  border: 1px solid var(--border-color);
  background-color: rgba(15, 23, 42, 0.3);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  position: relative;
  animation: fadeIn 0.2s ease-out;
}

.dynamic-item:last-child {
  margin-bottom: 0;
}

.btn-remove-item {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.btn-remove-item:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

/* Buttons Styling */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #ffffff;
}

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

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

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

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

.btn-danger:hover {
  background-color: var(--danger-color);
  color: #ffffff;
}

.btn-add {
  background-color: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.2);
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}

.btn-add:hover {
  background-color: var(--accent-color);
  color: #ffffff;
}

.btn-large {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
}

.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

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

/* Preview Header */
.preview-header-bar {
  width: 100%;
  max-width: 800px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-card);
  padding: 0.5rem 1rem;
  border-radius: 8px 8px 0 0;
  border: 1px solid var(--border-color);
  border-bottom: none;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Resume Live Preview Panel (Pure ATS Style) */
.ats-document {
  background-color: #ffffff;
  color: #000000;
  width: 100%;
  max-width: 800px;
  padding: 0.6in 0.6in; /* Standard margins */
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10pt;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  border-radius: 0 0 8px 8px;
  border: 1px solid var(--border-color);
  min-height: 297mm; /* standard A4 ratio in screen */
  overflow-y: visible;
  box-sizing: border-box;
}

/* ATS Header styling */
.ats-header {
  text-align: center;
  margin-bottom: 14pt;
}

.ats-header h1,
.ats-preview-name {
  font-size: 24pt;
  font-weight: bold;
  letter-spacing: -0.5px;
  margin-bottom: 2pt;
  color: #000000;
}

.ats-tagline {
  font-size: 11pt;
  font-weight: bold;
  margin-bottom: 4pt;
}

.ats-contact {
  font-size: 9.5pt;
  color: #333333;
}

/* ATS Sections styling */
.ats-section {
  margin-top: 14pt;
  margin-bottom: 8pt;
}

.ats-section-title,
.ats-preview-section-title {
  font-size: 11pt;
  font-weight: bold;
  letter-spacing: 0.5px;
  margin-bottom: 1pt;
  text-transform: uppercase;
}

.ats-section-divider {
  border: none;
  border-top: 1px solid #000000;
  margin-top: 1px;
  margin-bottom: 6pt;
}

.ats-summary-text {
  text-align: justify;
  font-size: 10pt;
}

/* Dynamic job/education blocks */
.ats-job-block, .ats-edu-block {
  margin-bottom: 8pt;
  page-break-inside: avoid;
}

.ats-job-header, .ats-edu-header {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 10pt;
}

.ats-job-subheader, .ats-edu-subheader {
  display: flex;
  justify-content: space-between;
  font-style: normal;
  font-size: 10pt;
  margin-bottom: 3pt;
}

/* ATS List formatting */
.ats-list {
  margin-left: 14pt;
  margin-bottom: 4pt;
  padding: 0;
  list-style-type: disc;
}

.ats-list li {
  margin-bottom: 2pt;
  padding-left: 2pt;
}

.ats-languages-text {
  font-size: 10pt;
}

/* Web Footer */
.app-footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent-color);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile & Tablet Layout Overrides (Responsive Grid) */
@media (max-width: 1024px) {
  .app-header {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .header-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .header-badges {
    margin-left: auto;
  }

  .landing-features {
    grid-template-columns: 1fr;
  }

  .article-hero {
    grid-template-columns: 1fr;
  }

  .article-hero-image,
  .article-inline-image {
    width: 100%;
    height: auto;
  }

  .article-hero-media,
  .article-inline-figure {
    width: 96%;
    max-width: 560px;
    margin: 1.5rem auto;
  }

  .article-cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-container {
    grid-template-columns: 1fr;
    height: auto;
    overflow-y: visible;
  }
  
  .editor-pane, .preview-pane {
    height: auto;
    overflow-y: visible;
    border-right: none;
    padding: 1rem;
  }
  
  .preview-pane {
    background-color: var(--bg-app);
  }
  
  .ats-document {
    padding: 0.4in;
    min-height: auto;
  }
  
  .footer-content {
    flex-direction: column;
    gap: 1rem;
  }
}

/* PRINT MEDIA STYLES - CRITICAL FOR ATS RESUME EXPORT */
@media print {
  /* Hide the entire web app interface */
  body, html {
    background-color: #ffffff !important;
    color: #000000 !important;
    font-family: Arial, Helvetica, sans-serif !important;
  }
  
  .app-header,
  .editor-pane,
  .preview-header-bar,
  .app-footer,
  .btn,
  .badge {
    display: none !important;
  }

  /* Reset layout for container */
  .app-container {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  
  .preview-pane {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: transparent !important;
    overflow: visible !important;
  }

  /* Expand resume sheet to standard dimensions */
  .ats-document {
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important; /* Let standard printer margin handle margins */
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
  }
  
  /* Print margins setup */
  @page {
    size: letter;
    margin: 0.6in 0.6in; /* 0.6 or 0.75in is perfect for margins */
  }

  /* Ensure page break options work */
  .ats-job-block, .ats-edu-block {
    page-break-inside: avoid !important;
  }
}

/* FAQ Styling for Web UI */
.faq-card {
  margin-top: 1.5rem;
}
.faq-item {
  margin-bottom: 1.25rem;
}
.faq-item:last-child {
  margin-bottom: 0;
}
.faq-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}
.faq-item p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.faq-item strong {
  color: var(--accent-color);
}
