/* XESTUS Resume Builder Stylesheet */
:root {
  --primary: #1e3a8a;
  --primary-light: #3b82f6;
  --primary-dark: #172554;
  --accent: #0f766e;
  --bg-dark: #0f172a;
  --surface: #1e293b;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --radius: 12px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Nav */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #0f172a;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #2563eb, #0f766e);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text span {
  font-size: 0.75rem;
  color: #2563eb;
  font-weight: 600;
}

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

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #475569;
}

.control-group select {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: white;
  font-size: 0.85rem;
  font-weight: 500;
  color: #1e293b;
  cursor: pointer;
}

.color-dots {
  display: flex;
  gap: 0.35rem;
}

.color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 0 0 1px #cbd5e1;
  transition: transform 0.15s ease;
}

.color-dot:hover, .color-dot.active {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px #2563eb;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: #2563eb;
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-success {
  background: #059669;
  color: white;
}

.btn-success:hover {
  background: #047857;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn-outline {
  background: white;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.btn-outline:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* App Main Layout */
.app-container {
  display: grid;
  grid-template-columns: 460px 1fr;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 65px);
}

@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
}

/* Editor Panel */
.editor-panel {
  background: #ffffff;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.accordion-section {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.accordion-header {
  padding: 0.75rem 1rem;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: #1e293b;
}

.accordion-header:hover {
  background: #f1f5f9;
}

.accordion-header i.chevron {
  transition: transform 0.2s ease;
}

.accordion-section.active .accordion-header i.chevron {
  transform: rotate(180deg);
}

.accordion-content {
  padding: 1rem;
  display: none;
  flex-direction: column;
  gap: 0.85rem;
  border-top: 1px solid #e2e8f0;
}

.accordion-section.active .accordion-content {
  display: flex;
}

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

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}

.form-group input, .form-group textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  color: #1e293b;
  transition: border-color 0.15s ease;
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

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

/* Dynamic Item Card */
.dynamic-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.85rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.item-delete-btn {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem;
}

.item-delete-btn:hover {
  color: #b91c1c;
}

.add-btn {
  width: 100%;
  padding: 0.5rem;
  background: #f1f5f9;
  border: 1px dashed #94a3b8;
  border-radius: 6px;
  color: #2563eb;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.add-btn:hover {
  background: #e2e8f0;
  border-color: #2563eb;
}

/* Preview Canvas Panel */
.preview-panel {
  background: #64748b26;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.preview-toolbar {
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: #475569;
}

/* A4 Sheet Container */
.resume-paper {
  width: 210mm;
  min-height: 297mm;
  background: white;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
  position: relative;
  font-size: 13px;
  line-height: 1.5;
  color: #1e293b;
}

/* ---------------- TEMPLATE 1: MODERN SIDEBAR ---------------- */
.template-modern {
  display: grid;
  grid-template-columns: 70mm 1fr;
  min-height: 297mm;
}

.template-modern .resume-sidebar {
  background-color: var(--primary);
  color: #f8fafc;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.template-modern .resume-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto;
  border: 3px solid rgba(255, 255, 255, 0.4);
  display: block;
}

.template-modern .sidebar-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #93c5fd;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 5px;
  margin-bottom: 10px;
}

.template-modern .contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11.5px;
  color: #e2e8f0;
}

.template-modern .contact-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-all;
}

.template-modern .skills-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-modern .skills-tags span {
  background: rgba(255, 255, 255, 0.15);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.template-modern .resume-main {
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.template-modern .main-header {
  border-bottom: 2px solid var(--primary);
  padding-bottom: 12px;
}

.template-modern .main-header h1 {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.template-modern .main-header .job-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 2px;
}

.template-modern .content-section h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 4px;
}

.template-modern .experience-item,
.template-modern .education-item {
  margin-bottom: 12px;
}

.template-modern .item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}

.template-modern .item-sub {
  font-size: 12px;
  color: #475569;
  font-weight: 500;
  margin-bottom: 4px;
}

.template-modern .item-desc {
  font-size: 12px;
  color: #334155;
  white-space: pre-line;
}

/* ---------------- TEMPLATE 2: CLASSIC ATS SINGLE COLUMN ---------------- */
.template-classic {
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.template-classic .classic-header {
  text-align: center;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 12px;
}

.template-classic .classic-header h1 {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.template-classic .classic-header .job-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 3px;
}

.template-classic .classic-contact {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  font-size: 11.5px;
  color: #475569;
}

.template-classic .content-section h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 3px;
  margin-bottom: 8px;
}

.template-classic .item-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
}

.template-classic .item-sub {
  font-size: 12px;
  color: #475569;
  font-style: italic;
  margin-bottom: 4px;
}

.template-classic .item-desc {
  font-size: 12px;
  color: #334155;
  white-space: pre-line;
}

/* ---------------- TEMPLATE 3: EXECUTIVE MINIMAL ---------------- */
.template-executive {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.template-executive .exec-topbar {
  background: var(--primary);
  color: white;
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.template-executive .exec-topbar h1 {
  font-size: 26px;
  font-weight: 800;
  text-transform: uppercase;
}

.template-executive .exec-topbar .job-title {
  font-size: 14px;
  color: #93c5fd;
  font-weight: 500;
}

.template-executive .exec-body {
  padding: 24px 32px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.template-executive .content-section h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  border-left: 3px solid var(--primary);
  padding-left: 8px;
  margin-bottom: 10px;
}

/* Ad Banners */
.ad-slot {
  max-width: 970px;
  margin: 1rem auto;
  text-align: center;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 10px;
}

/* Footer */
.app-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 2rem 1.5rem;
  font-size: 0.85rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.footer-links a {
  color: #cbd5e1;
  text-decoration: none;
}

.footer-links a:hover {
  color: #38bdf8;
}

/* PRINT MEDIA STYLES - CRITICAL FOR CLEAN 1-PAGE A4 PDF */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body, html {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .app-header,
  .editor-panel,
  .preview-toolbar,
  .ad-slot,
  .app-footer,
  .btn-print-floating {
    display: none !important;
  }

  .app-container {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .preview-panel {
    background: white !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .resume-paper {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }
}
