/* ==========================================================================
   ART SPACE — CRO ENGINE COMPONENT STYLES (2026 PRODUCTION)
   One-Click Order, Smart Upsell, Mobile Sticky Bar, Phone Input Masking
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ONE-CLICK ORDER BUTTON & MODAL
   -------------------------------------------------------------------------- */
.detail-oneclick-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    padding: 0 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    background: linear-gradient(135deg, #ff9500 0%, #ff5e3a 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 14px rgba(255, 149, 0, 0.32);
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.detail-oneclick-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 149, 0, 0.45);
    color: #ffffff;
}

.detail-oneclick-btn:active {
    transform: translateY(0) scale(0.97);
}

.detail-oneclick-btn svg,
.detail-oneclick-btn i {
    stroke-width: 2.2;
    flex-shrink: 0;
}

/* Modal One-Click Styling */
.cro-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 15, 29, 0.68);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999990;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.cro-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cro-modal-card {
    background: var(--bg-card, #ffffff);
    color: var(--text-primary, #111111);
    width: 100%;
    max-width: 480px;
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    transform: translateY(24px) scale(0.96);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
}

.cro-modal-overlay.active .cro-modal-card {
    transform: translateY(0) scale(1);
}

.cro-modal-header {
    padding: 20px 24px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f0f0f4;
}

html.dark-theme .cro-modal-header {
    border-color: rgba(255, 255, 255, 0.08);
}

.cro-modal-title {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.3px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cro-modal-close {
    background: #f2f2f7;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #636366;
    transition: background 0.15s ease;
}

html.dark-theme .cro-modal-close {
    background: rgba(255, 255, 255, 0.1);
    color: #aeaeb2;
}

.cro-modal-close:hover {
    background: #e5e5ea;
    color: #000;
}

.cro-modal-body {
    padding: 20px 24px 24px;
}

.cro-product-preview {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 14px;
    background: #f8f9fc;
    border-radius: 16px;
    margin-bottom: 20px;
    border: 1px solid #eef0f5;
}

html.dark-theme .cro-product-preview {
    background: #181a24;
    border-color: rgba(255, 255, 255, 0.08);
}

.cro-product-thumb {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    background: #fff;
    flex-shrink: 0;
}

.cro-product-info {
    flex: 1;
    min-width: 0;
}

.cro-product-name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cro-product-price {
    font-size: 16px;
    font-weight: 900;
    color: #005bff;
}

/* Messenger Action Buttons */
.cro-messenger-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.cro-btn-messenger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cro-btn-whatsapp {
    background: #25d366;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3);
}

.cro-btn-whatsapp:hover {
    background: #22bf5b;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 211, 102, 0.45);
    color: #fff;
}

.cro-btn-telegram {
    background: #0088cc;
    box-shadow: 0 4px 14px rgba(0, 136, 204, 0.3);
}

.cro-btn-telegram:hover {
    background: #007bb8;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 136, 204, 0.45);
    color: #fff;
}

.cro-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 18px 0;
    color: #8e8e93;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cro-divider::before,
.cro-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e5e5ea;
}

html.dark-theme .cro-divider::before,
html.dark-theme .cro-divider::after {
    border-color: rgba(255, 255, 255, 0.08);
}

.cro-divider span {
    padding: 0 10px;
}

.cro-form-field {
    margin-bottom: 14px;
}

.cro-form-field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #636366;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

html.dark-theme .cro-form-field label {
    color: #aeaeb2;
}

.cro-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1.5px solid #d1d1d6;
    background: #f9f9fb;
    font-size: 16px;
    color: #111;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

html.dark-theme .cro-input {
    background: #202330;
    border-color: #383b4e;
    color: #ffffff;
}

.cro-input:focus {
    border-color: #005bff;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 91, 255, 0.12);
}

html.dark-theme .cro-input:focus {
    background: #1a1c28;
    border-color: #0a84ff;
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.22);
}

.cro-input.valid {
    border-color: #34c759;
    background-color: rgba(52, 199, 89, 0.04);
}

.cro-btn-submit {
    width: 100%;
    height: 50px;
    background: #005bff;
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 91, 255, 0.3);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.cro-btn-submit:hover {
    background: #004ad0;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 91, 255, 0.4);
}

.cro-btn-submit:active {
    transform: scale(0.98);
}

.cro-guarantee-note {
    text-align: center;
    font-size: 11px;
    color: #8e8e93;
    margin-top: 12px;
    line-height: 1.4;
}

/* --------------------------------------------------------------------------
   2. SMART UPSELL MODULE (IN-CART RECOMMENDATIONS)
   -------------------------------------------------------------------------- */
.smart-upsell-wrapper {
    margin: 30px 0 20px;
    background: var(--bg-card, #ffffff);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid #eef0f5;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

html.dark-theme .smart-upsell-wrapper {
    background: #181920;
    border-color: rgba(255, 255, 255, 0.08);
}

.smart-upsell-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f2f2f7;
}

html.dark-theme .smart-upsell-header {
    border-color: rgba(255, 255, 255, 0.06);
}

.smart-upsell-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary, #111);
    display: flex;
    align-items: center;
    gap: 8px;
}

.smart-upsell-badge {
    background: rgba(0, 91, 255, 0.1);
    color: #005bff;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

html.dark-theme .smart-upsell-badge {
    background: rgba(10, 132, 255, 0.2);
    color: #5ac8fa;
}

.smart-upsell-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

@media (max-width: 640px) {
    .smart-upsell-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.upsell-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    border: 1.5px dashed #d1d5db;
    background: #fbfcfe;
    transition: all 0.2s ease;
    position: relative;
}

html.dark-theme .upsell-card {
    background: #1f222e;
    border-color: rgba(255, 255, 255, 0.12);
}

.upsell-card:hover {
    border-style: solid;
    border-color: #005bff;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 91, 255, 0.08);
}

.upsell-img {
    width: 54px;
    height: 54px;
    border-radius: 10px;
    object-fit: cover;
    background: #fff;
    flex-shrink: 0;
}

.upsell-info {
    flex: 1;
    min-width: 0;
}

.upsell-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #111);
    line-height: 1.3;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.upsell-price {
    font-size: 13px;
    font-weight: 800;
    color: #005bff;
}

.upsell-add-btn {
    background: #005bff;
    color: #fff;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease, background 0.15s ease;
}

.upsell-add-btn:hover {
    background: #004ad0;
    transform: scale(1.08);
}

.upsell-add-btn:active {
    transform: scale(0.92);
}

.upsell-add-btn.added {
    background: #34c759;
}

/* --------------------------------------------------------------------------
   3. STICKY BOTTOM BAR (MOBILE ONLY)
   -------------------------------------------------------------------------- */
.sticky-bottom-bar {
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    padding: 10px 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    z-index: 999980;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transform: translateY(150%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s ease;
    will-change: transform, opacity;
}

html.dark-theme .sticky-bottom-bar {
    background: rgba(24, 25, 32, 0.94);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.sticky-bottom-bar.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.sticky-product-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.sticky-product-thumb {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
    background: #f2f2f7;
    flex-shrink: 0;
}

.sticky-product-texts {
    min-width: 0;
    flex: 1;
}

.sticky-product-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary, #111);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 2px;
    line-height: 1.2;
}

.sticky-product-price {
    font-size: 14px;
    font-weight: 900;
    color: #005bff;
    line-height: 1;
}

.sticky-actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sticky-btn-add {
    background: #005bff;
    color: #fff;
    border: none;
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.1s ease;
}

.sticky-btn-add:active {
    transform: scale(0.95);
}

.sticky-btn-oneclick {
    background: linear-gradient(135deg, #ff9500 0%, #ff5e3a 100%);
    color: #fff;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.sticky-btn-oneclick:active {
    transform: scale(0.92);
}

/* --------------------------------------------------------------------------
   4. PHONE INPUT VALIDATION & MASKING
   -------------------------------------------------------------------------- */
.phone-field-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.phone-field-wrapper input {
    padding-right: 40px !important;
}

.phone-valid-icon {
    position: absolute;
    right: 14px;
    width: 18px;
    height: 18px;
    color: #34c759;
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.phone-valid-icon.show {
    opacity: 1;
    transform: scale(1);
}

input.phone-masked.is-invalid {
    border-color: #ff3b30 !important;
    background-color: rgba(255, 59, 48, 0.04) !important;
}

input.phone-masked.is-valid {
    border-color: #34c759 !important;
}

/* Small responsive tweak */
@media (min-width: 769px) {
    .sticky-bottom-bar {
        display: none !important;
    }
}
