/* ==========================================================================
   CV STYLES - 2-Column Layout | Print Optimized
   ========================================================================== */

/* --------------------------------------------------------------------------
   GLOBAL & RESET
   -------------------------------------------------------------------------- */
html,
body {
  background-color: #f5f5f5;
  font-family: var(--font-sans);
  color: var(--text);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  overflow-y: auto;
}

/* Page Animation */
@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Page Container (A4 Paper) */
.page {
  background-color: transparent;
  width: 210mm;
  min-height: 297mm;
  padding: 0;
  /* No padding on page, internal container handles it */
  margin: 50px auto 20px auto;
  /* box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); Moved to card */
  box-sizing: border-box;
  position: relative;
  border-radius: 4px;
  z-index: 10;
  overflow: hidden;
  isolation: isolate;
  animation: fadeInSlide 0.8s ease-out forwards;
  transform: scale(0.85);
  transform-origin: top center;
}

/* --------------------------------------------------------------------------
   BACKGROUND EFFECTS (Scoped)
   -------------------------------------------------------------------------- */
#tsparticles {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -10 !important;
  pointer-events: none;
}

.gradient-bg {
  position: absolute !important;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -20 !important;
  background: transparent !important;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   LAYOUT: GRID (Sidebar + Main)
   -------------------------------------------------------------------------- */
.cv-container {
  display: grid;
  grid-template-columns: 32% 68%;
  /* 30/70 split roughly */
  min-height: 297mm;
}

/* LEFT SIDEBAR */
/* LEFT SIDEBAR */
.cv-sidebar {
  /* No border */
  padding: 20px 18px;
  /* Reduced padding for more vertical space */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 5;
}

/* RIGHT MAIN CONTENT */
/* RIGHT MAIN CONTENT */
.cv-main {
  /* Glassmorphism with Noise */
  background-color: rgba(255, 255, 255, 0.4);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
  background-blend-mode: overlay;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 10px;
  margin: 12px 15px 12px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 12px 25px;
  /* Reduced padding to shrink card around text */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: fit-content;
  align-self: center;
  gap: 5px;
  /* Reduced breathing room to fit on one page */
}

/* --------------------------------------------------------------------------
   SIDEBAR COMPONENTS
   -------------------------------------------------------------------------- */
/* Photo */
.cv-photo-wrapper {
  width: 120px;
  /* Slightly smaller to save space */
  height: 120px;
  border-radius: 50%;
  border: 4px solid white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  overflow: hidden;
  background: white;
  margin-bottom: 8px;
  /* Reduced margin */
}

.cv-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
  transform: scale(1.25);
  border-radius: 50%;
  display: block;
}

/* Sidebar Header */
.sidebar-header {
  margin-bottom: 15px;
  /* Reduced for more space */
}

.cv-name {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--text);
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.cv-title {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--accent);
  margin: 0;
  line-height: 1.4;
}

/* Sidebar Contact */
.sidebar-contact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin-bottom: 6px;
  /* Reduced for more space */
}

.contact-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.contact-item i {
  color: var(--accent);
  font-size: 0.9rem;
  width: 16px;
}

.contact-item a {
  color: inherit;
  text-decoration: none;
}

.contact-item a:hover {
  text-decoration: underline;
  color: var(--accent);
}

/* Sidebar Links */
.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.sidebar-links a {
  font-size: 0.8rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 3px 6px;
  border-radius: 4px;
  transition: background 0.2s;
}

.sidebar-links a i {
  color: var(--accent);
}

.sidebar-links a:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--accent);
}


/* Sidebar Skills - Redesigned (Glass Style) */
.sidebar-skills {
  margin-top: 30px;
  /* Reduced to match new alignment of 'Key Projects' */
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.2);
  /* Opacity */
  backdrop-filter: blur(8px);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Removed decorative top line */

.sidebar-section-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
  border-bottom: none;
  /* Removed border */
  padding-bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
}

.sidebar-section-title i {
  color: var(--accent);
  font-size: 0.9rem;
}

.sidebar-skills-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Reduced from 15px */
}

.sidebar-skill-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  /* Left align content */
  gap: 3px;
  /* Reduced from 5px */
  width: 100%;
}

.sidebar-skill-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: block;
  margin-bottom: 0px;
  /* Reduced from 2px */
}

.sidebar-skill-value {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Skill Pills */
.sidebar-skill-tag {
  font-size: 0.7rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  font-weight: 500;
  white-space: nowrap;
}


/* --------------------------------------------------------------------------
   MAIN CONTENT COMPONENTS
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   MAIN CONTENT COMPONENTS
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   MAIN CONTENT COMPONENTS
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   MAIN CONTENT COMPONENTS
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   MAIN CONTENT COMPONENTS
   -------------------------------------------------------------------------- */
.cv-section {
  margin-bottom: 8px;
  /* Reduced separation to save space */
}

.cv-section-title {
  font-size: 0.8rem;
  /* Reduced */
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  margin-bottom: 3px;
  /* Better separation from content */
  display: flex;
  align-items: center;
  gap: 6px;
}

.cv-section-title i {
  color: var(--accent);
  font-size: 0.9em;
}

.cv-text {
  font-size: 0.75rem;
  /* Reduced */
  line-height: 1.35;
  color: var(--text);
  margin: 0 0 2px 0;
}

.cv-text strong,
.cv-list strong {
  color: #000;
  font-weight: 700;
}

/* Skills */
.skills-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  /* Better spacing between skill rows */
}

.skill-category {
  display: flex;
  font-size: 0.77rem;
  line-height: 1.4;
}

.skill-label {
  font-weight: 600;
  color: var(--text);
  width: 115px;
  flex-shrink: 0;
}

.skill-value {
  color: var(--text-muted);
}

.skill-row {
  display: flex;
  font-size: 0.82rem;
  line-height: 1.35;
}

.skill-label {
  font-weight: 600;
  color: var(--text);
  width: 100px;
  flex-shrink: 0;
}

.skill-value {
  color: var(--text-muted);
}

/* Projects */
.project-item {
  margin-bottom: 2px;
  /* Better separation between projects */
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1px;
}

.project-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.project-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.project-tech {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 1px;
}

.cv-list {
  margin: 0;
  padding-left: 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Experience */
.job-item {
  margin-bottom: 2px;
  /* Better spacing between jobs */
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1px;
}

.job-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.job-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Creative / Edu */
.creative-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.creative-item,
.edu-item {
  font-size: 0.79rem;
  line-height: 1.4;
}

.edu-item {
  margin-bottom: 1px;
}

.edu-school {
  font-weight: 700;
  color: var(--text);
}

.edu-detail {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.77rem;
}

.highlight {
  font-weight: 600;
  color: var(--text);
}

/* Footer */
.cv-footer {
  margin-top: auto;
  /* Push to bottom */
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
  opacity: 0.7;
}

/* UI Elements */
.download-btn,
.back-link {
  position: fixed;
  z-index: 100;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border-radius: 50px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  transition: transform 0.2s;
}

.download-btn {
  bottom: 20px;
  right: 20px;
  background: var(--accent);
  color: white;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.9rem;
}

.back-link {
  top: 20px;
  left: 20px;
  background: white;
  color: var(--text);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
}

.download-btn:hover,
.back-link:hover {
  transform: translateY(-2px);
}

/* Interactive Hint */
.interactive-hint {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px 20px;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin: 0;
  opacity: 1;
  transition: opacity 0.5s ease-out;
  pointer-events: none;
}

.interactive-hint.hidden {
  opacity: 0;
}

@media print {
  .interactive-hint {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   TECH STACK BANNER (Full Width)
   -------------------------------------------------------------------------- */
.tech-stack-banner {
  grid-column: 1 / -1;
  background: white;
  padding: 15px 30px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.banner-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-title i {
  color: var(--accent);
}

.tech-pills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tech-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  border: 1px solid #e5e7eb;
}

.tech-pill-featured {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: var(--accent);
}

/* CRITICAL FIX FOR ICONS */
.tech-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: block;
  /* Removes inline spacing issues */
}

.tech-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tech-stack-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.tech-stack-text strong {
  color: var(--text);
  font-weight: 600;
}

/* Bottom Grid Adjustment */
.bottom-grid {
  min-height: auto !important;
  /* Allow it to shrink */
  display: grid;
  grid-template-columns: 32% 68%;
}

.empty-sidebar {
  padding: 0;
  /* No padding for empty space */
}

.bottom-content {
  padding-top: 10px !important;
}

/* --------------------------------------------------------------------------
   PRINT STYLES
   -------------------------------------------------------------------------- */
@media print {
  .tech-stack-banner {
    break-inside: avoid;
    border-top: 1px solid #ddd !important;
    border-bottom: 1px solid #ddd !important;
  }

  .tech-pill {
    background: #fff !important;
    border: 1px solid #ddd !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }

  body {
    background: white;
    box-shadow: none;
    margin: 0;
    padding: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .download-btn,
  .download-btn-mobile,
  .back-link {
    display: none !important;
  }

  .page {
    width: 100%;
    max-height: 297mm;
    height: auto;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    transform: none;
    animation: none;
  }

  .cv-container {
    max-height: 297mm;
    height: 100%;
    display: grid;
  }

  .cv-main {
    background-color: rgba(255, 255, 255, 0.35) !important;
    background-image: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    border-radius: 10px !important;
    margin: 10px 15px 10px 0 !important;
    box-shadow: none !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    padding: 15px 25px !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Ensure backgrounds print */
  /* Ensure backgrounds print */
  .cv-sidebar {
    /* No border */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #tsparticles,
  .gradient-bg {
    display: block !important;
    position: absolute !important;
    z-index: -10 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .gradient-blob {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Fix Photo */
  .cv-photo-wrapper {
    box-shadow: none !important;
    border: 3px solid #eee !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    mask-image: radial-gradient(circle, white 100%, black 100%);
  }
}

/* --------------------------------------------------------------------------
   MOBILE STYLES
   -------------------------------------------------------------------------- */
/* Default: hide mobile button, show desktop button */
.download-btn-mobile {
  display: none;
}

.download-btn-desktop {
  display: flex;
}

@media screen and (max-width: 768px) {

  /* Hide interactive hint on mobile */
  .interactive-hint {
    display: none !important;
  }

  /* Hide desktop print button on mobile */
  .download-btn-desktop {
    display: none !important;
  }

  /* Show mobile Google Drive link */
  .download-btn-mobile {
    display: flex !important;
    text-decoration: none;
  }
}

/* ==========================================================================
   INVOICE / DEVIS STYLES
   ========================================================================== */

.invoice-header-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

.invoice-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin: 0;
}

.invoice-meta {
  text-align: right;
}

.invoice-meta-item {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.invoice-meta-item strong {
  color: var(--text);
}

.client-section {
  margin-bottom: 2rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
}

.client-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: block;
}

/* Table Styles */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

.invoice-table th {
  text-align: left;
  padding: 10px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.invoice-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text);
}

.invoice-table td.qty,
.invoice-table td.price,
.invoice-table td.total {
  text-align: right;
  font-family: var(--font-mono);
}

.invoice-table th.right-align {
  text-align: right;
}

/* Editable Fields */
[contenteditable="true"] {
  border-bottom: 1px dashed transparent;
  transition: border-color 0.2s;
  min-width: 20px;
  display: inline-block;
}

[contenteditable="true"]:hover,
[contenteditable="true"]:focus {
  border-bottom-color: var(--accent);
  outline: none;
  background: rgba(139, 92, 246, 0.05);
}

/* Totals */
.totals-section {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 2rem;
}

.totals-table {
  width: 40%;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.totals-row.final {
  border-top: 2px solid var(--text);
  margin-top: 5px;
  padding-top: 5px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.totals-row span:last-child {
  font-family: var(--font-mono);
}

.footer-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  line-height: 1.4;
}

.add-row-btn {
  background: var(--bg-elevated);
  border: 1px dashed var(--accent);
  color: var(--accent);
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  margin-bottom: 2rem;
  transition: all 0.2s;
}

.add-row-btn:hover {
  background: var(--accent-soft);
}

@media print {
  .add-row-btn {
    display: none !important;
  }

  [contenteditable="true"] {
    border-bottom: none !important;
  }

  /* Ensure backgrounds print for invoice elements */
  .client-section {
    background: #f9f9f9 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Hide action column in print */
  .action-col {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   CV-ONLY PRINT SAFETY
   Prevent horizontal clipping in PDF export without affecting invoice pages.
   -------------------------------------------------------------------------- */
@media print {
  body.cv-page {
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.cv-page .page {
    width: 100% !important;
    max-height: 297mm !important;
    height: auto !important;
    transform: none !important;
    transform-origin: top left !important;
    overflow: visible !important;
    isolation: auto !important;
  }

  body.cv-page .cv-container {
    width: 100% !important;
    max-height: 297mm !important;
    height: auto !important;
    grid-template-columns: 32% 68% !important;
  }

  body.cv-page .cv-sidebar,
  body.cv-page .cv-main {
    min-width: 0 !important;
    overflow: visible !important;
  }

  body.cv-page .cv-main {
    margin: 10px 10px 10px 0 !important;
    padding: 16px 18px !important;
  }

  body.cv-page .sidebar-skills {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(255, 255, 255, 0.15) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.cv-page .project-header,
  body.cv-page .job-header {
    gap: 8px;
  }

  body.cv-page .project-title,
  body.cv-page .job-title {
    min-width: 0;
  }

  body.cv-page .project-date,
  body.cv-page .job-date {
    flex-shrink: 0;
  }

  body.cv-page .sidebar-skill-tag {
    white-space: normal !important;
  }

  body.cv-page .cv-text,
  body.cv-page .project-tech,
  body.cv-page .contact-item,
  body.cv-page .project-title,
  body.cv-page .job-title,
  body.cv-page .cv-list li,
  body.cv-page .sidebar-skill-tag {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

/* Delete Button Styles */
.delete-btn {
  color: #ef4444;
  opacity: 0.3;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.delete-btn:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.1);
}