/* ==========================================================================
   ADHAM CHERKAOUI EDDEQAQI — EXECUTIVE DEVELOPER CV
   Pixel-Perfect A4 Print & ATS Optimization Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Core Color Palette - Executive Modern Tech */
  --primary: #0f172a;          /* Slate 900 - Deep Executive Navy */
  --primary-light: #1e293b;    /* Slate 800 */
  --primary-subtle: #334155;   /* Slate 700 */
  --accent: #2563eb;           /* Cobalt Royal Blue */
  --accent-hover: #1d4ed8;     /* Deep Cobalt */
  --accent-light: #eff6ff;     /* Blue 50 */
  --accent-border: #bfdbfe;    /* Blue 200 */
  --accent-gradient: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  
  /* Text & Surfaces */
  --text-main: #0f172a;        /* High contrast primary text */
  --text-muted: #475569;       /* Slate 600 - Secondary text */
  --text-light: #64748b;       /* Slate 500 - Meta details */
  --text-white: #ffffff;
  
  --bg-page: #ffffff;
  --bg-sidebar: #f8fafc;       /* Slate 50 - subtle distinction */
  --bg-card: #ffffff;
  --border-color: #e2e8f0;     /* Slate 200 */
  --border-light: #f1f5f9;     /* Slate 100 */
  
  --tag-bg: #f1f5f9;
  --tag-text: #1e293b;
  --tag-border: #cbd5e1;
  --tag-accent-bg: #eff6ff;
  --tag-accent-text: #1d4ed8;

  /* Typography Scale */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;
  
  --name-size: 26px;
  --title-size: 13.5px;
  --section-title-size: 13px;
  --item-title-size: 11.5px;
  --body-size: 10px;
  --meta-size: 9px;
  --tag-size: 8.5px;

  /* Spacing Scale - Strictly calibrated for 1-page A4 */
  --page-padding: 14mm 14mm 12mm 14mm;
  --section-gap: 10px;
  --item-gap: 7px;
  --bullet-gap: 3px;
  --sidebar-width: 215px;
}

/* Alternative Accent Themes (Switchable via UI) */
[data-theme="emerald"] {
  --accent: #059669;
  --accent-hover: #047857;
  --accent-light: #ecfdf5;
  --accent-border: #a7f3d0;
  --accent-gradient: linear-gradient(135deg, #059669 0%, #065f46 100%);
  --tag-accent-bg: #ecfdf5;
  --tag-accent-text: #047857;
}

[data-theme="indigo"] {
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-light: #eef2ff;
  --accent-border: #c7d2fe;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  --tag-accent-bg: #eef2ff;
  --tag-accent-text: #4338ca;
}

[data-theme="slate"] {
  --accent: #0f172a;
  --accent-hover: #1e293b;
  --accent-light: #f1f5f9;
  --accent-border: #cbd5e1;
  --accent-gradient: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  --tag-accent-bg: #f1f5f9;
  --tag-accent-text: #0f172a;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #0b0f17;
  font-family: var(--font-sans);
  color: var(--text-main);
}

body {
  margin: 0;
  padding: 20px 0 60px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  background: #0f172a radial-gradient(circle at 50% 10%, #1e293b 0%, #0f172a 100%);
}

/* ==========================================================================
   TOP CONTROL BAR (Screen Only, Hidden on Print)
   ========================================================================== */
.control-bar {
  position: sticky;
  top: 15px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 210mm;
  max-width: 95vw;
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0,0,0,0.2);
  margin-bottom: 20px;
  color: #f8fafc;
}

.control-bar-left, .control-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #94a3b8;
  padding-right: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10b981;
}

.btn-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}

.btn-ctrl:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-ctrl.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(37, 99, 235, 0.5);
}

.btn-ctrl.primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #3b82f6;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-ctrl.primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.theme-picker {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-left: 6px;
}

.theme-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.theme-dot:hover {
  transform: scale(1.2);
}

.theme-dot.blue { background: #2563eb; }
.theme-dot.emerald { background: #059669; }
.theme-dot.indigo { background: #4f46e5; }
.theme-dot.slate { background: #0f172a; border-color: #64748b; }

/* Hidden file input for photo upload */
#photo-upload-input {
  display: none;
}

/* ==========================================================================
   A4 SHEET CONTAINER (Exact A4 Dimensions: 210mm x 297mm)
   ========================================================================== */
.a4-wrapper {
  position: relative;
  width: 210mm;
  height: 297mm;
  min-height: 297mm;
  max-height: 297mm;
  background: var(--bg-page);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45), 0 4px 16px rgba(0, 0, 0, 0.15);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Main Canvas Body */
.cv-container {
  width: 100%;
  height: 100%;
  padding: var(--page-padding);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ==========================================================================
   TOP HEADER AREA: IDENTITY & CONTACT BAR
   ========================================================================== */
.cv-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 11px;
  border-bottom: 2px solid var(--primary);
  position: relative;
}

/* Accent decorative line */
.cv-header::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 70px;
  height: 2px;
  background: var(--accent);
}

/* Photo / Avatar Slot */
.avatar-container {
  position: relative;
  flex-shrink: 0;
}

.avatar-wrapper {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
}

.avatar-wrapper:hover {
  border-color: var(--accent-hover);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-initials {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #ffffff 40%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.avatar-upload-hint {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.avatar-upload-hint svg {
  width: 10px;
  height: 10px;
}

/* Header Info */
.header-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.candidate-name {
  font-size: var(--name-size);
  font-weight: 800;
  color: var(--primary);
  line-height: 1.05;
  letter-spacing: -0.6px;
  text-transform: uppercase;
}

.candidate-title {
  font-size: var(--title-size);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.candidate-badge {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  letter-spacing: 0.5px;
}

/* Contact Meta Strip */
.contact-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 3px;
  font-size: var(--meta-size);
  color: var(--text-muted);
  font-weight: 500;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.15s;
}

.contact-item:hover {
  color: var(--accent);
}

.contact-item svg {
  width: 11px;
  height: 11px;
  color: var(--accent);
  flex-shrink: 0;
}

/* ==========================================================================
   CV BODY GRID (2-Column Architecture)
   ========================================================================== */
.cv-grid {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 16px;
  flex-grow: 1;
  margin-top: 10px;
}

/* ==========================================================================
   SECTION COMMON STYLES
   ========================================================================== */
.section {
  display: flex;
  flex-direction: column;
  gap: var(--item-gap);
  margin-bottom: var(--section-gap);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--section-title-size);
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding-bottom: 3px;
  border-bottom: 1.5px solid var(--border-color);
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -1.5px;
  left: 0;
  width: 28px;
  height: 1.5px;
  background: var(--accent);
}

.section-title svg {
  width: 13px;
  height: 13px;
  color: var(--accent);
  flex-shrink: 0;
}

/* ==========================================================================
   SIDEBAR (LEFT COLUMN)
   ========================================================================== */
.cv-sidebar {
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-right: 1px dashed var(--border-color);
  padding-right: 12px;
}

/* Skills Category Blocks */
.skill-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.skill-group-title {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--primary-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.skill-group-title::before {
  content: "";
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3.5px;
}

.skill-tag {
  font-size: var(--tag-size);
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 2px 5.5px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  line-height: 1.25;
  white-space: nowrap;
}

.skill-tag.highlight {
  background: var(--tag-accent-bg);
  color: var(--tag-accent-text);
  border-color: var(--accent-border);
  font-weight: 600;
}

/* Education & Cert Timeline */
.timeline-item {
  position: relative;
  padding-left: 9px;
  border-left: 1.5px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1.5px;
  margin-bottom: 5px;
}

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

.timeline-item::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 3px;
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: var(--bg-page);
  border: 1.5px solid var(--accent);
}

.timeline-degree {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.timeline-school {
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
}

.timeline-date {
  font-size: 8.5px;
  font-weight: 500;
  color: var(--text-light);
  font-family: var(--font-mono);
}

.timeline-desc {
  font-size: 8.5px;
  color: var(--text-muted);
  line-height: 1.25;
  margin-top: 1px;
}

/* Language Meters */
.lang-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.lang-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9.5px;
}

.lang-name {
  font-weight: 700;
  color: var(--primary);
}

.lang-level {
  font-size: 8.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--accent-border);
}

/* Strengths / Assets List */
.strength-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3.5px;
}

.strength-item {
  font-size: 9px;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 5px;
  line-height: 1.25;
}

.strength-item svg {
  width: 9px;
  height: 9px;
  color: var(--accent);
  margin-top: 2px;
  flex-shrink: 0;
}

/* ==========================================================================
   MAIN CONTENT AREA (RIGHT COLUMN)
   ========================================================================== */
.cv-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Professional Summary */
.summary-box {
  background: #f8fafc;
  border-left: 2.5px solid var(--accent);
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
  border-top: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.summary-text {
  font-size: 9.5px;
  color: var(--text-muted);
  line-height: 1.4;
  text-align: justify;
}

.summary-text strong {
  color: var(--primary);
  font-weight: 700;
}

/* Experience & Project Cards */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: 7.5px;
}

.exp-card {
  display: flex;
  flex-direction: column;
  gap: 2.5px;
}

.exp-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.exp-title-block {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.exp-title {
  font-size: var(--item-title-size);
  font-weight: 800;
  color: var(--primary);
  line-height: 1.15;
}

.exp-tag {
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--tag-accent-bg);
  color: var(--tag-accent-text);
  border: 1px solid var(--accent-border);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.exp-company {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent);
}

.exp-date {
  font-size: 8.5px;
  font-weight: 600;
  color: var(--text-light);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.exp-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--bullet-gap);
  margin-top: 1px;
}

.exp-bullet {
  font-size: 9.2px;
  color: var(--text-muted);
  line-height: 1.32;
  position: relative;
  padding-left: 10px;
  text-align: justify;
}

.exp-bullet::before {
  content: "▪";
  position: absolute;
  left: 0;
  top: -1px;
  color: var(--accent);
  font-size: 11px;
}

.exp-bullet strong {
  color: var(--primary);
  font-weight: 700;
}

.exp-tech-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3.5px;
  margin-top: 2px;
}

.tech-label {
  font-size: 8px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tech-pill {
  font-size: 8px;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 1px 4.5px;
  background: #f1f5f9;
  color: #334155;
  border-radius: 3px;
  border: 1px solid #e2e8f0;
}

/* ==========================================================================
   PAGE FOOTER (ATS Verifier & Signature)
   ========================================================================== */
.cv-footer {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8px;
  color: var(--text-light);
}

.cv-footer-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cv-footer-right {
  font-family: var(--font-mono);
}

/* ==========================================================================
   PRINT MEDIA RULES (Vector crisp export, zero margins, exact 1 page)
   ========================================================================== */
@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html, body {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    overflow: hidden !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .no-print, .control-bar, .avatar-upload-hint {
    display: none !important;
  }

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

  .cv-container {
    height: 100% !important;
    page-break-after: avoid !important;
  }

  a {
    color: inherit !important;
    text-decoration: none !important;
  }
}
