/* Payment modal: show standard page background in free space (no dim overlay) */
#payment-modal {
    background: transparent;
    backdrop-filter: none;
    justify-content: flex-start;
    padding: 20px 0;
}

@media (max-width: 1439px) {
    #payment-modal:not(.centered) .modal-content {
        margin-bottom: 50px;
    }
}

#payment-modal.centered {
    justify-content: center;
    padding: 0;
}

@media (min-width: 1440px) {
    #payment-modal {
        justify-content: center;
        padding: 0;
    }
}

/* Payment form layout */
.payment-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.payment-form-grid .full-width {
    grid-column: 1 / -1;
}

.payment-form-grid .form-field {
    display: flex;
    flex-direction: column;
}

.payment-form-grid .form-field label {
    font-weight: 400;
    color: #1a1a1a;
    margin-bottom: 8px;
    font-size: 1rem;
}

.payment-form-grid .form-field input {
    padding: 12px 16px;
    border: 1px solid rgba(204, 198, 193, 0.5);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.payment-form-grid .form-field input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Globe wrapper for payment page */
.globe-wrapper {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 457.5px;
    height: 457.5px;
    display: none;
    z-index: 1001;
}

.globe-wrapper.visible {
    display: block;
}

#map-container {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(204, 198, 193, 0.3);
}

#map {
    width: 100%;
    height: 100%;
}

/* Small screens (<1440px): globe inside form */
@media (max-width: 1439px) {
    .globe-wrapper {
        position: static;
        transform: none;
        width: 100%;
        height: 457.5px;
        margin: 0;
        padding-top: 16px;
        left: auto;
        top: auto;
    }
}

/* Mobile phones: smaller globe */
@media (max-width: 768px) {
    .globe-wrapper {
        height: 400px;
    }
}

/* Large screens (>=1440px): globe beside form */
@media (min-width: 1440px) {
    .globe-wrapper {
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        width: 457.5px;
        height: 457.5px;
    }
}

/* Responsive payment form for mobile */
@media (max-width: 768px) {
    .payment-form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .payment-form-grid .full-width {
        grid-column: 1;
    }

    #payment-modal .modal-content {
        max-width: 100%;
    }
}

/* Payment form spacing */
#step-2 .form-group {
    margin-bottom: 12px !important;
    padding-top: 16px;
}

#step-2 .form-group label,
#step-2 .form-group > div label {
    display: block;
    margin-bottom: 8px !important;
}

#step-2 .form-group > label {
    display: block;
    margin-bottom: 8px !important;
    font-weight: 500;
}

/* Payment success page styles */
#address-status {
    margin-top: 0;
    margin-bottom: 12px;
}

#step-contact,
#step-complete {
    display: none;
}

#step-complete {
    text-align: left;
}

.payment-form-grid .form-help {
    display: block;
    text-align: center;
}

#step-contact > .form-help {
    display: block;
    text-align: left;
    margin-bottom: 12px;
}

#step-contact .form-actions {
    justify-content: space-between;
}

.modal-body .footer-info {
    margin: 1.5rem -1.5rem 0;
    padding: 1.5rem 1.5rem 0;
}

@media (min-width: 769px) {
    .modal-body .footer-info {
        margin: 2rem -2rem 0;
        padding: 2rem 2rem 0;
    }
}

#footer-info {
    display: none;
}

.success-message-box {
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    border: 1px solid rgba(204, 198, 193, 0.3);
}

.success-message-box p {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

.success-message-box p + p {
    margin-top: 1rem;
}

.submit-button-link {
    text-decoration: none;
    text-align: center;
}

/* Payment page styles */
#pricing-help:not(:empty) {
    padding: 10px 14px;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: 8px;
    color: #16a34a;
}

#payment-form {
    display: grid;
}

.payment-step {
    grid-area: 2 / 1;
}

#step-2 {
    visibility: hidden;
    pointer-events: none;
}

.order-details-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.quantity-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.quantity-group input {
    width: 80px;
}

.quantity-group input::-webkit-inner-spin-button,
.quantity-group input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-group input[type=number] {
    -moz-appearance: textfield;
    text-align: center;
}

.qty-btn {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(204, 198, 193, 0.5);
    border-radius: 10px;
    background: transparent;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

@media (hover: none) {
    .qty-btn:active {
        background: #ccc6c1;
        border-color: #ab9f95;
    }
}

@media (hover: hover) and (pointer: fine) {
    .qty-btn:hover {
        background: rgba(204, 198, 193, 0.2);
        border-color: #ab9f95;
    }

    .qty-btn:active {
        background: rgba(204, 198, 193, 0.3);
    }
}

#step-1 .form-actions {
    margin-top: 0;
}

#step-1 .submit-button {
    width: 100%;
}

.price-discount {
    margin-left: 5px;
}

@media (min-width: 769px) {
    .price-discount {
        display: block;
        margin-left: 0;
        margin-top: 4px;
    }
}

#price-display strong {
    font-weight: 500;
}

@media (max-width: 360px) {
    #price-display {
        display: flex;
        flex-direction: column;
    }
}

.promo-row {
    display: flex;
    align-items: center;
    padding-top: 16px;
    margin: 0 0 16px;
}

.promo-row label {
    font-weight: 500;
    white-space: nowrap;
    margin: 0 10px 0 0;
}

.promo-row input {
    flex: 1;
    min-width: 90px;
    text-transform: uppercase;
    padding: 12px 16px;
    border: 1px solid rgba(204, 198, 193, 0.5);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-right: 10px;
}

.promo-row input:focus {
    outline: none;
    border-color: #ab9f95;
    box-shadow: 0 0 0 3px rgba(171, 159, 149, 0.1);
}

.promo-row .secondary-button {
    padding: 12px 24px;
    font-size: 1rem;
    white-space: nowrap;
    transition: none;
}

@media (max-width: 467px) {
    .promo-row {
        flex-wrap: wrap;
    }

    .promo-row label {
        width: 100%;
        margin-bottom: 8px;
    }

    .promo-row input {
        flex: 1;
    }
}

#step-2 {
    display: flex;
    flex-direction: column;
}

#step-2 .form-actions {
    justify-content: space-between;
    margin-top: auto;
}
