/* ==========================================================================
1. BASE SETTINGS
========================================================================== */
.ags-vto-wrapper { min-height: 100vh; display: flex; }
.ags-vto-wrapper * { box-sizing: inherit; }
.ags-vto-view { display: none; animation: fadeIn 0.4s ease; width: 100%; }
.ags-vto-view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   2. TYPOGRAPHY
   ========================================================================== */
.ags-vto-title { font-size: 1.5rem; font-weight: 600; color: #111827; margin: 0 0 0.5rem 0; line-height: 1.2; }
.ags-vto-desc { font-size: 0.875rem; color: #4b5563; margin-bottom: 1.5rem; }
.ags-vto-wrapper h3 { font-size: 1.125rem; font-weight: 600; color: #111827; border-bottom: 1px solid #f3f4f6; padding-bottom: 0.625rem; margin-bottom: 1.25rem; }

/* ==========================================================================
   3. BUTTONS
   ========================================================================== */
.ags-btn-primary, .ags-btn-outline { padding: 0.75rem 1.5rem; border-radius: 12rem; font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all 0.2s; width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.ags-btn-primary { background-color: #111827; color: #ffffff; border: 1px solid #111827; }
.ags-btn-primary:hover:not(:disabled) { background-color: #374151; border-color: #374151; }
.ags-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.ags-btn-outline { background-color: transparent; color: #111827; border: 1px solid #d1d5db; }
.ags-btn-outline:hover:not(:disabled) { background-color: #f9fafb; border-color: #111827; }
.ags-action-buttons { display: flex; gap: 0.75rem; margin-top: 0.5rem; }
.ags-action-buttons .ags-btn-primary { max-width: 200px; }
#ags-btn-generate-fit { border-radius: 12px; }

/* ==========================================================================
   4. UPLOAD VIEW
   ========================================================================== */
#ags-vto-view-upload { text-align: center; max-width: 30rem; margin: auto; padding: 2rem; }
#ags-vto-view-upload h2 { margin-bottom: 0.5rem; font-size: 1.5rem; font-weight: 600; }
#ags-vto-view-upload p { color: #4b5563; margin-bottom: 2.5rem; font-size: 0.875rem; line-height: 1.5; }
.upload-btn-group { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }

/* ==========================================================================
   5. SPLIT LAYOUT
   ========================================================================== */
.ags-vto-split-layout { display: flex; flex-wrap: wrap; width: 100%; align-items: flex-start;}
.ags-vto-col-left { width: 50%; position: sticky; top: 0; min-height: auto; display: flex; align-items: flex-start; justify-content: flex-start;  }
.ags-vto-image-container { width: 100%; height: auto; min-height: 100vh;  }
.ags-vto-image-container img { width: 100%; height: auto; object-fit: cover; transition: opacity 0.3s ease; margin: 0;}
.ags-generation-loader { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background-color: rgba(250, 250, 250, 0.25); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); z-index: 5; }
.ags-spinner-icon { width: 40px; height: 40px; border: 3px solid rgba(17, 24, 39, 0.1); border-left-color: #111827; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes pulseBg { 0% { background-color: #ffffff; } 50% { background-color: #f3f4f6; } 100% { background-color: #ffffff; } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.ags-vto-col-right { width: 50%; }
.ags-vto-info-sticky { min-height: 90vh; display: flex; flex-direction: column; justify-content: center; padding: 80px 8% 40px; }

/* ==========================================================================
   6. CARDS AND FORMS
   ========================================================================== */
.ags-info-card { display: flex; align-items: center; gap: 1rem; padding: 1rem; border: 1px solid #e5e7eb; border-radius: 0.5rem; background-color: #ffffff; margin-bottom: 1.25rem; transition: border-color 0.2s, box-shadow 0.2s; }
.ags-info-card.ags-clickable { cursor: pointer; }
.ags-info-card.ags-clickable:hover { border-color: #d1d5db; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.ags-personal-card { align-items: flex-start; }
.ags-avatar-circle { width: 3.5rem; height: 3.5rem; border-radius: 50%; overflow: hidden; background-color: #f3f4f6; flex-shrink: 0; border: 1px solid #e5e7eb; }
.ags-avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.ags-card-content { flex: 1; min-width: 0; }
.ags-card-content h4 { font-size: 0.875rem; font-weight: 600; color: #111827; margin: 0 0 0.25rem 0; }
.ags-card-content p { font-size: 0.75rem; color: #6b7280; margin: 0; line-height: 1.4; }
.ags-input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 0.75rem; }
.ags-input-group { display: flex; flex-direction: column; }
.ags-input-group.full-width { grid-column: span 2; }
.ags-input-group label { font-size: 0.75rem; font-weight: 600; color: #4b5563; margin-bottom: 0.375rem; }
.ags-form-input { width: 100%; padding: 0.625rem 0.75rem; border: 1px solid #d1d5db; border-radius: 0.375rem; font-size: 0.875rem; color: #111827; outline: none; transition: border-color 0.2s, box-shadow 0.2s; background: #fff; appearance: none; }
.ags-form-input:focus { border-color: #111827; box-shadow: 0 0 0 1px #111827; }
.ags-form-input::placeholder { color: #9ca3af; }
.ags-fitting-hint { font-size: 0.6875rem; color: #6b7280; font-style: italic; margin: 0 0 1.5rem 0; }

/* ==========================================================================
   7. MODAL AND CROPPER
   ========================================================================== */
.ags-modal-overlay { position: fixed; inset: 0; background-color: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); z-index: 99999; display: none; align-items: center; justify-content: center; padding: 20px; opacity: 0; transition: opacity 0.3s ease; }
.ags-modal-overlay.active { display: flex; opacity: 1; }
.ags-modal-content { background: #fff; border-radius: 12px; width: 100%; max-width: 500px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); overflow: hidden; display: flex; flex-direction: column; max-height: 90vh; }
.ags-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #f3f4f6; }
.ags-modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; border: none; padding: 0; }
.ags-modal-close { cursor: pointer; color: #9ca3af; transition: color 0.2s; background: none; border: none; font-size: 20px; }
.ags-modal-close:hover { color: #111827; }
.ags-modal-tip { background-color: #eff6ff; color: #1e40af; font-size: 12px; padding: 12px 20px; border-bottom: 1px solid #bfdbfe; }
.ags-modal-body { padding: 0; display: flex; align-items: center; justify-content: center; flex: 1; min-height: 350px; overflow: hidden; }
.ags-modal-footer { padding: 16px 20px; display: flex; justify-content: flex-end; gap: 12px; background: #fff; border-top: 1px solid #f3f4f6; }
.ags-camera-modal-content { max-width: 560px; }
.ags-camera-modal-body { background: #111827; min-height: 420px; position: relative; padding: 0; }
.ags-camera-modal-body video,
.ags-camera-modal-body img { display: block; width: 100%; height: 100%; max-height: 70vh; object-fit: contain; background: #111827; }
.ags-camera-modal-body video[hidden],
.ags-camera-modal-body img[hidden] { display: none; }
.ags-camera-modal-footer { flex-wrap: wrap; }
.cropper-view-box, .cropper-face { border-radius: 50%; }
.cropper-line { display: none !important; }
.cropper-point { opacity: 0.5; }
.cropper-view-box { outline: 2px solid #fff; outline-color: rgba(255, 255, 255, 0.75); }

/* ==========================================================================
   8. INTL-TEL-INPUT
   ========================================================================== */
.iti { width: 100%; }
.iti__flag-container { z-index: 10; }
.ags-vto-wrapper .iti input.ags-form-input { padding-left: 3.25rem; }

/* ==========================================================================
   9. SLIDE-OUT PANEL
   ========================================================================== */
body.ags-vto-panel-open { overflow: hidden; }
.ags-product-panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99990; display: none; opacity: 0; transition: opacity 0.3s; }
.ags-product-panel-overlay.active { display: block; opacity: 1; }
.ags-product-panel { position: fixed; top: 0; right: -100%; width: 450px; max-width: 100%; height: 100vh; background: #fff; z-index: 99995; box-shadow: -5px 0 25px rgba(0,0,0,0.15); transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; }
.ags-product-panel.active { right: 0; }
.ags-panel-header { padding: 20px 24px; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; }
.ags-panel-header h3 { margin: 0; font-size: 1.125rem; font-weight: 600; border: none; padding: 0; }
.ags-panel-close { cursor: pointer; color: #9ca3af; transition: color 0.2s; background: none; border: none; font-size: 24px; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; line-height: 1;padding: 0;background: transparent !important;}
.ags-panel-close:hover { color: #111827; background: #f3f4f6; }
   .ags-panel-body { padding: 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; }
   .ags-panel-loader { display: flex; align-items: center; justify-content: center; flex: 1; }
   .ags-panel-gallery { margin-bottom: 20px; }
   .ags-panel-gallery-main { position: relative; aspect-ratio: 3 / 4; background: #f5f5f5; border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
   .ags-panel-img { width: 100%; height: 100%; border-radius: 12px; object-fit: cover; display: block; }
   .ags-panel-gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: none; border-radius: 12px; background: rgba(255,255,255,.92); color: #111827; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 8px 20px rgba(0,0,0,.12); z-index: 2; padding: 0;}
   .ags-panel-gallery-prev { left: 12px; }
   .ags-panel-gallery-next { right: 12px; }
   .ags-panel-gallery-thumbs { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
   .ags-panel-gallery-thumbs::-webkit-scrollbar { display: none; }
   .ags-panel-thumb { width: 68px; height: 90px; border: 1px solid #e5e7eb; border-radius: 10px; padding: 0; background: #fff; overflow: hidden; flex: 0 0 auto; cursor: pointer; }
   .ags-panel-thumb.is-active { border-color: #aaabae; box-shadow: 0 0 0 1px #707276 inset; }
   .ags-panel-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
   .ags-panel-meta { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; padding: 16px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px; }
   .ags-panel-meta-row { display: flex; justify-content: space-between; gap: 16px; }
   .ags-panel-meta-label { font-size: 0.75rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
   .ags-panel-meta-value { font-size: 0.875rem; font-weight: 500; color: #111827; text-align: right; }
   .ags-panel-meta-link { text-decoration: none; }
   .ags-panel-meta-link.is-link:hover { text-decoration: underline; }
   .ags-panel-meta-link[aria-disabled="true"] { pointer-events: none; }
   .ags-panel-section { margin-bottom: 18px; }
   .ags-panel-section-title { font-size: 0.75rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
   .ags-panel-badges { display: flex; flex-wrap: wrap; gap: 8px; }
   .ags-panel-badge { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 12px; background: #f3f4f6; color: #111827; font-size: 0.8125rem; font-weight: 500; border: 1px solid transparent; }
   .ags-panel-type-option { appearance: none; cursor: pointer; transition: background-color .2s ease, border-color .2s ease, color .2s ease; }
   .ags-panel-type-option:hover { background: #e5e7eb; color: #333; }
   .ags-panel-type-option.is-tried:not(.is-active) { background: #fff; border-color: #d1d5db; }
.ags-panel-badge.is-active { background: #111827; color: #fff; }   
.ags-panel-empty { color: #9ca3af; font-size: 0.875rem; }
   .ags-panel-hint { color: #6b7280; font-size: 0.875rem; margin: 0 0 20px; }

/* ==========================================================================
   10. OUTFIT STACK
   ========================================================================== */
.ags-outfit-stack-container { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px; margin-bottom: 20px; }
.ags-outfit-stack-container h3 { font-size: 0.875rem; color: #4b5563; margin-top: 0; margin-bottom: 12px; border: none; padding: 0; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.ags-outfit-stack-list { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.ags-outfit-stack-list::-webkit-scrollbar { height: 6px; }
.ags-outfit-stack-list::-webkit-scrollbar-thumb { background-color: #d1d5db; border-radius: 10px; }
.ags-stack-item { width: 64px; height: 64px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; object-fit: cover; flex-shrink: 0; scroll-snap-align: start; transition: transform 0.2s, border-color 0.2s; padding: 2px; }
.ags-stack-item.active { border-color: #111827; }

/* ==========================================================================
   11. VTO SIDEBAR
   ========================================================================== */
.ags-vto-sidebar-section { margin-top: 1rem; }
.ags-vto-search { position: relative; margin-bottom: 1rem; }
.ags-vto-search__input { width: 100%; padding: 0.75rem 0.875rem; border: 1px solid #d1d5db; border-radius: 12px; font-size: 0.875rem; color: #111827; background: #fff; min-height: 44px; }
.ags-vto-search__input:focus { outline: none; border-color: #111827; box-shadow: 0 0 0 1px #111827; }
.ags-vto-search__results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: rgba(255,255,255,.98); border: 1px solid #e5e7eb; border-radius: 16px; box-shadow: 0 16px 32px rgba(17,24,39,.08); z-index: 10; overflow: hidden; }
.ags-vto-search__item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; border: none; background: transparent; text-align: left; cursor: pointer; }
.ags-vto-search__item:hover { background: #f9fafb; }
.ags-vto-search__item + .ags-vto-search__item { border-top: 1px solid #f3f4f6; }
.ags-vto-search__item-media { width: 52px; height: 68px; border-radius: 12px; overflow: hidden; background: #f3f4f6; flex: 0 0 auto; }
.ags-vto-search__item-media img,
.ags-vto-search__item-placeholder { width: 100%; height: 100%; display: block; object-fit: cover; }
.ags-vto-search__item-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ags-vto-search__item-title { font-size: 0.875rem; font-weight: 600; color: #111827; }
.ags-vto-search__item-meta { font-size: 0.75rem; color: #6b7280; }
.ags-vto-search__empty,
.ags-vto-sidebar-empty { font-size: 0.875rem; color: #9ca3af; margin: 0; }
.ags-vto-search__empty { padding: 14px 16px; }
.ags-vto-category-links { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 4px; }
.ags-vto-category-link { font-size: 0.875rem; color: #4b5563; text-decoration: none; }
.ags-vto-category-link:hover { color: #111827; text-decoration: underline; }
.ags-vto-product-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.ags-vto-product-tile { width: 70px; border: none; padding: 0; background: transparent; text-align: left; cursor: pointer; }
.ags-vto-product-tile__media { width: 70px; height: 70px; display: block; overflow: hidden; border-radius: 12px; background: #f3f4f6; margin-bottom: 6px; }
.ags-vto-product-tile__media img,
.ags-vto-product-tile__placeholder { width: 100%; height: 100%; display: block; object-fit: cover; }
.ags-vto-product-tile__title { display: block; font-size: 0.6875rem; line-height: 1.3; color: #111827; word-break: break-word; }

/* ==========================================================================
   12. MINIFIED FLOATING CONTROLS
   ========================================================================== */
.ags-vto-col-left{position:relative}
   .ags-floating-controls{position:absolute;bottom:30px;left:50%;transform:translateX(-50%);z-index:50;display:flex;align-items:center;background:rgba(255,255,255,.85);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);padding:4px;border-radius:16px;box-shadow:0 10px 25px rgba(0,0,0,.1);border:1px solid rgba(255,255,255,.6)}
   .ags-fc-divider{width:1px;height:24px;background:rgba(0,0,0,.1);margin:0 4px}
   .ags-fc-dropdown{position:relative}
      .ags-fc-btn{display:flex;align-items:center;justify-content:center;gap:8px;padding:0 10px;height:36px;background:0 0;border:none;border-radius:10px;color:#4b5563;cursor:pointer;transition:all .2s ease;font-weight:500;font-size:.875rem;white-space:nowrap}
      .ags-fc-btn.active,.ags-fc-btn:hover{background:rgba(17,24,39,.05);color:#111827}
      .ags-fc-text{display:inline-block}
      .ags-btn-product-panel{padding:0 12px}
      .ags-fc-text--product{display:inline-block;font-size:.8125rem;font-weight:600}
      .ags-fc-menu{position:absolute;bottom:calc(100% + 15px);left:50%;transform:translateX(-50%) translateY(10px);background: rgba(255,255,255,.95);border-radius:12px;box-shadow:0 10px 30px rgba(0,0,0,.15);padding:8px 0;min-width:200px;opacity:0;visibility:hidden;transition:all .2s cubic-bezier(.16,1,.3,1);display:flex;flex-direction:column;pointer-events:none;border:1px solid #f3f4f6}
   .ags-fc-menu::after{content:'';position:absolute;bottom:-6px;left:50%;transform:translateX(-50%) rotate(45deg);width:12px;height:12px;background: rgba(255,255,255,.95);border-right:1px solid #f3f4f6;border-bottom:1px solid #f3f4f6}
   .ags-fc-menu.active{opacity:1;visibility:visible;transform:translateX(-50%) translateY(0);pointer-events:auto}
   .ags-fc-option{padding:12px 16px;text-align:left;background:0 0;border:none;width:100%;font-size:.875rem;color:#374151;cursor:pointer;transition:background .2s;font-weight:500}
   .ags-fc-option:hover{background:#f3f4f6;color:#111827}
   .ags-fc-option.is-disabled,
   .ags-fc-option:disabled{opacity:.45;cursor:not-allowed;background:transparent;color:#9ca3af}
      @media (max-width:768px){.ags-fc-text{display:none}.ags-fc-btn{padding:0;width:44px;border-radius:50%}.ags-btn-product-panel{width:auto;padding:0 12px;border-radius:10px}.ags-btn-product-panel .ags-fc-text--product{display:inline-block}}

/* ==========================================================================
   13. MEDIA QUERIES
   ========================================================================== */

@media (min-width: 991px) {
    .ags-vto-image-container img { border-radius: 0 0 16px 0; }
}

@media (max-width: 992px) {
    .ags-vto-col-left, .ags-vto-col-right { width: 100%; display: block; }
    .ags-vto-col-left { position: relative; height: auto; }
    .ags-vto-info-sticky { min-height: auto; padding: 20px 20px 60px 20px; justify-content: flex-start; }
}
@media (max-width: 480px) {
    .ags-input-grid { grid-template-columns: 1fr; }
    .ags-input-group.full-width { grid-column: span 1; }
    .ags-action-buttons { flex-direction: column-reverse; }
    .ags-action-buttons .ags-btn-primary, .ags-action-buttons .ags-btn-outline { max-width: 100%; }
    .ags-vto-product-grid { gap: 10px; }
}
