/**
 * BinaryCurrency Switcher Styles
 *
 * @package BinaryCurrency
 */

/* ==========================================================================
   CSS Variables (Default Values)
   ========================================================================== */

.binary-currency-single-page-switcher {
    --bc-trigger-bg: #ffffff;
    --bc-text-color: #151515;
    --bc-border-color: #e5e5e5;
    --bc-border-hover: #d4d4d4;
    --bc-border-active: #2271b1;
    --bc-dropdown-bg: #ffffff;
    --bc-option-hover: #f5f5f5;
    --bc-option-selected: #f5f5f5;
    --bc-border-radius: 8px;
    --bc-arrow-color: currentColor;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

.binary-currency-checkout-notice,
.binary-currency-checkout-notice-admin {
    background: #f8f8f8;
    color: #555;
    border-radius: 3px;
    padding: 20px;
    margin-bottom: 20px;
    width: 100% !important;
}

.binary-currency-checkout-notice {
    border-left: 3px solid #ffc106;
}

.binary-currency-checkout-notice-admin {
    border-left: 3px solid #2271b1;
}

/* Hidden native select */
.binary-currency-switcher {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.binary-currency-single-page-switcher {
    margin-bottom: 8px;
}

.binary-currency-form-switcher {
    margin: 0;
    display: none !important;
}

/* ==========================================================================
   Custom Select Wrapper
   ========================================================================== */

.binary-currency-custom-select-wrapper {
    overflow: visible !important;
    position: relative;
    user-select: none;
    width: fit-content;
}

.binary-currency-custom-select-wrapper.widget {
    width: 100%;
}

.binary-currency-custom-select-wrapper.small {
    width: 235px;
    font-size: 11px;
}

.binary-currency-custom-select-wrapper.no-currency-name {
    width: fit-content;
}

.binary-currency-custom-select-wrapper.only-currency-name {
    width: 180px;
}

.binary-currency-custom-select-wrapper.only-currency-name-and-something {
    width: 215px;
}

.binary-currency-custom-select-wrapper.small.only-currency-name {
    width: 160px;
}

.binary-currency-custom-select-wrapper.small.only-currency-name-and-something {
    width: 190px;
}

/* ==========================================================================
   Custom Select
   ========================================================================== */

.binary-currency-custom-select {
    position: relative;
    display: flex;
    flex-direction: column;
    width: fit-content;
}

/* ==========================================================================
   Trigger (Selected Currency)
   ========================================================================== */

.binary-currency-custom-select__trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--bc-text-color);
    height: 36px;
    line-height: 14px;
    background: var(--bc-trigger-bg);
    cursor: pointer;
    border: 1px solid var(--bc-border-color);
    border-radius: var(--bc-border-radius);
    padding: 8px 12px;
    gap: 8px;
    width: fit-content;
    box-sizing: border-box;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.binary-currency-custom-select__trigger.medium .binary-currency-selected-option,
.binary-currency-custom-option.medium {
    font-size: 14px;
}

.binary-currency-custom-select__trigger.small {
    height: 30px !important;
    font-size: 12px !important;
    padding: 8px 6px !important;
}

.binary-currency-custom-option.small {
    font-size: 12px !important;
}

.binary-currency-custom-select__trigger:hover {
    border-color: var(--bc-border-hover);
}

.binary-currency-custom-select.open .binary-currency-custom-select__trigger {
    border-color: var(--bc-border-active);
}

/* ==========================================================================
   Selected Option Display
   ========================================================================== */

.binary-currency-custom-selected-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   Dropdown Arrow
   ========================================================================== */

.binary-currency-custom-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.binary-currency-custom-arrow .binary-currency-arrow-icon {
    opacity: 0.5;
    width: 16px;
    height: 16px;
    color: var(--bc-arrow-color);
}

.binary-currency-custom-select.open .binary-currency-custom-arrow {
    transform: rotate(180deg);
}

/* ==========================================================================
   Options Dropdown
   ========================================================================== */

.binary-currency-custom-options {
    position: absolute;
    display: block;
    top: 100%;
    left: 0 !important;
    right: 0;
    border: 1px solid var(--bc-border-color);
    border-radius: var(--bc-border-radius);
    background: var(--bc-dropdown-bg);
    height: 0;
    max-height: 300px;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-padding-block: 4px;
    margin: 0 !important;
    margin-top: 3px !important;
    padding: 4px !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 99999999;
    width: 100% !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -2px rgba(0, 0, 0, 0.1);
    transition: opacity 0.15s ease, transform 0.15s ease;
    list-style: none;
}

/* Scrollbar */
.binary-currency-custom-options::-webkit-scrollbar {
    width: 6px;
}

.binary-currency-custom-options::-webkit-scrollbar-thumb {
    background-color: #d4d4d4;
    border-radius: 3px;
}

.binary-currency-custom-options::-webkit-scrollbar-thumb:hover {
    background-color: #a3a3a3;
}

/* Upwards positioning */
.binary-currency-custom-options.upwards {
    top: auto;
    bottom: 95%;
    margin-bottom: 5px !important;
    margin-top: 0px !important;
}

/* Open state */
.binary-currency-custom-select.open .binary-currency-custom-options {
    display: block;
    height: auto;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: all !important;
    min-width: max-content;
    max-width: 312px;
    animation: binaryCurrencyFadeIn 0.15s ease-out,
        binaryCurrencySlideInFromTop 0.15s ease-out;
}

.binary-currency-custom-select.open .binary-currency-custom-options.upwards {
    animation: binaryCurrencyFadeIn 0.15s ease-out,
        binaryCurrencySlideInFromBottom 0.15s ease-out;
}

/* ==========================================================================
   Option Rows
   ========================================================================== */

.binary-currency-custom-option-row {
    display: flex !important;
    border-block: unset !important;
    justify-content: flex-start;
    align-items: center;
    list-style: none;
    padding: 8px 8px !important;
    margin: 0 !important;
    color: var(--bc-text-color);
    line-height: 14px !important;
    background-color: var(--bc-dropdown-bg);
    gap: 8px;
    cursor: pointer;
    border-radius: calc(var(--bc-border-radius) - 2px);
    transition: background-color 0.15s ease;
}

.binary-currency-custom-option-row:not(.selected):hover {
    background-color: var(--bc-option-hover);
}

.binary-currency-custom-option-row.selected {
    background-color: var(--bc-option-selected);
}

/* When hovering another option, remove selected background */
.binary-currency-custom-options:has(.binary-currency-custom-option-row:hover:not(.selected))
    .binary-currency-custom-option-row.selected {
    background-color: unset;
}

/* Selected check icon */
.binary-currency-custom-option-row span.binary-currency-selected-checked-icon {
    width: 14px;
    height: 14px;
    margin-left: auto;
}

.binary-currency-custom-option-row:not(.binary-currency-row-with-flag)
    span.binary-currency-selected-checked-icon {
    position: absolute;
    right: 12px;
    display: flex;
    justify-content: center;
}

/* ==========================================================================
   Currency Option Text
   ========================================================================== */

.binary-currency-custom-option {
    flex: 1;
    min-width: 0;
    max-width: 250px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: block;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
}

.binary-currency-custom-option::before {
    border-color: transparent !important;
}

/* ==========================================================================
   Currency Flags
   ========================================================================== */

.binary-currency-flag {
    display: inline-block;
    min-width: 24px;
    min-height: 18px;
    border-radius: 2px;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    flex-shrink: 0;
}

.binary-currency-flag.small {
    min-width: 20px;
    min-height: 15px;
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */

.binary-currency-custom-loader {
    animation: binaryCurrencySpin 1s linear infinite;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    display: none;
    margin-right: 4px;
    width: 14px;
    height: 14px;
}

.binary-currency-custom-loader.active {
    display: inline-block;
}

/* ==========================================================================
   Widget Specific Styles
   ========================================================================== */

.binary-currency-widget-switcher {
    padding: 10px 0;
}

.binary-currency-widget-switcher h4 {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes binaryCurrencySpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes binaryCurrencyFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes binaryCurrencySlideInFromTop {
    from {
        transform: translateY(-0.5rem);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes binaryCurrencySlideInFromBottom {
    from {
        transform: translateY(0.5rem);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==========================================================================
   Approximate Price Display
   ========================================================================== */

.binary-currency-approximately-price {
    display: block !important;
    padding-left: 0;
    line-height: 1.3;
    padding: 7px 0px;
    font-size: 0.9em;
    color: #666;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
    .binary-currency-custom-select__trigger {
        padding: 6px 10px;
        height: 32px;
    }
    
    .binary-currency-flag {
        min-width: 20px;
        min-height: 15px;
    }
}

/* ==========================================================================
   Currency Converter Shortcode Styles
   ========================================================================== */

.binary-currency-converter {
    max-width: 400px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.binary-currency-converter .converter-row {
    margin-bottom: 16px;
}

.binary-currency-converter .converter-row label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin-bottom: 6px;
}

.binary-currency-converter .converter-input-group {
    display: flex;
    gap: 8px;
}

.binary-currency-converter .binary-converter-input,
.binary-currency-converter .binary-converter-result {
    flex: 1;
    padding: 10px 14px;
    font-size: 16px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.binary-currency-converter .binary-converter-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.binary-currency-converter .binary-converter-result {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.binary-currency-converter .binary-converter-from-currency,
.binary-currency-converter .binary-converter-to-currency {
    min-width: 140px;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.binary-currency-converter .binary-converter-from-currency:hover,
.binary-currency-converter .binary-converter-to-currency:hover {
    border-color: #d4d4d4;
}

.binary-currency-converter .binary-converter-from-currency:focus,
.binary-currency-converter .binary-converter-to-currency:focus {
    border-color: #2271b1;
}

.binary-currency-converter .converter-swap {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

.binary-currency-converter .binary-converter-swap-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 50%;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
}

.binary-currency-converter .binary-converter-swap-btn:hover {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

.binary-currency-converter .binary-converter-swap-btn svg {
    width: 20px;
    height: 20px;
}

.binary-currency-converter .converter-rate-info {
    text-align: center;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.binary-currency-converter .rate-display {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.binary-currency-converter .rate-updated {
    font-size: 12px;
    color: #999;
}

/* Responsive Converter */
@media (max-width: 480px) {
    .binary-currency-converter {
        padding: 16px;
    }

    .binary-currency-converter .converter-input-group {
        flex-direction: column;
    }

    .binary-currency-converter .binary-converter-from-currency,
    .binary-currency-converter .binary-converter-to-currency {
        min-width: 100%;
    }
}

/* ==========================================================================
   Price Display Shortcode Styles
   ========================================================================== */

.binary-currency-price-html {
    display: inline;
}

.binary-currency-price-html .binary-price-amount {
    font-weight: 600;
}

.binary-currency-price-html .binary-price-symbol {
    font-size: 0.9em;
}

.binary-currency-price-html.with-original {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
}

.binary-currency-price-html .original-price {
    font-size: 0.85em;
    color: #999;
    text-decoration: line-through;
}