/**
 * CGF Currency System - Frontend Styles
 * @version 1.2.0
 * 
 * 针对 wolmart 主题深色 header 优化
 */

/* 目的地选择器 - 独立顶部条样式（备用） */
.cgf-destination-bar {
    background: #1a1a2e;
    padding: 8px 20px;
    text-align: center;
    width: 100%;
}

/* 目的地选择器容器 */
.cgf-destination-wrapper {
    display: inline-block !important;
}

/* 目的地选择器 - 内联样式 */
.cgf-destination-selector {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 5px 0;
    margin: 0 15px;
}

/* 默认使用深色文字（适配白色/浅色 header） */
.cgf-destination-selector .cgf-label {
    color: #e8a23a !important;
    font-weight: 500;
}

/* 下拉框容器 */
.cgf-dropdown {
    position: relative;
    display: inline-block;
}

/* 下拉按钮 */
.cgf-dropdown-toggle {
    background: transparent !important;
    border: 1px solid #e8a23a !important;
    border-radius: 4px;
    padding: 6px 14px;
    color: #e8a23a !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cgf-dropdown-toggle:hover {
    background: #e8a23a !important;
    border-color: #e8a23a !important;
    color: #ffffff !important;
}

.cgf-dropdown-toggle.active {
    background: #e8a23a !important;
    border-color: #e8a23a !important;
    color: #ffffff !important;
}

.cgf-dropdown-toggle.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* 当前选中的目的地文字 */
.cgf-current-destination {
    color: inherit !important;
}

/* 箭头图标 */
.cgf-arrow {
    font-size: 10px;
    color: inherit !important;
    transition: transform 0.2s ease;
}

.cgf-dropdown-toggle.active .cgf-arrow {
    transform: rotate(180deg);
}

/* 下拉菜单 - 保持白色背景便于阅读 */
.cgf-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #ffffff !important;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-top: 5px;
    padding: 5px 0;
    list-style: none;
    z-index: 99999;
    max-height: 300px;
    overflow-y: auto;
}

.cgf-dropdown-menu li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cgf-dropdown-menu a {
    display: block;
    padding: 10px 15px;
    color: #333 !important;
    text-decoration: none !important;
    font-size: 13px;
    transition: background 0.15s ease;
    text-shadow: none !important;
}

.cgf-dropdown-menu a:hover {
    background: #f0f7ff;
    color: #0066cc !important;
}

/* 浅色背景下的样式覆盖（如果需要） */
.light-header .cgf-destination-selector .cgf-label,
.white-header .cgf-destination-selector .cgf-label {
    color: #e8a23a !important;
}

.light-header .cgf-dropdown-toggle,
.white-header .cgf-dropdown-toggle {
    background: transparent !important;
    border-color: #e8a23a !important;
    color: #e8a23a !important;
}

.light-header .cgf-current-destination,
.white-header .cgf-current-destination {
    color: #e8a23a !important;
}

.light-header .cgf-arrow,
.white-header .cgf-arrow {
    color: #e8a23a !important;
}

/* 响应式 */
@media (max-width: 768px) {
    .cgf-destination-bar {
        padding: 6px 15px;
    }
    
    .cgf-destination-selector {
        font-size: 12px;
        margin: 0 8px;
    }
    
    .cgf-dropdown-toggle {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .cgf-dropdown-menu {
        min-width: 180px;
        right: 0;
        left: auto;
    }
    
    .cgf-label {
        display: none; /* 移动端隐藏 "Ship to:" 标签节省空间 */
    }
}


/* ========================================
   产品详情页内联目的地选择器样式
   ======================================== */

/* 价格区域容器 - 让价格和选择器在同一行 */
.summary .price {
    display: inline-block !important;
    vertical-align: middle;
}

/* 内联选择器容器 - 与价格同行显示 */
.cgf-inline-destination-wrapper {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    margin-left: 30px;
    padding: 8px 16px;
    background: #fff8f0;
    border: 2px solid #e8a23a;
    border-radius: 20px;
    font-size: 13px;
    vertical-align: middle;
    position: relative;
    top: -2px;
    white-space: nowrap;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    animation: cgf-border-pulse 2s ease-in-out infinite;
    cursor: pointer;
}

/* 边框闪动动画 */
@keyframes cgf-border-pulse {
    0% {
        border-color: #e8a23a;
        box-shadow: 0 0 0 0 rgba(232, 162, 58, 0.4);
    }
    50% {
        border-color: #ff6b6b;
        box-shadow: 0 0 8px 2px rgba(255, 107, 107, 0.5);
    }
    100% {
        border-color: #e8a23a;
        box-shadow: 0 0 0 0 rgba(232, 162, 58, 0.4);
    }
}

.cgf-inline-label {
    color: #e8a23a;
    font-weight: 500;
    white-space: nowrap;
    margin-right: 5px;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    font-family: inherit;
}

.cgf-inline-dropdown {
    position: relative;
    display: inline-block;
}

.cgf-inline-dropdown-toggle {
    background: transparent !important;
    border: none !important;
    padding: 0;
    color: #e8a23a !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.cgf-inline-dropdown-toggle:hover {
    color: #d4922e !important;
}

.cgf-inline-current {
    color: inherit;
}

.cgf-inline-arrow {
    font-size: 10px;
    color: inherit;
    transition: transform 0.2s ease;
}

.cgf-inline-dropdown.open .cgf-inline-arrow,
.cgf-inline-destination-wrapper.open .cgf-inline-arrow {
    transform: rotate(180deg);
}

/* 内联下拉菜单 */
.cgf-inline-dropdown-menu {
    position: absolute !important;
    top: 45px !important;
    left: 0 !important;
    min-width: 280px !important;
    background: #ffffff !important;
    border: 1px solid #ccc !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
    margin: 0 !important;
    padding: 8px 0 !important;
    z-index: 9999999 !important;
    max-height: 350px !important;
    overflow-y: auto !important;
    display: none;
}

.cgf-inline-dropdown.open .cgf-inline-dropdown-menu,
.cgf-inline-destination-wrapper.open .cgf-inline-dropdown-menu {
    display: block !important;
}

.cgf-inline-dropdown-menu a.cgf-destination-option {
    display: block !important;
    padding: 10px 15px !important;
    color: #333 !important;
    text-decoration: none !important;
    font-size: 13px !important;
    transition: background 0.15s ease;
    border-bottom: 1px solid #eee;
}

.cgf-inline-dropdown-menu a.cgf-destination-option:last-child {
    border-bottom: none;
}

.cgf-inline-dropdown-menu a.cgf-destination-option:hover {
    background: #fff8f0 !important;
    color: #e8a23a !important;
}

/* 向上弹出样式 */
.cgf-inline-destination-wrapper.dropup .cgf-inline-dropdown-menu {
    top: auto !important;
    bottom: 45px !important;
}

.cgf-inline-destination-wrapper.dropup .cgf-inline-arrow {
    transform: rotate(180deg);
}

/* 响应式 - 移动端 */
@media (max-width: 768px) {
    .cgf-inline-destination-wrapper {
        display: flex !important;
        float: none;
        margin: 10px 0;
        width: fit-content;
    }
}

/* ========================================
   切换国家 Loading 遮罩
   ======================================== */
.cgf-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cgf-loading-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.cgf-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eee;
    border-top: 4px solid #e8a23a;
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: cgf-spin 0.8s linear infinite;
}

@keyframes cgf-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.cgf-loading-text {
    color: #333;
    font-size: 15px;
    font-weight: 500;
}
