/**
 * Kayloot Multi-Currency Popup Styles
 *
 * @package Kayloot_Multi_Currency
 */

/* Prevent body scroll when popup is open */
body.kmc-popup-open {
    overflow: hidden;
}

/* Overlay */
.kmc-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(4px);
}

/* Container */
.kmc-popup-container {
    width: 100%;
    max-width: 480px;
    animation: kmcSlideIn 0.3s ease-out;
}

@keyframes kmcSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Content - Body background #1A1A1A */
.kmc-popup-content {
    background: #1A1A1A !important;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
}

/* Header - Background #E90910 */
.kmc-popup-header {
    background: #E90910 !important;
    padding: 24px 28px;
    text-align: center;
}

.kmc-popup-title {
    margin: 0;
    color: #ffffff !important;
    font-size: 22px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.kmc-popup-icon {
    font-size: 28px;
}

/* Body */
.kmc-popup-body {
    padding: 28px;
    background: #1A1A1A !important;
}

/* Text in white */
.kmc-popup-message {
    margin: 0 0 24px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #ffffff !important;
    text-align: center;
}

.kmc-popup-message strong {
    color: #ffffff !important;
}

/* Country Selector */
.kmc-country-selector {
    margin-bottom: 16px;
}

/* Custom Select Wrapper */
.kmc-custom-select-wrapper {
    position: relative;
    width: 100%;
}

/* Custom display for selected value */
.kmc-selected-display {
    width: 100%;
    padding: 14px 16px;
    padding-right: 40px;
    font-size: 16px;
    font-weight: 500;
    border: 2px solid #E90910;
    border-radius: 8px;
    background-color: #E90910;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    min-height: 52px;
}

.kmc-selected-display:hover {
    background-color: #cc0000;
    border-color: #ff3333;
}

.kmc-selected-display.has-selection {
    background-color: #E90910;
}

#kmc-selected-country-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ffffff;
}

.kmc-select-arrow {
    font-size: 12px;
    color: #ffffff;
    margin-left: 10px;
    transition: transform 0.2s ease;
}

/* Hidden native select - positioned over the custom display */
.kmc-select-hidden {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 16px;
}

/* Style the dropdown options when opened */
.kmc-select-hidden option {
    background-color: #1A1A1A !important;
    color: #ffffff !important;
    padding: 12px;
    font-size: 16px;
}

.kmc-select-hidden option:checked,
.kmc-select-hidden option:hover {
    background-color: #E90910 !important;
    color: #ffffff !important;
}

/* Firefox specific fix for options */
@-moz-document url-prefix() {
    .kmc-select-hidden option {
        background-color: #1A1A1A !important;
        color: #ffffff !important;
    }
}

/* Currency Info - Text #E90910 */
.kmc-currency-info {
    text-align: center;
    margin: 0 0 20px 0;
    padding: 12px;
    background-color: #2a2a2a;
    border-radius: 8px;
    color: #ffffff;
    font-size: 15px;
    border: 1px solid #333333;
}

.kmc-currency-info strong {
    color: #E90910;
    font-weight: 700;
}

/* Actions */
.kmc-popup-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Buttons */
.kmc-btn {
    flex: 1;
    min-width: 140px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.kmc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.kmc-btn-icon {
    font-size: 16px;
}

/* Primary Button - Green (Appliquer/Confirmer) */
.kmc-btn-primary {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%) !important;
    color: #ffffff !important;
}

.kmc-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #219a52 0%, #27ae60 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.kmc-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

/* Secondary Button - Red #E90910 (Retour/Changer) */
.kmc-btn-secondary {
    background: #E90910 !important;
    color: #ffffff !important;
    border: none;
}

.kmc-btn-secondary:hover:not(:disabled) {
    background: #cc0000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 9, 16, 0.4);
}

.kmc-btn-secondary:active:not(:disabled) {
    transform: translateY(0);
}

/* Footer */
.kmc-popup-footer {
    padding: 16px 28px;
    background-color: #1A1A1A !important;
    border-top: 1px solid #333333;
}

/* Account hint message */
.kmc-account-hint {
    margin: 0 0 10px 0;
    text-align: center;
    color: #cccccc !important;
    font-size: 13px;
    line-height: 1.5;
}

.kmc-account-hint .kmc-highlight {
    color: #E90910 !important;
    font-weight: 700;
}

.kmc-gdpr-notice {
    margin: 0;
    text-align: center;
    color: #999999;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.kmc-gdpr-icon {
    font-size: 14px;
}

/* Loading Overlay */
.kmc-popup-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 26, 26, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 16px;
}

.kmc-popup-loading p {
    margin: 16px 0 0 0;
    color: #ffffff;
    font-size: 15px;
}

.kmc-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #333333;
    border-top-color: #E90910;
    border-radius: 50%;
    animation: kmcSpin 0.8s linear infinite;
}

@keyframes kmcSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Checkout Notice */
.kmc-checkout-notice {
    margin-bottom: 20px;
    background: #E90910 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 20px !important;
}

.kmc-checkout-notice::before {
    color: #ffffff !important;
}

.kmc-checkout-notice strong {
    color: #ffffff;
}

/* Payment Notice */
.kmc-payment-notice {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #28a745 !important;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.kmc-payment-notice p {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Cart and Checkout Price Styling */
.woocommerce-cart .cart_totals .woocommerce-Price-amount,
.woocommerce-checkout .woocommerce-Price-amount {
    font-weight: 600;
}

/* Currency indicator badge */
.kmc-currency-badge {
    display: inline-block;
    background: #E90910;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 5px;
    vertical-align: middle;
}

/* Account page: spacing for currency selector */
.woocommerce-account .kmc-account-country {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.woocommerce-account .kmc-account-country p {
    margin: 0;
}

.woocommerce-account .kmc-account-country .kmc-account-country-select {
    min-width: 220px;
}

/* Mobile Responsive */
@media screen and (max-width: 480px) {
    .kmc-popup-overlay {
        padding: 16px;
        align-items: center;
    }

    .kmc-popup-container {
        max-width: 100%;
        transform: translateY(-25%);
    }

    .kmc-popup-content {
        border-radius: 16px;
    }

    .kmc-popup-header {
        padding: 20px 20px;
    }

    .kmc-popup-title {
        font-size: 20px;
    }

    .kmc-popup-body {
        padding: 20px;
    }

    .kmc-popup-message {
        font-size: 15px;
    }

    .kmc-popup-actions {
        flex-direction: column;
    }

    .kmc-btn {
        min-width: 100%;
    }

    .kmc-popup-footer {
        padding: 14px 20px;
    }
}

/* Tablet */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .kmc-popup-container {
        max-width: 420px;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .kmc-btn-primary {
        background: #27ae60;
    }
    
    .kmc-btn-secondary {
        background: #E90910;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .kmc-popup-container {
        animation: none;
    }
    
    .kmc-spinner {
        animation: none;
        border-top-color: #E90910;
        border-right-color: #E90910;
    }
    
    .kmc-btn:hover {
        transform: none;
    }
}

