/**
 * In Madra - Fit Tools Recommendation Stylesheet
 *
 * Matching exact Figma aesthetics:
 * 1. Initial questionnaire form (Attached 2)
 * 2. 3-Column interactive recommendation tool (Attached 3, Screenshots 1 & 2)
 * 3. Slide-over "Update Personal Information" drawer (Attached 3, Screenshot 3)
 */

/* ==========================================================================
   0. Wrapper & Reset
   ========================================================================== */
.im-fit-main-wrapper {
  width: 100%;
  min-height: 80vh;
  background-color: #FFFFFF;
  color: #121212;
  font-family: var(--im-font-body, 'Stack Sans Text', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif);
  position: relative;
  overflow-x: hidden;
}

.im-fit-view.is-hidden {
  display: none !important;
}

.im-fit-view.is-active {
  display: block;
}

/* ==========================================================================
   1. VIEW 1: INITIAL QUESTIONNAIRE FORM (ATTACHED 2)
   ========================================================================== */
.im-fit-form-view {
  padding: 3rem 1.5rem 5rem;
  max-width: 600px;
  margin: 0 auto;
}

.im-fit-form-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.im-fit-form-title {
  font-family: inherit;
  font-size: 2rem;
  font-weight: 600;
  color: #111111;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

.im-fit-form-subtitle {
  font-size: 0.95rem;
  color: #707070;
  margin: 0;
  font-weight: 400;
}

.im-fit-standalone-form {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

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

.im-fit-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.im-fit-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #707070;
}

.im-fit-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid #D5D2CB;
  background: transparent;
  padding: 0.5rem 0;
  font-size: 1.05rem;
  color: #111111;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  border-radius: 0;
  transition: border-color 0.2s ease;
}

.im-fit-input:focus {
  border-bottom-color: #111111;
}

.im-fit-unit-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.im-fit-unit-wrap .im-fit-input.im-has-unit {
  padding-right: 2.5rem;
}

.im-fit-unit-tag {
  position: absolute;
  right: 0;
  bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #707070;
  letter-spacing: 0.05em;
  pointer-events: none;
}

.im-fit-select-wrap {
  position: relative;
  border-bottom: 1px solid #D5D2CB;
}

.im-fit-select {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.5rem 2rem 0.5rem 0;
  font-size: 1.05rem;
  color: #111111;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  appearance: none;
  border-radius: 0;
}

.im-fit-select-wrap::after {
  content: '';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-right: 2px solid #555;
  border-bottom: 2px solid #555;
  transform: rotate(45deg);
  pointer-events: none;
}

/* Pills Rows (Usual Size, Fit Preference, Khimar Length) */
.im-fit-pills-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.im-fit-pills-row {
  display: flex;
  gap: 0.6rem;
}

.im-fit-pill {
  flex: 1;
  padding: 0.65rem 0.8rem;
  border: 1px solid #D8D4CC;
  background-color: #FFFFFF;
  color: #111111;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  border-radius: 2px;
}

.im-fit-pill:hover {
  border-color: #111111;
}

.im-fit-pill.active {
  border-color: #111111;
  border-width: 1.5px;
  font-weight: 600;
  background-color: #FFFFFF;
  color: #111111;
}

.im-fit-form-submit-wrap {
  margin-top: 1.25rem;
}

.im-fit-btn-primary {
  width: 100%;
  padding: 0.95rem 1.5rem;
  background-color: #121212;
  color: #FFFFFF;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
  border-radius: 2px;
}

.im-fit-btn-primary:hover {
  background-color: #262626;
}


/* ==========================================================================
   2. VIEW 2: 3-COLUMN INTERACTIVE RECOMMENDATION TOOL (ATTACHED 3)
   ========================================================================== */
.im-fit-tool-view {
  width: 100%;
  border-top: 1px solid #ECEAE5;
}

.im-fit-layout-container {
  display: grid;
  grid-template-columns: 320px 1fr 350px;
  min-height: calc(100vh - 120px);
  width: 100%;
}

/* --------------------------------------------------------------------------
   2.1. LEFT COLUMN: Product Selector & Category Filter
   -------------------------------------------------------------------------- */
.im-fit-col-left {
  border-right: 1px solid #ECEAE5;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background-color: #FFFFFF;
}

.im-fit-left-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8C887E;
  margin-bottom: 0.35rem;
}

.im-fit-left-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111111;
  margin: 0;
  letter-spacing: -0.01em;
}

.im-fit-cat-filters {
  display: flex;
  gap: 0.4rem;
}

.im-fit-cat-pill {
  padding: 0.35rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 500;
  background: transparent;
  border: 1px solid #D8D4CC;
  color: #555555;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.im-fit-cat-pill:hover,
.im-fit-cat-pill.active {
  border-color: #111111;
  color: #111111;
  font-weight: 600;
}

.im-fit-product-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
  padding-right: 4px;
}

.im-fit-product-cards-list::-webkit-scrollbar {
  width: 4px;
}
.im-fit-product-cards-list::-webkit-scrollbar-thumb {
  background: #E0DDD7;
  border-radius: 2px;
}

.im-fit-product-card {
  display: flex;
  gap: 0.85rem;
  padding: 0.6rem;
  border: 1px solid transparent;
  background-color: #FFFFFF;
  cursor: pointer;
  transition: all 0.2s ease;
  align-items: center;
}

.im-fit-product-card:hover {
  background-color: #FAF9F6;
}

.im-fit-product-card.is-active {
  border: 1.5px solid #111111;
  background-color: #FFFFFF;
}

.im-fit-card-thumb {
  width: 44px;
  height: 58px;
  background-color: #F3F1EC;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 1px;
}

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

.im-fit-card-details {
  flex: 1;
  min-width: 0;
}

.im-fit-card-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.2rem;
  gap: 0.5rem;
}

.im-fit-card-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #111111;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.im-fit-card-price {
  font-size: 0.76rem;
  font-weight: 500;
  color: #111111;
  white-space: nowrap;
}

.im-fit-card-row-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.im-fit-card-color {
  font-size: 0.7rem;
  color: #767676;
}

.im-fit-sold-badge {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #8C887E;
  border: 1px solid #D5D2CB;
  padding: 1px 6px;
  position: relative;
}
.im-fit-sold-badge::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #A6A29A;
  transform: rotate(-15deg);
}

/* --------------------------------------------------------------------------
   2.2. CENTER COLUMN: Garment Silhouette & 4 Pointer Callouts
   -------------------------------------------------------------------------- */
.im-fit-col-center {
  padding: 1.5rem 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: #FFFFFF;
}

.im-fit-center-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.im-fit-user-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.95rem;
  border: 1px solid #D8D4CC;
  background: #FFFFFF;
  border-radius: 2px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #111111;
  cursor: pointer;
  transition: all 0.2s ease;
}

.im-fit-user-pill-btn:hover {
  border-color: #111111;
  background-color: #FAF9F6;
}

.im-fit-user-pill-btn svg {
  color: #777777;
}

.im-fit-view-toggle-wrap {
  display: flex;
  border: 1px solid #D8D4CC;
  border-radius: 2px;
  overflow: hidden;
}

.im-fit-toggle-btn {
  padding: 0.35rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  background: #FFFFFF;
  border: none;
  color: #777777;
  cursor: pointer;
  transition: all 0.2s ease;
}

.im-fit-toggle-btn.active {
  background: #FFFFFF;
  color: #111111;
  font-weight: 700;
}

.im-fit-toggle-btn:not(:last-child) {
  border-right: 1px solid #D8D4CC;
}

/* Stage Canvas */
.im-fit-diagram-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 560px;
}

.im-fit-garment-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.im-fit-diagram-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.04));
  transition: opacity 0.3s ease;
}

.im-fit-garment-shadow {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 18px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}

/* 4 Diagram Callout Lines & Texts matching Figma exact pointer ticks */
.im-fit-callout-item {
  position: absolute;
  display: flex;
  align-items: center;
  z-index: 5;
  pointer-events: none;
}

.im-callout-texts {
  font-family: inherit;
}

.im-callout-v {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8C887E;
  line-height: 1.2;
  margin-bottom: 2px;
}

.im-callout-s {
  font-size: 0.92rem;
  font-weight: 700;
  color: #111111;
  line-height: 1.2;
}

.im-callout-line {
  background-color: #D5D2CB;
  height: 1px;
  position: relative;
}

/* Left Callouts (Bust & Length) - T-tick at the RIGHT end facing garment */
.im-callout-bust,
.im-callout-length {
  flex-direction: row;
}

.im-callout-bust .im-callout-texts,
.im-callout-length .im-callout-texts {
  text-align: right;
  margin-right: 10px;
}

.im-callout-bust .im-callout-line,
.im-callout-length .im-callout-line {
  width: 48px;
}

.im-callout-bust .im-callout-line::after,
.im-callout-length .im-callout-line::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 14px;
  background-color: #D5D2CB;
}

/* Right Callouts (Sleeve & Hem) - T-tick at the LEFT end facing garment */
.im-callout-sleeve,
.im-callout-hem {
  flex-direction: row;
}

.im-callout-sleeve .im-callout-line,
.im-callout-hem .im-callout-line {
  width: 48px;
  margin-right: 10px;
}

.im-callout-sleeve .im-callout-line::before,
.im-callout-hem .im-callout-line::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 14px;
  background-color: #D5D2CB;
}

.im-callout-sleeve .im-callout-texts,
.im-callout-hem .im-callout-texts {
  text-align: left;
}

/* Precise Positions based on Figma */
.im-callout-bust {
  top: 15%;
  left: -2%;
}

.im-callout-sleeve {
  top: 25%;
  right: -2%;
}

.im-callout-length {
  bottom: 32%;
  left: -2%;
}

.im-callout-hem {
  bottom: 17%;
  right: -2%;
}


/* --------------------------------------------------------------------------
   2.3. RIGHT COLUMN: Sizing Recommendation & Action Buttons
   -------------------------------------------------------------------------- */
.im-fit-col-right {
  border-left: 1px solid #ECEAE5;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background-color: #FFFFFF;
}

.im-fit-right-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.im-fit-product-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111111;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
}

.im-fit-product-price {
  font-size: 0.95rem;
  font-weight: 500;
  color: #111111;
}

.im-fit-bookmark-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #111111;
  padding: 4px;
}

/* Swatches */
.im-fit-swatch-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.im-fit-swatch-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: #111111;
}

.im-fit-swatches-row {
  display: flex;
  gap: 0.5rem;
}

.im-fit-swatch-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #D8D4CC;
  border-radius: 0;
  cursor: pointer;
  padding: 0;
  position: relative;
}

.im-fit-swatch-btn.active {
  outline: 1.5px solid #111111;
  outline-offset: 2px;
}

/* Asian Size Pills */
.im-fit-size-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.im-fit-section-heading {
  font-size: 0.72rem;
  font-weight: 600;
  color: #707070;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.im-fit-size-pills {
  display: flex;
  gap: 0.5rem;
}

.im-fit-size-pill {
  flex: 1;
  padding: 0.55rem 0.5rem;
  border: 1px solid #D8D4CC;
  background: #FFFFFF;
  color: #111111;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.im-fit-size-pill:hover {
  border-color: #111111;
}

.im-fit-size-pill.active {
  border-color: #111111;
  border-width: 1.5px;
}

.im-fit-size-pill.is-unavailable {
  color: #B5B2AA;
  border-color: #E2DFD8;
  position: relative;
}

.im-fit-size-pill.is-unavailable::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 20%;
  right: 20%;
  height: 1px;
  background: #B5B2AA;
  transform: rotate(-25deg);
}

.im-reco-tag {
  background-color: #111111;
  color: #FFFFFF;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 4px;
  border-radius: 1px;
  text-transform: uppercase;
  margin-left: 2px;
}

/* Narrative Card */
.im-fit-narrative-card {
  background-color: #FAF9F6;
  border: 1px solid #ECE8DF;
  padding: 1.1rem;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.im-fit-narrative-headline {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111111;
  margin: 0;
}

.im-fit-narrative-desc {
  font-size: 0.78rem;
  color: #55534E;
  line-height: 1.45;
  margin: 0;
}

.im-fit-narrative-bullets {
  font-size: 0.74rem;
  color: #706E68;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Size Chart Table */
.im-fit-chart-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.im-fit-chart-heading {
  font-size: 0.72rem;
  font-weight: 600;
  color: #707070;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.im-fit-chart-table {
  width: 100%;
  border-collapse: collapse;
}

.im-fit-chart-table tr {
  border-bottom: 1px solid #F0EEEA;
}

.im-fit-chart-table td {
  padding: 0.45rem 0;
  font-size: 0.78rem;
}

.im-chart-label {
  color: #555555;
  font-weight: 400;
}

.im-chart-value {
  color: #111111;
  font-weight: 600;
  text-align: right;
}

/* Action Buttons */
.im-fit-action-row {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 0.65rem;
  margin-top: auto;
  padding-top: 1rem;
}

.im-fit-action-btn {
  padding: 0.85rem 0.5rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  cursor: pointer;
  border-radius: 2px;
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.im-btn-see-detail {
  background: #FFFFFF;
  border: 1px solid #111111;
  color: #111111;
}

.im-btn-see-detail:hover {
  background: #FAF9F6;
}

.im-btn-add-to-cart {
  background: #121212;
  border: 1px solid #121212;
  color: #FFFFFF;
}

.im-btn-add-to-cart:hover {
  background: #282828;
}


/* ==========================================================================
   3. SLIDE-OVER DRAWER: UPDATE PERSONAL INFORMATION (SCREENSHOT 3)
   ========================================================================== */
.im-fit-drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 99999;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.im-fit-drawer-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.im-fit-drawer-panel {
  width: 440px;
  max-width: 92vw;
  height: 100vh;
  background-color: #FFFFFF;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.im-fit-drawer-overlay.is-open .im-fit-drawer-panel {
  transform: translateX(0);
}

.im-fit-drawer-header {
  padding: 1.5rem 1.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ECEAE5;
}

.im-fit-drawer-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #111111;
  margin: 0;
}

.im-fit-drawer-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #777777;
  padding: 0;
}

.im-fit-drawer-close:hover {
  color: #111111;
}

.im-fit-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem;
}

.im-fit-drawer-footer {
  margin-top: 1.5rem;
}


/* ==========================================================================
   4. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1120px) {
  .im-fit-layout-container {
    grid-template-columns: 280px 1fr 310px;
  }
}

@media (max-width: 960px) {
  .im-fit-layout-container {
    grid-template-columns: 1fr;
  }

  .im-fit-col-left {
    border-right: none;
    border-bottom: 1px solid #ECEAE5;
    padding: 1.5rem;
  }

  .im-fit-product-cards-list {
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
    padding-bottom: 8px;
  }

  .im-fit-product-card {
    min-width: 220px;
  }

  .im-fit-col-center {
    min-height: 500px;
    padding: 1.5rem 1rem;
  }

  .im-fit-garment-wrap {
    height: 480px;
  }

  .im-callout-bust { left: 0%; }
  .im-callout-sleeve { right: 0%; }
  .im-callout-length { left: 0%; }
  .im-callout-hem { right: 0%; }

  .im-fit-col-right {
    border-left: none;
    border-top: 1px solid #ECEAE5;
    padding: 1.75rem 1.25rem;
  }
}

@media (max-width: 600px) {
  .im-fit-form-row {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .im-callout-texts {
    font-size: 85%;
  }

  .im-fit-garment-wrap {
    height: 420px;
  }
}
