/**
 * EW Bible Version Switcher - Styles
 * Styled to match EnduringWord.com design language
 * Uses #ew-bvs-selector ID specificity to override theme conflicts
 */

/* EnduringWord brand color */
:root {
    --ew-bvs-primary-blue: #449ae3;
    --ew-bvs-primary-blue-dark: #2d7bc4;
    --ew-bvs-primary-blue-light: #e8f4fc;
    --ew-bvs-border-gray: #c8c8c8;
    --ew-bvs-text-dark: #333333;
    --ew-bvs-text-medium: #555555;
    --ew-bvs-white: #ffffff;
}

/* Base selector styles - ID specificity reset */
#ew-bvs-selector {
    position: fixed;
    z-index: 10000; /* EW z-index layer: selectors=10000, drawer=10100, tooltip=10200 */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    text-transform: none;
    letter-spacing: normal;
}

#ew-bvs-selector *,
#ew-bvs-selector *::before,
#ew-bvs-selector *::after {
    box-sizing: border-box;
}

/* Position variants */
#ew-bvs-selector.ew-bvs-position-bottom-right {
    bottom: 20px;
    right: 20px;
    top: auto;
    left: auto;
}

#ew-bvs-selector.ew-bvs-position-bottom-left {
    bottom: 20px;
    left: 20px;
    top: auto;
    right: auto;
}

#ew-bvs-selector.ew-bvs-position-top-right {
    top: 20px;
    right: 20px;
    bottom: auto;
    left: auto;
}

#ew-bvs-selector.ew-bvs-position-top-content {
    position: relative;
    margin-bottom: 20px;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
}

/* Toggle button - ID specificity to override theme button styles */
#ew-bvs-selector .ew-bvs-toggle,
#ew-bvs-selector button.ew-bvs-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    margin: 0;
    background: #ffffff;
    background-color: #ffffff;
    background-image: none;
    border: 1px solid #c8c8c8;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: none;
    transition: border-color 0.2s ease;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    min-height: auto;
    height: auto;
    width: auto;
    min-width: auto;
    float: none;
    outline: none;
    color: #333333;
}

#ew-bvs-selector .ew-bvs-toggle:hover,
#ew-bvs-selector button.ew-bvs-toggle:hover {
    border-color: #449ae3;
    background: #ffffff;
    background-color: #ffffff;
    background-image: none;
    box-shadow: none;
    color: #333333;
}

#ew-bvs-selector .ew-bvs-toggle:focus,
#ew-bvs-selector button.ew-bvs-toggle:focus {
    outline: none;
    border-color: #449ae3;
    background: #ffffff;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px #e8f4fc;
    color: #333333;
}

#ew-bvs-selector .ew-bvs-toggle:active,
#ew-bvs-selector button.ew-bvs-toggle:active {
    background: #ffffff;
    background-color: #ffffff;
    transform: none;
    color: #333333;
}

#ew-bvs-selector .ew-bvs-current-version {
    font-weight: 500;
    font-size: 14px;
    color: var(--ew-bvs-text-dark);
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.4;
    margin: 0;
    padding: 0;
}

#ew-bvs-selector .ew-bvs-chevron {
    display: block;
    width: 12px;
    height: 12px;
    color: var(--ew-bvs-text-medium);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

#ew-bvs-selector.open .ew-bvs-chevron {
    transform: rotate(180deg);
}

/* Dropdown - clean, minimal style with ID specificity */
#ew-bvs-selector .ew-bvs-dropdown {
    position: absolute;
    bottom: calc(100% + 4px);
    right: 0;
    left: auto;
    top: auto;
    width: 280px;
    min-width: 280px;
    max-width: 320px;
    background: #ffffff;
    background-color: #ffffff;
    border: 1px solid #c8c8c8;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    margin: 0;
    padding: 0;
    list-style: none;
    float: none;
    overflow: hidden;
}

#ew-bvs-selector.ew-bvs-position-top-right .ew-bvs-dropdown,
#ew-bvs-selector.ew-bvs-position-top-content .ew-bvs-dropdown {
    bottom: auto;
    top: calc(100% + 4px);
    transform: translateY(-8px);
}

#ew-bvs-selector.ew-bvs-position-bottom-left .ew-bvs-dropdown,
#ew-bvs-selector.ew-bvs-position-top-content .ew-bvs-dropdown {
    right: auto;
    left: 0;
}

#ew-bvs-selector.open .ew-bvs-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown options - ID specificity for button overrides */
#ew-bvs-selector .ew-bvs-dropdown .ew-bvs-option,
#ew-bvs-selector .ew-bvs-dropdown button.ew-bvs-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 12px;
    margin: 0;
    background: transparent;
    background-color: transparent;
    background-image: none;
    border: none;
    border-radius: 0;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    transition: background-color 0.15s ease;
    font-size: 13px;
    font-weight: normal;
    line-height: 1.4;
    min-height: auto;
    height: auto;
    box-shadow: none;
    outline: none;
    float: none;
    color: #333333;
}

#ew-bvs-selector .ew-bvs-dropdown .ew-bvs-option:first-child {
    border-radius: 4px 4px 0 0;
}

#ew-bvs-selector .ew-bvs-dropdown .ew-bvs-option:last-child {
    border-radius: 0 0 4px 4px;
}

#ew-bvs-selector .ew-bvs-dropdown .ew-bvs-option:hover,
#ew-bvs-selector .ew-bvs-dropdown button.ew-bvs-option:hover {
    background: #f5f5f5;
    background-color: #f5f5f5;
    background-image: none;
    color: #333333;
}

#ew-bvs-selector .ew-bvs-dropdown .ew-bvs-option:focus,
#ew-bvs-selector .ew-bvs-dropdown button.ew-bvs-option:focus {
    outline: none;
    background: #e8f4fc;
    background-color: #e8f4fc;
    color: #333333;
}

#ew-bvs-selector .ew-bvs-dropdown .ew-bvs-option.active,
#ew-bvs-selector .ew-bvs-dropdown button.ew-bvs-option.active {
    background: #e8f4fc;
    background-color: #e8f4fc;
}

/* Version code badge */
#ew-bvs-selector .ew-bvs-option-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 5px 8px;
    margin: 0;
    background: var(--ew-bvs-primary-blue);
    background-image: none;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 4px;
    border: none;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.2;
    box-shadow: none;
    flex-shrink: 0;
}

#ew-bvs-selector .ew-bvs-option.active .ew-bvs-option-code {
    background: var(--ew-bvs-primary-blue-dark);
}

/* Version name text */
#ew-bvs-selector .ew-bvs-option-name,
#ew-bvs-selector span.ew-bvs-option-name {
    color: #333333;
    font-size: 13px;
    font-weight: normal;
    font-family: inherit;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.3;
    margin: 0;
    padding: 0;
    white-space: normal;
}

/* Version attribution tag - superscript style */
.ew-bvs-attribution.ew-bvs-attribution {
    display: inline !important;
    margin-left: 2px !important;
    font-size: 0.7em !important;
    font-weight: 500 !important;
    color: var(--ew-bvs-primary-blue) !important;
    vertical-align: super !important;
    line-height: 0 !important;
    text-decoration: none !important;
}

/* Loading state */
.ew-bvs-loading .ew-bible-text {
    opacity: 0.6 !important;
    transition: opacity 0.2s ease !important;
}

/* Mobile responsive */
@media (max-width: 600px) {
    #ew-bvs-selector {
        bottom: 10px;
        right: 10px;
    }

    #ew-bvs-selector.ew-bvs-position-bottom-left,
    #ew-bvs-selector.ew-bvs-position-bottom-right {
        bottom: 10px;
        right: 10px;
        left: auto;
    }

    #ew-bvs-selector .ew-bvs-dropdown {
        min-width: 200px;
    }

    #ew-bvs-selector .ew-bvs-toggle {
        padding: 6px 10px;
    }
}
