/**
 * BinaryCurrency - Frontend Styles
 *
 * @package BinaryCurrency
 * @version 1.0.0
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
    --bc-primary-color: #0073aa;
    --bc-primary-hover: #005a87;
    --bc-text-color: #333333;
    --bc-text-light: #666666;
    --bc-border-color: #dddddd;
    --bc-background: #ffffff;
    --bc-background-hover: #f7f7f7;
    --bc-flag-size: 20px;
    --bc-flag-size-small: 16px;
    --bc-dropdown-radius: 4px;
    --bc-dropdown-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    --bc-transition: all 0.2s ease-in-out;
}

/* ==========================================================================
   Currency Switcher Container
   ========================================================================== */

.binary-currency-switcher {
    position: relative;
    display: inline-block;
    font-family: inherit;
    font-size: 14px;
}

.binary-currency-switcher * {
    box-sizing: border-box;
}

/* ==========================================================================
   Custom Select Dropdown
   ========================================================================== */

.bc-dropdown {
    position: relative;
    width: 100%;
    min-width: 150px;
}

.bc-dropdown-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bc-background);
    border: 1px solid var(--bc-border-color);
    border-radius: var(--bc-dropdown-radius);
    cursor: pointer;
    transition: var(--bc-transition);
}

.bc-dropdown-selected:hover {
    border-color: var(--bc-primary-color);
}

.bc-dropdown-selected::after {
    content: '';
    margin-left: auto;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--bc-text-light);
    transition: var(--bc-transition);
}

.bc-dropdown.active .bc-dropdown-selected::after {
    transform: rotate(180deg);
}

/* ==========================================================================
   Dropdown Options List
   ========================================================================== */

.bc-dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    padding: 0;
    list-style: none;
    background: var(--bc-background);
    border: 1px solid var(--bc-border-color);
    border-radius: var(--bc-dropdown-radius);
    box-shadow: var(--bc-dropdown-shadow);
    max-height: 250px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--bc-transition);
    z-index: 1000;
}

.bc-dropdown.active .bc-dropdown-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bc-dropdown-options li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--bc-transition);
}

.bc-dropdown-options li:hover {
    background: var(--bc-background-hover);
}

.bc-dropdown-options li.selected {
    background: var(--bc-background-hover);
    font-weight: 600;
}

/* ==========================================================================
   Flag Styles
   ========================================================================== */

.bc-flag {
    width: var(--bc-flag-size);
    height: var(--bc-flag-size);
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
}

.bc-switcher-small .bc-flag {
    width: var(--bc-flag-size-small);
    height: var(--bc-flag-size-small);
}

/* ==========================================================================
   Currency Info Styles
   ========================================================================== */

.bc-currency-name {
    color: var(--bc-text-color);
}

.bc-currency-symbol {
    color: var(--bc-text-light);
    font-weight: 500;
}

.bc-currency-code {
    color: var(--bc-text-light);
    font-size: 0.9em;
    text-transform: uppercase;
}

/* ==========================================================================
   Size Variants
   ========================================================================== */

.bc-switcher-small .bc-dropdown-selected {
    padding: 6px 10px;
    font-size: 13px;
}

.bc-switcher-small .bc-dropdown-options li {
    padding: 8px 10px;
    font-size: 13px;
}

/* ==========================================================================
   Single Product Page Switcher
   ========================================================================== */

.binary-currency-single-product {
    margin: 15px 0;
}

/* ==========================================================================
   Widget Styles
   ========================================================================== */

.widget .binary-currency-switcher {
    width: 100%;
}

.widget .bc-dropdown {
    width: 100%;
}

/* ==========================================================================
   Hidden Form
   ========================================================================== */

.bc-form-hidden {
    display: none !important;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.bc-loading {
    opacity: 0.6;
    pointer-events: none;
}

.bc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 12px;
    width: 16px;
    height: 16px;
    border: 2px solid var(--bc-border-color);
    border-top-color: var(--bc-primary-color);
    border-radius: 50%;
    animation: bc-spin 0.6s linear infinite;
}

@keyframes bc-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .bc-dropdown {
        min-width: 120px;
    }
    
    .bc-dropdown-options {
        max-height: 200px;
    }
}
