/**
 * iOS SPECIFIC FIXES
 * Fixes for iOS-specific rendering issues with images and paths
 */

/* Fix for iOS payment option icons */
.ios-payment-option-icon img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Override iOS background-size issues */
.ios-payment-modal .ios-payment-option-icon {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

/* Additional CSS variables for iOS compatibility */
:root {
    --apple-pay-icon: url('/apple-pay.png');
    --safari-icon: url('/images/safari-icon.png');
}

/* Use CSS variables for icons as a fallback */
.ios-payment-option[data-option="iap"] .ios-payment-option-icon.image-fallback {
    background-image: var(--apple-pay-icon);
    background-size: 70%;
    background-repeat: no-repeat;
    background-position: center;
}

.ios-payment-option[data-option="safari"] .ios-payment-option-icon.image-fallback {
    background-image: var(--safari-icon);
    background-size: 70%;
    background-repeat: no-repeat;
    background-position: center;
}

/* Text fallback for when images don't load */
.ios-payment-option[data-option="iap"] .ios-payment-option-icon.image-fallback::after {
    content: "Apple Pay";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 10px;
    font-weight: 600;
}

.ios-payment-option[data-option="safari"] .ios-payment-option-icon.image-fallback::after {
    content: "Safari";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 10px;
    font-weight: 600;
}

/* Ensure proper dimensions for iOS */
.ios-payment-option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* iOS Payment Modal Styles */
.ios-payment-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none !important; /* Oculto por defecto - solo se muestra en pagos iOS */
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    visibility: hidden;
}

.ios-payment-modal.show {
    display: flex;
    opacity: 1;
}

.ios-payment-modal-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.ios-payment-modal.show .ios-payment-modal-content {
    transform: scale(1);
}

.ios-payment-modal-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.ios-payment-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.ios-payment-modal-body {
    padding: 20px;
}

.ios-payment-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ios-payment-option {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.ios-payment-option:hover {
    border-color: #007AFF;
    background-color: #f8f9ff;
}

.ios-payment-option.selected {
    border-color: #007AFF;
    background-color: #f0f7ff;
}

.ios-payment-option-icon {
    width: 48px;
    height: 48px;
    margin-right: 16px;
    border-radius: 8px;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ios-payment-option-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.ios-payment-option-info {
    flex: 1;
}

.ios-payment-option-title {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.ios-payment-option-description {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.ios-payment-modal-footer {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid #f0f0f0;
}

.ios-payment-cancel-btn,
.ios-payment-continue-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ios-payment-cancel-btn {
    background-color: #f5f5f5;
    color: #666;
}

.ios-payment-cancel-btn:hover {
    background-color: #e8e8e8;
}

.ios-payment-continue-btn {
    background-color: #007AFF;
    color: white;
}

.ios-payment-continue-btn:hover:not(:disabled) {
    background-color: #0056d6;
}

.ios-payment-continue-btn:disabled {
    background-color: #c0c0c0;
    cursor: not-allowed;
}
