/* Import font */
@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;700&display=swap');

/* Global styles (apply carefully, maybe scope within a wrapper if needed) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Rubik', Arial, sans-serif;
}

/* Apply font to form elements specifically */
/* Add prefix to container class */
.ys-pay-container, .ys-pay-container input, .ys-pay-container select, .ys-pay-container button {
     font-family: 'Rubik', Arial, sans-serif;
}


/* Prefixed Styles */
/* Add prefix */
.ys-pay-header {
    background-color: #fff;
    padding: 10px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Add prefix */
.ys-pay-logo {
    display: flex;
    align-items: center;
}

/* Add prefix */
.ys-pay-logo-text {
    color: #a51c5e;
    font-weight: bold;
    font-size: 24px;
    margin-left: 5px;
    margin-right: 5px; /* Added for RTL */
    margin-left: 0; /* Reset for RTL */
}

/* Add prefix */
.ys-pay-logo-icon {
    color: #a51c5e;
    font-size: 28px;
}

/* Add prefix */
.ys-pay-secondary-text {
    color: #666;
    font-size: 14px;
}

/* Add prefix */
.ys-pay-container {
    max-width: 960px;
    margin: 20px auto;
    padding: 0 15px;
}

/* Add prefix */
.ys-pay-page-title {
    text-align: center;
    margin: 30px 0;
    font-size: 24px;
    color: #333;
    font-weight: normal;
}

/* Payment Box Styles */
.ys-pay-payment-box {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 0;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.ys-pay-payment-amount {
    width: 48%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ys-pay-amount-label {
    font-weight: normal;
    margin-bottom: 10px;
    text-align: center;
    width: 100%;
}

.ys-pay-amount-input {
    width: 100%;
    text-align: center;
    padding: 12px;
    font-size: 24px;
    font-weight: bold;
    border: 1px solid #ddd;
    border-radius: 4px;
    direction: ltr;
}

.ys-pay-details-container {
    width: 48%;
}

.ys-pay-details-header {
    text-align: right;
    font-weight: normal;
    font-size: 14px;
    margin-bottom: 10px;
    width: 100%;
}

.ys-pay-details-table {
    width: 100%;
    border-collapse: collapse;
}

.ys-pay-details-table th,
.ys-pay-details-table td {
    padding: 10px;
    text-align: right;
    border: 1px solid #ddd;
}

.ys-pay-details-table th {
    background-color: #f9f9f9;
    font-weight: normal;
}

/* Add prefix */
.ys-pay-form-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-top: 0;
}

/* Add prefix */
.ys-pay-form-section {
    flex: 1;
    min-width: 300px;
    background-color: #f9f9f9;
    padding: 0;
    margin-bottom: 20px;
}

/* Add prefix */
.ys-pay-form-section:first-child {
    border-right: 1px solid #eee; /* Adjusted for RTL */
    border-left: none; /* Adjusted for RTL */
}

/* Add prefix */
.ys-pay-section-title {
    font-size: 18px;
    margin-bottom: 0;
    color: #333;
    text-align: center;
    font-weight: normal;
    padding: 10px 0;
    background-color: #eee;
}

/* Add prefix */
.ys-pay-form-content {
    padding: 15px;
}

/* Add prefix */
.ys-pay-form-group {
    margin-bottom: 15px;
    position: relative;
}

/* Add prefix */
.ys-pay-form-label {
    display: block;
    margin-bottom: 5px;
    color: #a51c5e; /* Color already matches */
    text-align: right;
    font-size: 14px;
}

/* Add prefix */
.ys-pay-form-input {
    width: 100%;
    padding: 8px 10px;
    /* border: 1px solid #ccc; */ /* Change border color */
    border: 1px solid #a51c5e; /* Use primary color for border */
    border-radius: 4px;
    direction: rtl;
    font-size: 14px;
}

/* Add prefix */
.ys-pay-form-input-icon {
    position: relative;
}

/* Add prefix */
.ys-pay-form-input-icon input {
    /* padding-left: 30px; */ /* Remove left padding (for LTR) */
    padding-right: 35px; /* Add right padding to make space for the icon in RTL */
}

/* Add prefix */
.ys-pay-form-input-icon i {
    position: absolute;
    /* left: 10px; */ /* Using right positioning now */
    right: 10px; /* Position icon on the right for RTL */
    top: 50%;
    transform: translateY(-50%);
    color: #a51c5e; /* Color already matches */
    font-style: normal; /* Prevent italics if using <i> */
}

/* Style for side-by-side fields (Generic row) */
/* Add prefix */
.ys-pay-form-row {
    display: flex;
    gap: 15px; /* Adjust gap as needed */
    align-items: flex-end; /* Align items based on their bottom edge */
    margin-bottom: 20px; /* Add margin below the row */
}
/* Add prefix */
.ys-pay-form-row .ys-pay-form-group {
    flex: 1; /* Make fields share space by default */
    margin-bottom: 0; /* Remove bottom margin when in a row */
}

/* Expiry and CVV Row Styles */
.ys-pay-expiry-cvv-row {
    display: flex;
    gap: 20px;
    width: 100%;
}

.ys-pay-expiry-group {
    flex: 2;
    width: 100%;
}

.ys-pay-card-details {
    display: flex;
    gap: 15px;
    width: 100%;
}

.ys-pay-card-details .ys-pay-form-group {
    flex: 1;
    width: 100%;
}

.ys-pay-cvv-group {
    flex: 1;
    position: relative;
    width: 100%;
}

/* Ajustes específicos para móvil */
@media screen and (max-width: 768px) {
    .ys-pay-expiry-cvv-row {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }

    .ys-pay-expiry-group,
    .ys-pay-cvv-group {
        width: 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }

    .ys-pay-card-details {
        width: 100%;
        gap: 10px;
    }

    .ys-pay-card-details .ys-pay-dropdown,
    .ys-pay-card-details select,
    .ys-pay-cvv-group input {
        width: 100%;
        max-width: 100%;
        height: 48px;
    }

    .ys-pay-dropdown select,
    .ys-pay-cvv-group input {
        width: 100%;
        font-size: 16px;
        padding: 8px 35px;
        height: 48px;
        text-align: right;
    }

    .ys-pay-form-input-icon input,
    .ys-pay-form-input-icon select {
        width: 100%;
        padding-right: 35px;
        padding-left: 35px;
    }

    .ys-pay-cvv-help {
        right: auto;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
    }

    .ys-pay-form-input-icon i {
        right: 10px;
        z-index: 2;
    }

    .ys-pay-payment-box {
        flex-direction: column;
        padding: 15px;
        gap: 20px;
    }

    .ys-pay-payment-amount,
    .ys-pay-details-container {
        width: 100%;
    }

    .ys-pay-amount-input {
        font-size: 20px;
        padding: 10px;
    }

    .ys-pay-details-table {
        font-size: 14px;
    }

    .ys-pay-details-table th,
    .ys-pay-details-table td {
        padding: 8px;
    }

    .ys-pay-details-header {
        text-align: center;
        margin-bottom: 15px;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    .ys-pay-header {
        padding: 8px 12px;
    }

    .ys-pay-logo-text {
        font-size: 20px;
    }

    .ys-pay-page-title {
        font-size: 20px;
        margin: 20px 0;
    }

    .ys-pay-form-content {
        padding: 12px;
    }

    .ys-pay-card-details {
        flex-direction: column;
        gap: 10px;
    }

    .ys-pay-payment-box {
        padding: 12px;
        gap: 15px;
    }

    .ys-pay-amount-input {
        font-size: 18px;
        padding: 8px;
    }

    .ys-pay-details-table {
        font-size: 13px;
    }

    .ys-pay-details-table th,
    .ys-pay-details-table td {
        padding: 6px;
    }
}

/* Prevent zoom on iOS inputs */
@media screen and (max-width: 768px) and (-webkit-min-device-pixel-ratio: 0) {
    .ys-pay-form-input,
    .ys-pay-dropdown select,
    .ys-pay-amount-input {
        font-size: 16px !important;
    }
}

/* Dropdown Styles */
.ys-pay-dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
}

.ys-pay-dropdown select {
    width: 100%;    padding: 10px 35px 10px 40px;
    border: 1px solid #a51c5e;
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%23a51c5e'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 15px center;
    background-size: 16px;
    font-size: 14px;
    text-align: right;
    direction: rtl;
}

/* Mobile Optimizations for Dropdowns */
@media screen and (max-width: 768px) {
    .ys-pay-dropdown select {
        padding: 12px 35px 12px 12px;
        height: 48px;
        font-size: 16px;
        background-position: left 12px center;
    }
    
    .ys-pay-card-details .ys-pay-dropdown select {
        padding-right: 35px;
    }
}

/* Fix for Firefox dropdown arrow */
@-moz-document url-prefix() {
    .ys-pay-dropdown select {
        padding-left: 8px;
    }
}

/* Hover and Focus states */
.ys-pay-dropdown select:hover {
    border-color: #a51c5e;
}

.ys-pay-dropdown select:focus {
    outline: none;
    border-color: #a51c5e;
    box-shadow: 0 0 0 2px rgba(165, 28, 94, 0.2);
}

/* Payment Button Styles */
.ys-pay-payment-button {
    display: block;
    width: 100%;
    margin: 25px 0 15px;
    padding: 15px;
    background-color: #8bc34a;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ys-pay-payment-button:hover {
    background-color: #7ab33a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ys-pay-payment-button:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Mobile Optimizations for Payment Button */
@media screen and (max-width: 768px) {
    .ys-pay-payment-button {
        padding: 16px;
        font-size: 18px;
        margin: 20px 0 10px;
        height: auto;
        min-height: 54px;
    }
}

@media screen and (max-width: 480px) {
    .ys-pay-payment-button {
        padding: 14px;
        font-size: 17px;
        margin: 15px 0 10px;
        min-height: 50px;
    }
}

/* PDF Styles */
.pdf-container {
    position: relative;
    width: 100%;
    height: 100vh;
    max-height: 800px;
    margin: 0 auto;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

#pdf-viewer-frame {
    width: 100%;
    height: 100%;
    border: none;
}

#pdf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pdf-error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 15px;
    margin: 10px 0;
    border-radius: 4px;
    text-align: center;
}
