/**
 * WordPress-specific styles for PayFast Currency Converter
 * These styles ensure the plugin integrates well with WordPress themes
 */

.payfast-currency-converter-container {
    max-width: 100%;
    margin: 20px 0;
    font-family: inherit;
    line-height: 1.6;
    clear: both;
}

/* WordPress theme compatibility */
.payfast-currency-converter-container * {
    box-sizing: border-box;
}

.payfast-currency-converter-container h2,
.payfast-currency-converter-container h3 {
    color: inherit;
    font-family: inherit;
    line-height: inherit;
    margin-top: 0;
}

.payfast-currency-converter-container p {
    margin-bottom: 1em;
}

/* Fallback styles when React is not available */
.payfast-currency-converter-fallback {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.payfast-currency-converter-fallback .notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    color: #856404;
}

.payfast-currency-converter-fallback .fallback-form {
    background: white;
    border-radius: 6px;
    padding: 20px;
    border: 1px solid #e0e0e0;
}

.payfast-currency-converter-fallback .fallback-form h3 {
    margin-top: 0;
    color: #333;
    font-size: 18px;
}

.payfast-currency-converter-fallback input[type="number"] {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    font-size: 14px;
}

.payfast-currency-converter-fallback input[type="image"] {
    max-width: 200px;
    height: auto;
    border: none;
    cursor: pointer;
}

/* Loading states */
.payfast-currency-converter-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.payfast-currency-converter-loading::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: payfast-spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes payfast-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* WordPress admin styles */
.wp-admin .payfast-currency-converter-container {
    background: white;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin: 15px 0;
}

/* Theme compatibility adjustments */
.theme-twentytwentythree .payfast-currency-converter-container,
.theme-twentytwentytwo .payfast-currency-converter-container,
.theme-twentytwentyone .payfast-currency-converter-container {
    font-family: inherit;
}

/* Gutenberg editor compatibility */
.wp-block-shortcode .payfast-currency-converter-container {
    border: 2px dashed #ddd;
    padding: 20px;
    margin: 10px 0;
    background: #f9f9f9;
}

.wp-block-shortcode .payfast-currency-converter-container::before {
    content: "PayFast Currency Converter";
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* RTL support */
.rtl .payfast-currency-converter-container {
    direction: rtl;
    text-align: right;
}

.rtl .payfast-currency-converter-container .conversion-main {
    flex-direction: row-reverse;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .payfast-currency-converter-container {
        border-color: #000;
    }
    
    .payfast-currency-converter-container .from-amount,
    .payfast-currency-converter-container .to-amount {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .payfast-currency-converter-container *,
    .payfast-currency-converter-container *::before,
    .payfast-currency-converter-container *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .payfast-currency-converter-container {
        break-inside: avoid;
        border: 1px solid #000;
        background: white !important;
    }
    
    .payfast-currency-converter-container .payfast-button,
    .payfast-currency-converter-container .refresh-btn,
    .payfast-currency-converter-container .retry-btn {
        display: none;
    }
    
    .payfast-currency-converter-container::after {
        content: "Visit website to make payment";
        display: block;
        text-align: center;
        font-style: italic;
        margin-top: 20px;
        color: #666;
    }
}

/* Mobile-first responsive adjustments for WordPress themes */
@media (max-width: 782px) {
    .payfast-currency-converter-container {
        margin: 15px -20px;
        padding: 15px 20px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

@media (max-width: 480px) {
    .payfast-currency-converter-container {
        margin: 10px -15px;
        padding: 15px;
    }
}
