/**
 * Modais premium — estrutura "Buscar compras"
 * Tema claro do site: modal claro bege/branco
 * Tema escuro do site: modal escuro
 */

.modal-backdrop.show {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(4, 4, 4, 0.78) !important;
}

.modal:not(#mobileMenu) .modal-dialog {
    max-width: min(420px, calc(100vw - 24px));
}

.modal:not(#mobileMenu) .modal-dialog.modal-md {
    max-width: min(440px, calc(100vw - 24px));
}

.modal:not(#mobileMenu) .modal-dialog.modal-lg {
    max-width: min(560px, calc(100vw - 24px));
}

.modal:not(#mobileMenu) .modal-content {
    position: relative;
    border: none !important;
    border-radius: 24px !important;
    overflow: hidden;
    animation: sgModalIn 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes sgModalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Tema claro do site → modal claro bege ── */
html[data-site-theme="light"] .modal:not(#mobileMenu) .modal-content,
html:not([data-site-theme]) .modal:not(#mobileMenu) .modal-content {
    background: linear-gradient(165deg, #ffffff 0%, #f9f1e6 55%, #f3ebdf 100%) !important;
    color: #070707 !important;
    box-shadow:
        0 0 0 1px rgba(7, 7, 7, 0.08),
        0 32px 80px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}

html[data-site-theme="light"] .modal:not(#mobileMenu) .modal-header,
html:not([data-site-theme]) .modal:not(#mobileMenu) .modal-header {
    border-bottom: 1px solid rgba(7, 7, 7, 0.08) !important;
    padding: 22px 24px 16px !important;
    background: transparent !important;
}

html[data-site-theme="light"] .modal:not(#mobileMenu) .modal-title,
html:not([data-site-theme]) .modal:not(#mobileMenu) .modal-title,
html[data-site-theme="light"] .modal:not(#mobileMenu) .modal-header h5,
html:not([data-site-theme]) .modal:not(#mobileMenu) .modal-header h5,
html[data-site-theme="light"] .modal:not(#mobileMenu) .modal-header h6,
html:not([data-site-theme]) .modal:not(#mobileMenu) .modal-header h6 {
    color: #070707 !important;
    font-weight: 800 !important;
    font-family: "Space Grotesk", sans-serif !important;
    letter-spacing: -0.02em;
}

html[data-site-theme="light"] .modal:not(#mobileMenu) .modal-subtitle,
html:not([data-site-theme]) .modal:not(#mobileMenu) .modal-subtitle {
    color: rgba(7, 7, 7, 0.55) !important;
}

html[data-site-theme="light"] .modal:not(#mobileMenu) .modal-body,
html:not([data-site-theme]) .modal:not(#mobileMenu) .modal-body {
    padding: 8px 24px 24px !important;
    color: rgba(7, 7, 7, 0.72) !important;
}

html[data-site-theme="light"] .modal:not(#mobileMenu) .form-label,
html:not([data-site-theme]) .modal:not(#mobileMenu) .form-label {
    color: rgba(7, 7, 7, 0.55) !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
}

html[data-site-theme="light"] .modal:not(#mobileMenu) .form-control,
html:not([data-site-theme]) .modal:not(#mobileMenu) .form-control {
    background: #ffffff !important;
    border: 1px solid rgba(7, 7, 7, 0.14) !important;
    border-radius: 14px !important;
    color: #070707 !important;
    -webkit-text-fill-color: #070707 !important;
    padding: 14px 16px !important;
}

html[data-site-theme="light"] .modal:not(#mobileMenu) .form-control::placeholder,
html:not([data-site-theme]) .modal:not(#mobileMenu) .form-control::placeholder {
    color: rgba(7, 7, 7, 0.35) !important;
}

html[data-site-theme="light"] .modal:not(#mobileMenu) .form-control:focus,
html:not([data-site-theme]) .modal:not(#mobileMenu) .form-control:focus {
    border-color: rgba(7, 7, 7, 0.35) !important;
    box-shadow: 0 0 0 4px rgba(7, 7, 7, 0.06) !important;
}

html[data-site-theme="light"] .modal:not(#mobileMenu) .btn-close,
html:not([data-site-theme]) .modal:not(#mobileMenu) .btn-close {
    filter: none !important;
    opacity: 0.55;
    background: rgba(7, 7, 7, 0.06) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23070707'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/12px no-repeat !important;
    border-radius: 10px;
    width: 32px;
    height: 32px;
    padding: 0;
}

html[data-site-theme="light"] .modal:not(#mobileMenu) .btn-close:hover,
html:not([data-site-theme]) .modal:not(#mobileMenu) .btn-close:hover {
    opacity: 1;
    background-color: rgba(7, 7, 7, 0.1) !important;
}

/* ── Tema escuro do site → modal escuro ── */
html[data-site-theme="dark"] .modal:not(#mobileMenu) .modal-content {
    background: linear-gradient(165deg, rgba(18, 18, 18, 0.98) 0%, rgba(7, 7, 7, 0.99) 55%, rgba(12, 11, 10, 0.98) 100%) !important;
    color: #ffffff !important;
    box-shadow:
        0 0 0 1px rgba(249, 241, 230, 0.12),
        0 0 60px rgba(249, 241, 230, 0.08),
        0 32px 80px rgba(0, 0, 0, 0.75),
        inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

html[data-site-theme="dark"] .modal:not(#mobileMenu) .modal-header {
    border-bottom: 1px solid rgba(249, 241, 230, 0.08) !important;
    padding: 22px 24px 16px !important;
    background: transparent !important;
}

html[data-site-theme="dark"] .modal:not(#mobileMenu) .modal-title,
html[data-site-theme="dark"] .modal:not(#mobileMenu) .modal-header h5,
html[data-site-theme="dark"] .modal:not(#mobileMenu) .modal-header h6 {
    color: #ffffff !important;
    font-weight: 800 !important;
    font-family: "Space Grotesk", sans-serif !important;
}

html[data-site-theme="dark"] .modal:not(#mobileMenu) .modal-subtitle {
    color: rgba(249, 241, 230, 0.55) !important;
}

html[data-site-theme="dark"] .modal:not(#mobileMenu) .modal-body {
    padding: 8px 24px 24px !important;
    color: rgba(249, 241, 230, 0.72) !important;
}

html[data-site-theme="dark"] .modal:not(#mobileMenu) .form-label {
    color: rgba(249, 241, 230, 0.75) !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
}

html[data-site-theme="dark"] .modal:not(#mobileMenu) .form-control {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(249, 241, 230, 0.15) !important;
    border-radius: 14px !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    padding: 14px 16px !important;
}

html[data-site-theme="dark"] .modal:not(#mobileMenu) .form-control::placeholder {
    color: rgba(249, 241, 230, 0.28) !important;
}

html[data-site-theme="dark"] .modal:not(#mobileMenu) .form-control:focus {
    border-color: rgba(249, 241, 230, 0.45) !important;
    box-shadow: 0 0 0 4px rgba(249, 241, 230, 0.1) !important;
    background: rgba(249, 241, 230, 0.04) !important;
}

html[data-site-theme="dark"] .modal:not(#mobileMenu) .btn-close {
    filter: none !important;
    opacity: 0.45;
    background: rgba(255, 255, 255, 0.06) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23F9F1E6'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/12px no-repeat !important;
    border-radius: 10px;
    width: 32px;
    height: 32px;
    padding: 0;
}

html[data-site-theme="dark"] .modal:not(#mobileMenu) .btn-close:hover {
    opacity: 1;
    background-color: rgba(249, 241, 230, 0.12) !important;
}

/* Ícone e subtítulo do header premium */
.modal:not(#mobileMenu) .modal-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

html[data-site-theme="light"] .modal:not(#mobileMenu) .modal-header-icon,
html:not([data-site-theme]) .modal:not(#mobileMenu) .modal-header-icon {
    background: linear-gradient(145deg, rgba(7, 7, 7, 0.06), rgba(7, 7, 7, 0.02));
    border: 1px solid rgba(7, 7, 7, 0.12);
    color: #070707;
    box-shadow: 0 8px 24px rgba(7, 7, 7, 0.06);
}

html[data-site-theme="dark"] .modal:not(#mobileMenu) .modal-header-icon {
    background: linear-gradient(145deg, rgba(249, 241, 230, 0.18), rgba(249, 241, 230, 0.06));
    border: 1px solid rgba(249, 241, 230, 0.2);
    color: #f9f1e6;
    box-shadow: 0 8px 24px rgba(249, 241, 230, 0.08);
}

.modal:not(#mobileMenu) .modal-subtitle {
    font-size: 12px;
    margin: 4px 0 0;
    font-weight: 500;
}

.modal:not(#mobileMenu) .modal-content > .btn-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 5;
}

/* Botão principal dos modais */
.modal:not(#mobileMenu) .btn-modal-buscar,
.modal:not(#mobileMenu) .btn-warning.rounded-pill,
.modal:not(#mobileMenu) #loginModal .btn-warning,
.modal:not(#mobileMenu) .input-group .btn-secondary[type="submit"] {
    background: linear-gradient(135deg, #f9f1e6 0%, #ede0cc 50%, #dfd0b8 100%) !important;
    color: #070707 !important;
    border: none !important;
    padding: 15px 20px !important;
    border-radius: 14px !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    width: 100%;
    box-shadow: 0 8px 28px rgba(249, 241, 230, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
    transition: transform 0.2s, box-shadow 0.2s;
}

.modal:not(#mobileMenu) .btn-modal-buscar:hover,
.modal:not(#mobileMenu) .btn-warning.rounded-pill:hover {
    transform: translateY(-2px) !important;
    color: #070707 !important;
    box-shadow: 0 12px 36px rgba(249, 241, 230, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
}

/* Login / cadastro / feedback — sobrescreve footer */
html[data-site-theme="light"] #loginModal .modal-content,
html:not([data-site-theme]) #loginModal .modal-content,
html[data-site-theme="light"] #cadastroModal .modal-content,
html:not([data-site-theme]) #cadastroModal .modal-content,
html[data-site-theme="light"] #appFeedbackModal .modal-content,
html:not([data-site-theme]) #appFeedbackModal .modal-content {
    background: linear-gradient(165deg, #ffffff 0%, #f9f1e6 55%, #f3ebdf 100%) !important;
    border: none !important;
    border-radius: 24px !important;
    color: #070707 !important;
}

html[data-site-theme="dark"] #loginModal .modal-content,
html[data-site-theme="dark"] #cadastroModal .modal-content,
html[data-site-theme="dark"] #appFeedbackModal .modal-content {
    background: linear-gradient(165deg, rgba(18, 18, 18, 0.98) 0%, rgba(7, 7, 7, 0.99) 55%, rgba(12, 11, 10, 0.98) 100%) !important;
    border: none !important;
    border-radius: 24px !important;
    color: #ffffff !important;
}

html[data-site-theme="light"] #loginModal .modal-title,
html:not([data-site-theme]) #loginModal .modal-title,
html[data-site-theme="light"] #cadastroModal .modal-title,
html:not([data-site-theme]) #cadastroModal .modal-title,
html[data-site-theme="light"] #appFeedbackModal .modal-title,
html:not([data-site-theme]) #appFeedbackModal .modal-title {
    color: #070707 !important;
}

html[data-site-theme="dark"] #loginModal .modal-title,
html[data-site-theme="dark"] #cadastroModal .modal-title,
html[data-site-theme="dark"] #appFeedbackModal .modal-title {
    color: #ffffff !important;
}

html[data-site-theme="light"] #loginModal .modal-body > p.text-muted,
html:not([data-site-theme]) #loginModal .modal-body > p.text-muted,
html[data-site-theme="light"] #cadastroModal .modal-body > p.text-muted,
html:not([data-site-theme]) #cadastroModal .modal-body > p.text-muted {
    color: rgba(7, 7, 7, 0.6) !important;
}

html[data-site-theme="dark"] #loginModal .modal-body > p.text-muted,
html[data-site-theme="dark"] #cadastroModal .modal-body > p.text-muted,
html[data-site-theme="dark"] #appFeedbackModal .modal-body p {
    color: rgba(249, 241, 230, 0.55) !important;
}

html[data-site-theme="light"] #loginModal .form-group label,
html:not([data-site-theme]) #loginModal .form-group label,
html[data-site-theme="light"] #cadastroModal .form-label,
html:not([data-site-theme]) #cadastroModal .form-label {
    color: rgba(7, 7, 7, 0.55) !important;
}

html[data-site-theme="dark"] #loginModal .form-group label,
html[data-site-theme="dark"] #cadastroModal .form-label {
    color: rgba(249, 241, 230, 0.75) !important;
}

html[data-site-theme="light"] #cadastroModal input:-webkit-autofill,
html[data-site-theme="light"] #cadastroModal input:-webkit-autofill:hover,
html[data-site-theme="light"] #cadastroModal input:-webkit-autofill:focus,
html:not([data-site-theme]) #cadastroModal input:-webkit-autofill,
html:not([data-site-theme]) #cadastroModal input:-webkit-autofill:hover,
html:not([data-site-theme]) #cadastroModal input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: #070707 !important;
}

html[data-site-theme="dark"] #cadastroModal input:-webkit-autofill,
html[data-site-theme="dark"] #cadastroModal input:-webkit-autofill:hover,
html[data-site-theme="dark"] #cadastroModal input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #1a1a1a inset !important;
    box-shadow: 0 0 0 1000px #1a1a1a inset !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* ── Checkout ───────────────────────────────────────────────────────────── */
#modal-checkout .checkout-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
}

#modal-checkout .checkout-user-icon {
    font-size: 22px;
    flex-shrink: 0;
}

#modal-checkout .checkout-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(249, 241, 230, 0.2);
}

#modal-checkout .checkout-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#modal-checkout .checkout-user-info {
    flex: 1;
    min-width: 0;
}

#modal-checkout .checkout-user-name {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

#modal-checkout .checkout-user-phone {
    font-size: 11px;
    margin-top: 2px;
}

#modal-checkout .checkout-user-chevron {
    font-size: 18px;
    flex-shrink: 0;
    opacity: 0.45;
}

#modal-checkout .btn-checkout-submit {
    background: linear-gradient(135deg, #f9f1e6 0%, #ede0cc 50%, #dfd0b8 100%) !important;
    color: #070707 !important;
    border: none !important;
    font-weight: 800 !important;
    border-radius: 14px !important;
    padding: 14px 20px !important;
    box-shadow: 0 8px 28px rgba(249, 241, 230, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

#modal-checkout .btn-checkout-submit:hover {
    transform: translateY(-2px);
    color: #070707 !important;
    box-shadow: 0 12px 36px rgba(249, 241, 230, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
}

#modal-checkout .btn-link a {
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
}

/* Tema claro do site → modal claro */
html[data-site-theme="light"] #modal-checkout .checkout-user-card,
html:not([data-site-theme]) #modal-checkout .checkout-user-card {
    background: rgba(7, 7, 7, 0.04) !important;
    border: 1px solid rgba(7, 7, 7, 0.1) !important;
}

html[data-site-theme="light"] #modal-checkout .checkout-user-avatar,
html:not([data-site-theme]) #modal-checkout .checkout-user-avatar {
    border-color: rgba(7, 7, 7, 0.12) !important;
}

html[data-site-theme="light"] #modal-checkout .checkout-user-name,
html:not([data-site-theme]) #modal-checkout .checkout-user-name {
    color: #070707 !important;
}

html[data-site-theme="light"] #modal-checkout .checkout-user-phone,
html:not([data-site-theme]) #modal-checkout .checkout-user-phone {
    color: rgba(7, 7, 7, 0.55) !important;
}

html[data-site-theme="light"] #modal-checkout .checkout-user-chevron,
html:not([data-site-theme]) #modal-checkout .checkout-user-chevron {
    color: rgba(7, 7, 7, 0.35) !important;
}

html[data-site-theme="light"] #modal-checkout .alert-info,
html:not([data-site-theme]) #modal-checkout .alert-info {
    background: rgba(5, 150, 105, 0.1) !important;
    border: 1px solid rgba(5, 150, 105, 0.2) !important;
    color: #047857 !important;
}

html[data-site-theme="light"] #modal-checkout .btn-link a,
html:not([data-site-theme]) #modal-checkout .btn-link a {
    color: rgba(7, 7, 7, 0.55) !important;
}

/* Tema escuro do site → modal escuro */
html[data-site-theme="dark"] #modal-checkout .checkout-user-card {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(249, 241, 230, 0.14) !important;
}

html[data-site-theme="dark"] #modal-checkout .checkout-user-icon {
    color: #f9f1e6 !important;
}

html[data-site-theme="dark"] #modal-checkout .checkout-user-avatar {
    border-color: rgba(249, 241, 230, 0.2) !important;
}

html[data-site-theme="dark"] #modal-checkout .checkout-user-name {
    color: #ffffff !important;
}

html[data-site-theme="dark"] #modal-checkout .checkout-user-phone {
    color: rgba(249, 241, 230, 0.55) !important;
}

html[data-site-theme="dark"] #modal-checkout .checkout-user-chevron {
    color: rgba(249, 241, 230, 0.45) !important;
}

html[data-site-theme="dark"] #modal-checkout .alert-info {
    background: rgba(59, 130, 246, 0.12) !important;
    border: 1px solid rgba(59, 130, 246, 0.22) !important;
    color: #93c5fd !important;
}

html[data-site-theme="dark"] #modal-checkout .btn-link a {
    color: rgba(249, 241, 230, 0.72) !important;
}

/* Modal aviso */
html[data-site-theme="light"] #modal-aviso .alert-danger,
html:not([data-site-theme]) #modal-aviso .alert-danger {
    background: rgba(7, 7, 7, 0.06) !important;
    border: 1px solid rgba(7, 7, 7, 0.12) !important;
    color: #070707 !important;
}

html[data-site-theme="dark"] #modal-aviso .alert-danger {
    background: rgba(249, 241, 230, 0.1) !important;
    border: 1px solid rgba(249, 241, 230, 0.22) !important;
    color: #f9f1e6 !important;
}

@media (max-width: 600px) {
    .modal:not(#mobileMenu) .modal-content {
        border-radius: 20px !important;
        margin: 12px;
    }
}
