/* ========================================
   CHECKOUT CSS - Mercado Livre Style
   ======================================== */

.checkout-body {
    background-color: var(--ml-gray-lightest);
    min-height: 100vh;
    overflow-x: hidden;
    touch-action: pan-y;
    margin: 0;
    padding: 0;
}

/* Common Styles */
.hidden {
    display: none !important;
}

.checkout-step {
    background-color: var(--ml-white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.checkout-step.hidden {
    display: none;
}

.checkout-header {
    background-color: var(--ml-yellow);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s ease;
}

.checkout-header.scrolled {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.back-btn,
.close-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.close-btn {
    margin-left: auto;
    font-size: 24px;
    color: var(--ml-gray-dark);
    font-weight: 300;
}

.checkout-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--ml-black);
    flex: 1;
    text-align: center;
}

.header-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.header-total-amount {
    font-size: 18px;
    font-weight: 600;
    color: var(--ml-black);
}

.header-payment-method {
    font-size: 12px;
    color: var(--ml-gray);
}

.checkout-content {
    flex: 1;
    padding: 16px;
    padding-bottom: 200px;
}

/* Address Form */
.address-form-section {
    margin-bottom: 24px;
}

.address-form-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ml-black);
    margin-bottom: 12px;
}

.cep-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.cep-input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--ml-gray-lighter);
    border-radius: 4px;
    font-size: 14px;
    font-family: var(--font-family);
}

.cep-input:focus {
    outline: none;
    border-color: var(--ml-blue);
}

.btn-search-cep {
    padding: 12px 24px;
    background-color: var(--ml-blue);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-search-cep:hover {
    background-color: var(--ml-blue-dark);
}

.address-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.address-field {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--ml-gray-lighter);
    border-radius: 4px;
    font-size: 14px;
    font-family: var(--font-family);
}

.address-field:focus {
    outline: none;
    border-color: var(--ml-blue);
}

.address-field[readonly] {
    background-color: var(--ml-gray-lightest);
    color: var(--ml-gray);
}

.address-row {
    display: flex;
    gap: 12px;
}

.address-field-small {
    flex: 1;
}

.btn-confirm-address {
    padding: 14px;
    background-color: var(--ml-green);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}

.btn-confirm-address:hover {
    background-color: #008f47;
}

.cep-error {
    color: #ff4444;
    font-size: 14px;
    margin-top: 8px;
    padding: 8px;
    background-color: #fff5f5;
    border-radius: 4px;
}

/* Confirmed Address Display */
.delivery-address-confirmed {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background-color: var(--ml-gray-lightest);
    border-radius: 4px;
    font-size: 14px;
    color: var(--ml-gray-dark);
}

.location-icon {
    width: 16px;
    height: 16px;
    color: var(--ml-gray);
    flex-shrink: 0;
}

.delivery-address-text {
    flex: 1;
}

.btn-change-address {
    background: none;
    border: none;
    color: var(--ml-blue);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: underline;
}

/* Meli+ Card */
.meli-plus-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 2px solid var(--ml-green);
    border-radius: 8px;
    background-color: var(--ml-white);
    margin-bottom: 16px;
}

.meli-plus-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
}

.meli-plus-content {
    flex: 1;
}

.meli-plus-text {
    font-size: 14px;
    color: var(--ml-black);
    line-height: 1.4;
    margin: 0;
}

.meli-plus-highlight {
    color: #8B3DFF;
    font-weight: 600;
}

.meli-plus-green {
    color: var(--ml-green);
    font-weight: 600;
}

.meli-plus-subtext {
    font-size: 12px;
    color: var(--ml-gray);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--ml-gray-lighter);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--ml-white);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--ml-green);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Delivery Options Card */
.delivery-options-card {
    background-color: var(--ml-white);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.delivery-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ml-gray-lighter);
}

.delivery-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ml-black);
}

.delivery-full {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--ml-green);
    font-weight: 600;
    font-size: 14px;
}

.lightning-icon {
    width: 16px;
    height: 16px;
    fill: var(--ml-green);
}

.delivery-product-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    margin-left: auto;
}

.delivery-options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.delivery-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--ml-gray-lighter);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.delivery-option:hover {
    border-color: var(--ml-blue);
}

.delivery-radio {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.delivery-option-text {
    flex: 1;
    font-size: 14px;
    color: var(--ml-black);
    line-height: 1.4;
}

.delivery-link-small {
    font-size: 12px;
    color: var(--ml-blue);
    text-decoration: underline;
}

.delivery-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--ml-black);
}

.delivery-price.free {
    color: var(--ml-green);
}

.delivery-radio:checked ~ .delivery-option-text {
    color: var(--ml-blue);
}

/* Payment Methods */
.coupon-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--ml-gray-lighter);
}

.coupon-link {
    color: var(--ml-blue);
    font-size: 14px;
    text-decoration: none;
    display: block;
    padding: 12px 16px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.coupon-link:hover {
    background-color: var(--ml-gray-lightest);
}

.payment-methods-list {
    background-color: var(--ml-white);
    border-radius: 8px;
    margin-bottom: 16px;
}

.payment-method-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--ml-gray-lighter);
    cursor: pointer;
}

.payment-method-option:last-child {
    border-bottom: none;
}

.payment-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.payment-method-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.payment-method-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ml-black);
}

.payment-method-desc {
    font-size: 12px;
    color: var(--ml-gray);
}

.chevron-icon {
    width: 20px;
    height: 20px;
    color: var(--ml-gray);
}

.payment-radio {
    width: 20px;
    height: 20px;
}

.show-more-payment {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--ml-blue);
    font-size: 14px;
    text-decoration: none;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.show-more-payment:hover {
    background-color: var(--ml-gray-lightest);
}

.show-more-payment .chevron-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.show-more-payment:hover .chevron-icon {
    transform: translateY(2px);
}

/* Order Summary Section */
.order-summary-section {
    background-color: var(--ml-white);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.order-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.order-summary-item.order-summary-subtotal {
    border-top: 1px solid var(--ml-gray-lighter);
    margin-top: 6px;
    padding-top: 8px;
}

.order-summary-item.order-summary-total {
    border-top: 1px solid var(--ml-gray-lighter);
    margin-top: 6px;
    padding-top: 8px;
    margin-bottom: 6px;
}

.order-summary-label {
    font-size: 14px;
    color: var(--ml-gray-dark);
    font-weight: 400;
}

.order-summary-value {
    font-size: 14px;
    color: var(--ml-black);
    font-weight: 600;
}

.order-summary-item.order-summary-total .order-summary-label,
.order-summary-item.order-summary-total .order-summary-value {
    font-size: 16px;
    font-weight: 600;
}

.order-payment-method {
    font-size: 14px;
    color: var(--ml-gray);
    margin-bottom: 12px;
    text-align: right;
}

/* Review Section */
.btn-confirm-top {
    width: 100%;
    padding: 16px;
    background-color: var(--ml-blue);
    color: var(--ml-white);
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn-confirm-top:hover {
    background-color: var(--ml-blue-dark);
}

.btn-confirm-top:active {
    opacity: 0.9;
}

.review-section {
    margin-bottom: 24px;
}

.review-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ml-black);
    margin-bottom: 12px;
}

.review-card {
    background-color: var(--ml-gray-lightest);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    overflow: visible;
    min-height: auto;
}

.document-icon,
.location-icon {
    width: 24px;
    height: 24px;
    color: var(--ml-gray);
    flex-shrink: 0;
    margin-top: 2px;
}

.review-card-content {
    flex: 1;
    min-width: 0;
    overflow: visible;
    word-wrap: break-word;
}

.review-card-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.review-link {
    color: var(--ml-blue);
    font-size: 12px;
    text-decoration: none;
    display: block;
    word-break: break-word;
}

.btn-confirm-billing {
    width: 100%;
    padding: 14px;
    background-color: var(--ml-blue);
    color: var(--ml-white);
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
    margin-top: 8px;
}

.btn-confirm-billing:hover {
    background-color: var(--ml-blue-dark);
}

.btn-confirm-billing:active {
    opacity: 0.9;
}

.btn-modify-billing {
    width: 100%;
    padding: 12px;
    background-color: transparent;
    color: var(--ml-blue);
    border: 1px solid var(--ml-blue);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    margin-top: 16px;
}

.btn-modify-billing:hover {
    background-color: var(--ml-blue);
    color: var(--ml-white);
}

.btn-modify-billing:active {
    opacity: 0.9;
}

.billing-summary-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.billing-summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.billing-summary-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ml-gray-dark);
}

.billing-summary-value {
    font-size: 14px;
    color: var(--ml-black);
    word-break: break-word;
}

.billing-field-group {
    margin-bottom: 16px;
}

.billing-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ml-gray-dark);
    margin-bottom: 6px;
}

.billing-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--ml-gray-lighter);
    border-radius: 4px;
    font-size: 14px;
    color: var(--ml-black);
    font-family: var(--font-family);
    background-color: var(--ml-white);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.billing-input:focus {
    border-color: var(--ml-blue);
    box-shadow: 0 0 0 2px rgba(52, 131, 250, 0.1);
}

.billing-input::placeholder {
    color: var(--ml-gray-light);
}

.review-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ml-black);
    margin-bottom: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.review-input,
.review-input-small {
    width: 100%;
    border: none;
    background: none;
    font-size: 14px;
    color: var(--ml-black);
    padding: 4px 0;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.15s ease;
}

.review-input:focus,
.review-input-small:focus {
    border-bottom: 1px solid var(--ml-blue);
    padding-bottom: 3px;
}

.review-input-small {
    display: inline-block;
    width: auto;
    min-width: 120px;
}

.review-input::placeholder,
.review-input-small::placeholder {
    color: var(--ml-gray-light);
}

.review-card-detail {
    font-size: 12px;
    color: var(--ml-gray);
}

.review-card-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.product-card {
    margin-top: 12px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.product-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.delivery-full-inline {
    color: var(--ml-green);
    font-weight: 600;
}

.product-delivery-label {
    font-size: 14px;
    color: var(--ml-black);
    margin-bottom: 4px;
}

.product-delivery-date {
    font-size: 14px;
    font-weight: 600;
    color: var(--ml-black);
    margin-bottom: 8px;
}

.product-name {
    font-size: 14px;
    color: var(--ml-gray-dark);
    margin-bottom: 4px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.product-quantity {
    font-size: 12px;
    color: var(--ml-gray);
}

.payment-icons-review {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.payment-icon-review {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.payment-money-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin: 0 auto 16px;
    display: block;
}

.checkout-content .payment-money-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
}

.payment-icons-review .payment-money-icon {
    width: 24px;
    height: 24px;
    opacity: 0.7;
    margin: 0;
    display: inline-block;
}

.payment-method-review {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.payment-amount-review {
    font-size: 16px;
    font-weight: 600;
    color: var(--ml-black);
}

.payment-instruction {
    font-size: 12px;
    color: var(--ml-gray);
    margin-bottom: 8px;
    line-height: 1.4;
}

.payment-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--ml-gray);
}

.info-icon {
    width: 16px;
    height: 16px;
    color: var(--ml-blue);
}

/* Footer */
.checkout-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--ml-white);
    padding: 12px 16px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    z-index: 100;
    border-top: 1px solid var(--ml-gray-lighter);
}

.footer-total {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.footer-label {
    font-size: 14px;
    color: var(--ml-black);
    font-weight: 600;
}

.footer-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--ml-black);
}

.footer-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ml-black);
}

.footer-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--ml-black);
}

.btn-continue {
    width: 100%;
    padding: 16px;
    background-color: var(--ml-blue);
    color: var(--ml-white);
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn-continue:hover {
    background-color: var(--ml-blue-dark);
}

.btn-continue:active {
    opacity: 0.9;
}

/* PIX Payment Screen */
.pix-content {
    text-align: center;
    padding-top: 40px;
}

.pix-icon-circle {
    width: 120px;
    height: 120px;
    background-color: var(--ml-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.pix-icon-inner .payment-money-icon {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin: 0;
}

.pix-icon-inner {
    background-color: var(--ml-white);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ml-white);
    font-size: 32px;
    font-weight: 600;
}

.pix-dollar {
    margin-right: 4px;
}

.pix-dots {
    font-size: 20px;
    letter-spacing: 2px;
}

.pix-message-card {
    background-color: var(--ml-white);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pix-title-small {
    font-size: 16px;
    color: var(--ml-gray-dark);
    margin-bottom: 8px;
    font-weight: 400;
}

.pix-description {
    font-size: 18px;
    font-weight: 600;
    color: var(--ml-black);
    line-height: 1.4;
}

.pix-instructions {
    text-align: left;
    margin-bottom: 24px;
}

.pix-instructions-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ml-black);
    margin-bottom: 12px;
}

.pix-instructions-list {
    font-size: 14px;
    color: var(--ml-gray-dark);
    line-height: 1.8;
    padding-left: 20px;
}

.pix-code-container {
    margin-bottom: 24px;
}

.pix-code-box {
    background-color: var(--ml-gray-lightest);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    word-break: break-all;
}

.pix-code-text {
    font-size: 12px;
    color: var(--ml-black);
    font-family: monospace;
    line-height: 1.6;
}

.pix-code-info,
.pix-code-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: var(--ml-gray);
    margin-bottom: 8px;
}

.clock-icon {
    width: 16px;
    height: 16px;
    color: var(--ml-gray);
}

.btn-copy-code {
    width: 100%;
    padding: 16px;
    background-color: var(--ml-blue);
    color: var(--ml-white);
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
}

.link-my-purchases {
    color: var(--ml-blue);
    font-size: 14px;
    text-decoration: none;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--ml-white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-text {
    font-size: 18px;
    color: var(--ml-gray-dark);
    margin-bottom: 24px;
    font-weight: 400;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--ml-gray-lighter);
    border-top-color: var(--ml-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
