/* Visual helpers */
.view-placeholder {
    background: linear-gradient(135deg, #f8fafc 0%, #e6eef8 100%);
    border: 1px dashed rgba(30, 41, 59, 0.08);
}

/* swatch visuals */
.swatch {
    width: 64px;
    height: 64px;
    border-radius: 8px; /* rectangular by default */
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
    border: 4px solid transparent;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Larger swatches for style step */
[data-step="style"] .swatch {
    width: 100px;
    height: 100px;
}

/* Unified size for size, frame_type, and frame_color steps */
[data-step="size"] .size-preview-img,
[data-step="frame_type"] .swatch,
[data-step="frame_color"] .swatch {
    width: 120px;
    height: 120px;
}

/* Frame step swatches get explicit borders (applied via JS) */
[data-step="frame_type"] .swatch,
[data-step="frame_color"] .swatch {
    border: 4px solid #e2e8f0; /* default unselected */
}

/* when we want circular swatches (background thumbnails) */
.swatch-circle {
    border-radius: 9999px;
}

/* small visible black frame around icons */
.swatch-frame {
    border: 1px solid #000;
    padding: 4px;
    box-sizing: content-box;
    border-radius: 8px;
    display: inline-block;
}

/* rectangular size icon */
.size-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #000;
    padding: 6px;
}

.size-plate {
    position: relative;
    background: #fff;
    box-sizing: border-box;
}

.size-nail-area {
    position: absolute;
    background: #d0d0d0; /* gray nail area */
    box-sizing: border-box;
}

.swatch-label {
    font-size: 14px;
    color: #374151;
    margin-top: 8px;
    text-align: center;
    max-width: 88px;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Unified label width for size, frame_type, and frame_color swatches */
[data-step="size"] .swatch-label,
[data-step="frame_type"] .swatch-label,
[data-step="frame_color"] .swatch-label {
    max-width: 140px;
}

.swatch-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    cursor: pointer;
}

/* Only apply selected styling to style and background steps, not frame steps */
[data-step="style"] .swatch.selected,
[data-step="background_type"] .swatch.selected {
    border-color: rgba(15, 23, 42, 0.12);
    transform: translateY(-6px);
}

/* stepper arrows/circle */
.arrow-btn {
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    background: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(2, 6, 23, 0.06);
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
    margin-top: 2px;
}

.arrow-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.12);
}

/* Circular action buttons (upload, crop, zoom) */
button[id="uploadImageBtn"],
button[id="cropBtn"],
button[id="zoomInBtn"],
button[id="zoomOutBtn"] {
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

button[id="uploadImageBtn"]:hover,
button[id="cropBtn"]:hover,
button[id="zoomInBtn"]:hover,
button[id="zoomOutBtn"]:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.15);
    background-color: #f9fafb;
}

button[id="uploadImageBtn"]:active,
button[id="cropBtn"]:active,
button[id="zoomInBtn"]:active,
button[id="zoomOutBtn"]:active {
    transform: scale(0.98);
}

/* Pulsating animation for upload button when user hasn't uploaded yet */
@keyframes uploadBtnPulsate {
    0%,
    100% {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        outline: 3px solid transparent;
        outline-offset: 2px;
    }
    50% {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        outline: 3px solid #2563eb;
        outline-offset: 2px;
    }
}

button[id="uploadImageBtn"].pulsate-upload {
    animation: uploadBtnPulsate 2s ease-in-out infinite;
}

/* Upload help tooltip styles */
#uploadHelpTooltip {
    animation: tooltipFadeIn 0.3s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Subtle bounce animation for the arrow in tooltip - synchronized with pulsating ring */
#uploadHelpTooltip svg {
    animation: arrowBounce 2s ease-in-out infinite;
}

@keyframes arrowBounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

#zoomControls {
    z-index: 10;
}

/* progress bar */
/* Step Indicator Styles */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 0 0px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    position: relative;
    z-index: 2;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
    padding: 0;
    outline: none;
}

.step-circle:hover {
    transform: scale(1.1);
}

.step-circle:active {
    transform: scale(0.95);
}

/* Completed step */
.step-circle.completed {
    background: white;
    color: #2563eb;
    border: 3px solid #2563eb;
}

/* Current step */
.step-circle.current {
    background: white;
    color: #2563eb;
    border: 3px solid #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    cursor: default;
}

.step-circle.current:hover {
    transform: scale(1);
}

/* Future step */
.step-circle.future {
    background: white;
    color: #94a3b8;
    border: 3px solid #e2e8f0;
}

/* Show number for completed steps */
.step-circle.completed .step-number {
    display: inline;
}

/* Connecting line */
.step-line {
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 3px;
    background: #e2e8f0;
    z-index: 1;
    transition: background 0.3s ease;
}

.step-line.completed {
    background: #2563eb;
}

/* Hide line after last step */
.step-item:last-child .step-line {
    display: none;
}

/* Step label (optional, hidden by default) */
.step-label {
    margin-top: 8px;
    font-size: 12px;
    color: #64748b;
    text-align: center;
    display: none;
}

.step-circle.current + .step-label {
    color: #2563eb;
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .step-indicator {
        padding: 0 5px;
    }

    .step-circle {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .step-line {
        top: 16px;
    }
}

/* Extra small screens (360px and below) */
@media (max-width: 420px) {
    .step-indicator {
        padding: 0 2px;
    }

    .step-circle {
        width: 28px;
        height: 28px;
        font-size: 12px;
        border-width: 2px;
    }

    .step-circle.current {
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

    .step-line {
        top: 14px;
        height: 2px;
    }
}

/* small responsive tweaks */
@media (min-width: 1024px) {
    .swatch {
        width: 48px;
        height: 48px;
    }

    /* Keep style swatches large on desktop too */
    [data-step="style"] .swatch {
        width: 100px;
        height: 100px;
    }

    /* Unified size for size, frame_type, and frame_color on desktop */
    [data-step="size"] .size-preview-img,
    [data-step="frame_type"] .swatch,
    [data-step="frame_color"] .swatch {
        width: 120px !important;
        height: 120px !important;
    }
}

.upload-drop {
    border: 2px dashed #e6e6e6;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    background: #fff;
}

/* Utility: viewer min-height extracted from inline HTML */
.view-min-h {
    min-height: 320px;
}

/* Size options layout */
.size-option-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 11px;
    cursor: pointer;
}

/* Swatch pricing labels */
.swatch-price {
    text-align: center;
    white-space: nowrap;
}

.swatch-wrap:hover .swatch-price {
    color: #1e293b;
}

/* Adjust label widths for pricing */
.swatch-wrap {
    max-width: 100px;
}

/* Unified wrap width for size, frame_type, and frame_color */
[data-step="size"] .swatch-wrap,
[data-step="size"] .size-option-wrap,
[data-step="frame_type"] .swatch-wrap,
[data-step="frame_color"] .swatch-wrap {
    max-width: 150px;
}

[data-step="background_type"] .swatch-wrap {
    max-width: 100px;
}

/* Receipt-style summary */
#receiptItems {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
    min-height: 60px;
}

/* Receipt line items */
.receipt-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 0;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.receipt-line:last-child {
    border-bottom: none;
}

.receipt-line-clickable {
    cursor: pointer;
    padding: 2px 6px;
    margin: 0 -6px;
    border-radius: 4px;
}

.receipt-line-clickable:hover {
    background: rgba(15, 23, 42, 0.04);
    color: #1e293b;
}

.receipt-line-clickable:hover .receipt-label {
    text-decoration: underline;
}

.receipt-line-clickable:active {
    background: rgba(15, 23, 42, 0.08);
    transform: scale(0.99);
}

.receipt-label {
    font-size: 15px;
    flex: 1;
}

.receipt-price {
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    margin-left: 16px;
}

.receipt-included {
    color: #64748b;
    font-weight: 400;
}

/* Placeholder text styling */
.receipt-placeholder {
    color: #94a3b8;
    text-align: center;
    padding: 20px 0;
    font-size: 14px;
}

/* Total row styling */
.border-t.pt-3 {
    margin-top: 4px;
}

/* Details/Summary accordion styling */
details summary {
    list-style: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::marker {
    display: none;
}

details[open] summary {
    border-bottom: 1px solid #e2e8f0;
}

/* Loading spinner animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Loading indicator pulse effect */
@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Loading container transitions */

/* Add to Cart button loading animation */
@keyframes spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Pulse effect for adding to cart */
@keyframes buttonPulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(0.98);
    }
}

/* Add to cart loading state */
#addToCart.adding-to-cart {
    position: relative;
    pointer-events: none;
    animation: buttonPulse 2s ease-in-out infinite;
}

#addToCart.adding-to-cart::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
    vertical-align: middle;
}

/* AR QR Code button loading animation */
.ar-qr-button-loading {
    position: relative;
    pointer-events: none;
}

.ar-qr-button-loading::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
    vertical-align: middle;
}

.ar-qr-button-loading {
    animation: buttonPulse 2s ease-in-out infinite;
}

/* Pulsate arrow animation for next step guidance */
@keyframes arrowPulsate {
    0%,
    100% {
        box-shadow: 0 6px 14px rgba(2, 6, 23, 0.06);
        outline: 3px solid transparent;
        outline-offset: 2px;
    }
    50% {
        box-shadow: 0 6px 14px rgba(2, 6, 23, 0.06);
        outline: 3px solid #2563eb;
        outline-offset: 2px;
    }
}

.arrow-btn.pulsate-next {
    animation: arrowPulsate 2.1s ease-in-out infinite;
}

.arrow-btn.pulsate-next svg {
    color: #2563eb;
}

/* Pulsating blue outline for Upload section */
@keyframes uploadButtonPulsate {
    0%,
    100% {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        outline: 3px solid transparent;
        outline-offset: 2px;
    }
    50% {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        outline: 3px solid #2563eb;
        outline-offset: 2px;
    }
}

.pulsate-upload {
    animation: uploadButtonPulsate 2.1s ease-in-out infinite;
    transition: all 0.3s ease;
}

.pulsate-upload:hover {
    transform: scale(1.005);
}

/* Info Modal Styles */
.info-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    padding: 20px;
}

.info-modal-overlay.show {
    opacity: 1;
}

.info-modal-container {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform 0.3s ease-in-out;
}

.info-modal-overlay.show .info-modal-container {
    transform: scale(1);
}

.info-modal-header {
    display: flex;
    justify-content: flex-end;
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.info-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
}

.info-modal-close:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
    transform: scale(1.1);
}

.info-modal-close:active {
    transform: scale(0.95);
}

.info-modal-content {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.info-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0 0 12px 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .info-modal-overlay {
        padding: 10px;
    }

    .info-modal-container {
        height: 95vh;
        max-height: none;
    }

    .info-modal-header {
        padding: 12px;
    }
}

/* Choice Modal Styles */
.choice-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    padding: 20px;
}

.choice-modal-overlay.show {
    opacity: 1;
}

.choice-modal-container {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform 0.3s ease-in-out;
}

.choice-modal-overlay.show .choice-modal-container {
    transform: scale(1);
}

.choice-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.choice-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.choice-modal-body {
    padding: 24px;
}

.choice-modal-message {
    font-size: 15px;
    color: #475569;
    line-height: 1.6;
    margin: 0;
}

.choice-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.choice-modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.choice-modal-btn-primary {
    background: #2563eb;
    color: white;
}

.choice-modal-btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.choice-modal-btn-primary:active {
    transform: translateY(0);
}

.choice-modal-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.choice-modal-btn-secondary:hover {
    background: #e2e8f0;
}

.choice-modal-btn-secondary:active {
    background: #cbd5e1;
}

/* Notification Modal Styles */
.notification-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    padding: 20px;
}

.notification-modal-overlay.show {
    opacity: 1;
}

.notification-modal-container {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform 0.3s ease-in-out;
}

.notification-modal-overlay.show .notification-modal-container {
    transform: scale(1);
}

.notification-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.notification-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.notification-modal-body {
    padding: 24px;
}

.notification-modal-message {
    font-size: 15px;
    color: #475569;
    line-height: 1.6;
    margin: 0;
}

.notification-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: center;
}

.notification-modal-btn {
    padding: 10px 32px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.notification-modal-btn-primary {
    background: #2563eb;
    color: white;
}

.notification-modal-btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.notification-modal-btn-primary:active {
    transform: translateY(0);
}

/* Disabled Option Styles */
.disabled-option {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
    position: relative;
}

.disabled-option-label {
    display: block;
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
    text-align: center;
    margin-top: 4px;
}

/* Tooltip for disabled options */
.disabled-tooltip {
    position: relative;
}

.disabled-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 8px;
    pointer-events: none;
}

.disabled-tooltip:hover::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    margin-bottom: 2px;
    pointer-events: none;
}

/* Responsive modal adjustments */
@media (max-width: 768px) {
    .choice-modal-container,
    .notification-modal-container {
        max-width: 90%;
    }

    .choice-modal-header,
    .notification-modal-header {
        padding: 20px 20px 12px;
    }

    .choice-modal-body,
    .notification-modal-body {
        padding: 20px;
    }

    .choice-modal-footer,
    .notification-modal-footer {
        padding: 12px 20px 20px;
    }

    .choice-modal-footer {
        flex-direction: column-reverse;
    }

    .choice-modal-btn {
        width: 100%;
    }
}

/* Sticky step navigation - container handling */
#step_nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: white;
    padding: 1rem;
    padding-bottom: 1rem;
    margin: -1rem -1rem 1rem -1rem;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0.5rem 0.5rem 0 0;
}

/* Add box shadow when step_nav is stuck */
#step_nav::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

/* Show shadow when scrolled (requires JS to add class) */
#step_nav.is-stuck::after {
    opacity: 1;
}
