/* ============================================================
   SOP Writer 2.0.5 — Smart CV Builder (CV Writer BD) 
   FULL-WIDTH COMPATIBILITY PATCH
   Targets: https://sopwriter.xyz/free-resume-builder/
   Handles: #scvb-form-col, #scvb-sections, .scvb-*
   ============================================================ */

/* --- Kill ALL WordPress theme containers on CV builder pages --- */
body.page-id-199 /* adjust if your page ID differs */,
body.page-slug-free-resume-builder,
body[class*="free-resume-builder"],
body:has(#scvb-form-col),
body:has([id*="scvb-"]) {
  overflow-x: clip;
}

/* Force full-width on every possible WP wrapper */
body:has(#scvb-form-col) .site,
body:has(#scvb-form-col) .site-content,
body:has(#scvb-form-col) #primary,
body:has(#scvb-form-col) #main,
body:has(#scvb-form-col) .content-area,
body:has(#scvb-form-col) .container,
body:has(#scvb-form-col) .entry-content,
body:has(#scvb-form-col) .post-content,
body:has(#scvb-form-col) .page-content,
body:has(#scvb-form-col) main,
body:has(#scvb-form-col) article,
.page-id-199 .site,
.page-id-199 .site-content,
.page-id-199 #primary,
.page-id-199 #main,
.page-id-199 .content-area,
.page-id-199 .container,
.page-id-199 .entry-content,
.page-id-199 main,
.page-id-199 article {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  float: none !important;
}

/* Hide page title / breadcrumbs / sidebars on builder page */
body:has(#scvb-form-col) .entry-header,
body:has(#scvb-form-col) .page-header,
body:has(#scvb-form-col) .entry-title,
body:has(#scvb-form-col) #secondary,
body:has(#scvb-form-col) .sidebar,
body:has(#scvb-form-col) .widget-area,
.page-id-199 .entry-header,
.page-id-199 .entry-title,
.page-id-199 #secondary { 
  display: none !important; 
}

/* --- SMART CV BUILDER FULL-WIDTH LAYOUT --- */
#scvb-form-col,
div[id*="scvb-form"],
#scvb-app,
.scvb-app {
  max-width: 1600px !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 24px 28px 48px !important;
  box-sizing: border-box;
}

@media(min-width: 1400px){
  #scvb-form-col,
  div[id*="scvb-form"],
  #scvb-app { max-width: 1680px !important; padding: 28px 36px 56px !important; }
}
@media(min-width: 1700px){
  #scvb-form-col,
  div[id*="scvb-form"],
  #scvb-app { max-width: 1800px !important; }
}

/* Make the builder 2-column wide layout on desktop */
@media(min-width: 1100px){
  /* If the plugin uses flex/grid — stretch it */
  #scvb-form-col,
  .scvb-builder-wrap,
  #scvb-sections {
    display: grid !important;
    grid-template-columns: minmax(480px, 600px) minmax(0, 1fr) !important;
    gap: 28px !important;
    align-items: start !important;
  }
  /* Left editor panel wider */
  #scvb-sections,
  #scvb-draggable-sections,
  .scvb-left,
  .scvb-form-panel {
    max-width: none !important;
    width: 100% !important;
  }
  /* Right preview panel */
  #scvb-preview,
  .scvb-preview-panel,
  .scvb-right,
  #scvb-sections + div,
  #scvb-draggable-sections ~ div {
    max-width: none !important;
  }
}

/* --- PHOTO CROP ADDON STYLES --- */
.sw-scvb-photo-wrap {
  display: flex; gap: 14px; align-items: flex-start;
  background: #f8fafc; border: 1px solid #e2e8f0; 
  border-radius: 12px; padding: 14px; margin: 12px 0 20px;
  flex-wrap: wrap;
}
.sw-scvb-photo-box {
  width: 96px; height: 96px; border: 2px dashed #cbd5e1;
  border-radius: 12px; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: #fff; cursor: pointer; overflow: hidden;
  flex-shrink: 0; transition: all .2s;
  position: relative;
}
.sw-scvb-photo-box:hover { border-color: #ea580c; background: #fff7ed; }
.sw-scvb-photo-box img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.sw-scvb-photo-box .sw-scvb-photo-placeholder { 
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #94a3b8; font-size: 11px; font-weight: 600; text-align: center;
}
.sw-scvb-photo-ctrl { flex: 1; min-width: 220px; }
.sw-scvb-photo-ctrl strong { font-size: 13px; color: #1e293b; }
.sw-scvb-photo-ctrl p { font-size: 11px; color: #64748b; margin: 4px 0 10px; }
.sw-scvb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; font-size: 12px; font-weight: 700;
  cursor: pointer; border: 1px solid #cbd5e1; background: #fff; color: #334155;
  text-decoration: none; transition: all .15s;
}
.sw-scvb-btn:hover { background: #f8fafc; border-color: #94a3b8; }
.sw-scvb-btn--primary {
  background: linear-gradient(135deg,#ff7a18 0%, #ec4899 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 3px 12px rgba(236,72,153,.28);
}
.sw-scvb-btn--primary:hover { filter: brightness(1.05); box-shadow: 0 4px 16px rgba(236,72,153,.35); color: #fff; }
.sw-scvb-btn--danger { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.sw-scvb-btn--danger:hover { background: #fee2e2; }

/* Crop modal — matches SOP Writer 2.0 Pro */
#sw-scvb-crop-modal { position: fixed; inset: 0; z-index: 99999; display: none; }
#sw-scvb-crop-modal.open { display: block; }
.sw-scvb-crop-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.75); backdrop-filter: blur(5px); }
.sw-scvb-crop-dialog {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: #fff; border-radius: 20px; padding: 24px;
  width: min(calc(100vw - 32px), 420px);
  box-shadow: 0 25px 80px rgba(0,0,0,.4);
}
.sw-scvb-crop-dialog h3 { margin: 0 0 14px; font-size: 18px; font-weight: 800; color: #0f172a; }
.sw-scvb-crop-stage { position: relative; width: 340px; height: 340px; max-width: 100%; margin: 0 auto; background: #0f172a; border-radius: 14px; overflow: hidden; }
#sw-scvb-crop-canvas { display: block; width: 340px; height: 340px; max-width: 100%; cursor: grab; touch-action: none; }
#sw-scvb-crop-canvas:active { cursor: grabbing; }
.sw-scvb-crop-frame {
  position: absolute; top: 50%; left: 50%; width: 260px; height: 260px;
  margin-left: -130px; margin-top: -130px;
  border: 2px dashed rgba(255,255,255,.95); border-radius: 50%;
  pointer-events: none; box-shadow: 0 0 0 9999px rgba(0,0,0,.55);
}
.sw-scvb-crop-controls { margin-top: 16px; }
.sw-scvb-crop-controls label { display: block; font-size: 12px; font-weight: 700; color: #475569; margin-bottom: 4px; }
#sw-scvb-crop-zoom { width: 100%; accent-color: #ea580c; }
.sw-scvb-crop-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.sw-scvb-crop-hint { font-size: 11px; color: #64748b; text-align: center; margin: 10px 0 0; }

/* Improve SCVB form elements to match SOP Writer theme */
#scvb-form-col input[type="text"],
#scvb-form-col input[type="email"],
#scvb-form-col input[type="tel"],
#scvb-form-col input[type="url"],
#scvb-form-col textarea,
#scvb-form-col select,
.scvb-field input,
.scvb-field textarea {
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 9px 12px !important;
  font-size: 14px !important;
  transition: border-color .2s, box-shadow .2s !important;
  width: 100%; box-sizing: border-box;
  background: #fff; color: #0f172a;
}
#scvb-form-col input:focus,
#scvb-form-col textarea:focus,
#scvb-form-col select:focus {
  border-color: #ea580c !important;
  box-shadow: 0 0 0 3px rgba(234,88,12,.12) !important;
  outline: none !important;
}

/* SCVB section cards */
#scvb-form-col [id^="sec-"],
.scvb-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(15,23,42,.03);
}

/* SCVB buttons → Orange/Fuchsia gradient */
#scvb-form-col button,
#scvb-form-col .button,
#scvb-form-col input[type="submit"],
.scvb-btn {
  background: linear-gradient(135deg, #ff7a18 0%, #ec4899 100%) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 50px !important;
  padding: 10px 20px !important;
  font-weight: 700 !important;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 4px 14px rgba(236,72,153,.25);
}
#scvb-form-col button:hover,
#scvb-form-col .button:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 20px rgba(236,72,153,.35);
  transform: translateY(-1px);
}

/* Download / print buttons emphasized */
#scvb-download, 
button[id*="download"],
button[id*="print"],
.scvb-download-btn {
  background: linear-gradient(135deg, #ff7a18 0%, #ec4899 100%) !important;
  color: #fff !important;
  font-weight: 800 !important;
  padding: 12px 28px !important;
  font-size: 15px !important;
  border-radius: 50px !important;
}

/* Mobile: stack columns */
@media(max-width:1099px){
  #scvb-form-col,
  .scvb-builder-wrap,
  #scvb-sections {
    display: block !important;
  }
  .sw-scvb-photo-wrap { flex-direction: column; align-items: center; text-align: center; }
}

/* Print: only resume */
@media print {
  body:has(#scvb-form-col) header,
  body:has(#scvb-form-col) footer,
  body:has(#scvb-form-col) .sw-header,
  body:has(#scvb-form-col) .sw-footer,
  body:has(#scvb-form-col) .sw-topbar,
  body:has(#scvb-form-col) .sw-floating,
  body:has(#scvb-form-col) #scvb-form-col > div:not([id*="preview"]):not(.scvb-preview),
  body:has(#scvb-form-col) #sec-personal,
  body:has(#scvb-form-col) #sec-experience,
  body:has(#scvb-form-col) #sec-education,
  body:has(#scvb-form-col) #sec-skills,
  body:has(#scvb-form-col) #sec-languages,
  body:has(#scvb-form-col) #sec-training,
  body:has(#scvb-form-col) #sec-references,
  body:has(#scvb-form-col) #sec-achievements,
  body:has(#scvb-form-col) #sec-custom,
  body:has(#scvb-form-col) .no-print { display: none !important; }
  /* keep CV preview visible */
  #scvb-preview, .scvb-preview-panel, .cv-preview { display: block !important; }
}
