/* ================================
   模态框相关样式
   ================================ */

/* 模态框遮罩层 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 模态框容器 */
.modal {
    background: var(--bg-color, #ffffff);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    max-height: 90vh;
    width: 500px;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

/* 模态框头部 */
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, #e1e5e9);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary, #f8f9fa);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary, #666);
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--danger-color, #dc3545);
    color: white;
}

/* 模态框内容 */
.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--bg-secondary, #f1f1f1);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--text-secondary, #c1c1c1);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary, #a1a1a1);
}

/* 模态框底部 */
.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color, #e1e5e9);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-secondary, #f8f9fa);
}

.modal-footer .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.modal-footer .btn-primary {
    background: var(--primary-color, #007bff);
    color: white;
}

.modal-footer .btn-primary:hover {
    background: var(--primary-color-dark, #0056b3);
}

.modal-footer .btn-secondary {
    background: var(--bg-color, #6c757d);
    color: white;
}

.modal-footer .btn-secondary:hover {
    background: #5a6268;
}

.modal-footer .btn-outline {
    background: transparent;
    border: 1px solid var(--border-color, #ddd);
    color: var(--text-primary, #333);
}

.modal-footer .btn-outline:hover {
    background: var(--bg-secondary, #f8f9fa);
}

/* 特殊模态框样式 */

/* 确认对话框 */
.modal.confirm-modal {
    width: 400px;
}

.modal.confirm-modal .modal-body {
    text-align: center;
    padding: 30px 24px;
}

.modal.confirm-modal .icon {
    font-size: 48px;
    margin-bottom: 20px;
    color: var(--warning-color, #ffc107);
}

.modal.confirm-modal .message {
    font-size: 16px;
    color: var(--text-primary, #333);
    margin-bottom: 10px;
}

.modal.confirm-modal .description {
    font-size: 14px;
    color: var(--text-secondary, #666);
    margin-bottom: 20px;
}

/* 设置模态框 */
.modal.settings-modal {
    width: 600px;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color, #e1e5e9);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light, #f1f1f1);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-label {
    flex: 1;
    margin-right: 16px;
}

.setting-label .name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #333);
    margin-bottom: 4px;
}

.setting-label .description {
    font-size: 12px;
    color: var(--text-secondary, #666);
}

.setting-control {
    flex-shrink: 0;
}

.setting-control input,
.setting-control select {
    padding: 8px 12px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    background: var(--bg-color, white);
    color: var(--text-primary, #333);
    font-size: 14px;
}

.setting-control input:focus,
.setting-control select:focus {
    outline: none;
    border-color: var(--primary-color, #007bff);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

/* 切换开关 */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
    background: var(--text-secondary, #ccc);
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.toggle-switch.active {
    background: var(--primary-color, #007bff);
}

.toggle-switch::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-switch.active::before {
    transform: translateX(24px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal {
        width: 95vw;
        margin: 0 10px;
    }
    
    .modal.settings-modal {
        width: 95vw;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 4px 0;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .setting-control {
        width: 100%;
    }
    
    .setting-control input,
    .setting-control select {
        width: 100%;
    }
}

/* 暗黑主题支持 */
@media (prefers-color-scheme: dark) {
    .modal-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
    
    .toggle-switch {
        background: #555;
    }
    
    .toggle-switch.active {
        background: var(--primary-color, #0d6efd);
    }
    
    .modal-body::-webkit-scrollbar-track {
        background: #2d2d2d;
    }
    
    .modal-body::-webkit-scrollbar-thumb {
        background: #555;
    }
    
    .modal-body::-webkit-scrollbar-thumb:hover {
        background: #666;
    }
}

/* 动画效果 */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-50px);
    }
}

.modal.slide-in {
    animation: modalSlideIn 0.3s ease;
}

.modal.slide-out {
    animation: modalSlideOut 0.3s ease;
}

/* ================================
   交易对选择器专用样式
   ================================ */

/* 交易对选择器输入框 */
.symbol-selector {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.symbol-input {
    flex: 1;
    padding: 10px 40px 10px 12px;
    border: 2px solid var(--border-color, #e1e5e9);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    background: var(--bg-color, #ffffff);
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.symbol-input:hover,
.symbol-input:focus {
    border-color: var(--primary-color, #007bff);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    outline: none;
}

.symbol-selector-btn {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary, #666);
    transition: all 0.2s ease;
    border-radius: 4px;
}

.symbol-selector-btn:hover {
    background: var(--bg-secondary, #f8f9fa);
    color: var(--primary-color, #007bff);
}

/* 交易对模态框 */
.symbol-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.symbol-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-color, #ffffff);
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    width: 90vw;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    animation: symbolModalShow 0.3s ease;
}

@keyframes symbolModalShow {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 模态框头部 */
.symbol-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, #e1e5e9);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color, #007bff) 0%, #0056b3 100%);
    color: white;
}

.symbol-modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-stats {
    font-size: 0.9rem;
    opacity: 0.9;
}

.close-modal {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* 搜索区域 */
.symbol-search-section {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, #e1e5e9);
    background: var(--bg-secondary, #f8f9fa);
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #475569;
    z-index: 1;
}

.symbol-search-input {
    width: 100%;
    padding: 12px 40px 12px 40px;
    border: 2px solid var(--border-color, #e1e5e9);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    background: var(--bg-color, #ffffff);
    color: #1a1a1a;
    transition: all 0.3s ease;
}

.symbol-search-input:focus {
    outline: none;
    border-color: var(--primary-color, #007bff);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.symbol-search-input::placeholder {
    color: #64748b;
    font-weight: 400;
}

.clear-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-secondary, #999);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 12px;
    transition: all 0.2s ease;
}

.clear-search:hover {
    background: var(--danger-color, #dc3545);
}

/* 分类按钮 */
.symbol-categories {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color, #e1e5e9);
    border-radius: 20px;
    background: var(--bg-color, #ffffff);
    color: #475569;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.category-btn:hover {
    border-color: var(--primary-color, #007bff);
    color: var(--primary-color, #007bff);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.15);
}

.category-btn.active {
    background: var(--primary-color, #007bff);
    border-color: var(--primary-color, #007bff);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.bnb-icon {
    background: #f3ba2f;
    color: white;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

/* 交易对列表区域 */
.symbol-sections {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px 24px;
}

.symbol-sections::-webkit-scrollbar {
    width: 8px;
}

.symbol-sections::-webkit-scrollbar-track {
    background: var(--bg-secondary, #f1f1f1);
    border-radius: 4px;
}

.symbol-sections::-webkit-scrollbar-thumb {
    background: var(--text-secondary, #c1c1c1);
    border-radius: 4px;
}

.symbol-sections::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary, #a1a1a1);
}

.symbol-section {
    margin-bottom: 24px;
}

.symbol-section h4 {
    margin: 0 0 12px 0;
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color, #e1e5e9);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
}

.symbol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.symbol-item {
    position: relative;
    padding: 12px;
    border: 1px solid var(--border-color, #e1e5e9);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-color, #ffffff);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.symbol-item:hover {
    border-color: var(--primary-color, #007bff);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
    transform: translateY(-2px);
    background: rgba(0, 123, 255, 0.02);
}

.symbol-item:hover .symbol-name {
    color: #0c0c0c;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.symbol-item.selected {
    border-color: var(--primary-color, #007bff);
    background: rgba(0, 123, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.symbol-item.selected .symbol-name {
    color: #0a0a0a;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.symbol-name {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 15px;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.symbol-price {
    text-align: right;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
}

.price-up {
    color: #16a34a;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
}

.price-down {
    color: #dc2626;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
}

.favorite-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--warning-color, #ffc107);
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    z-index: 1;
}

.favorite-btn:hover {
    background: rgba(255, 193, 7, 0.1);
    transform: scale(1.2);
}

/* 加载状态 */
.loading-symbols {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.loading-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color, #007bff);
    animation: loadingBounce 1.4s ease-in-out infinite both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes loadingBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.loading-animation p {
    color: var(--text-secondary, #666);
    font-size: 14px;
    margin: 0;
}

/* 模态框底部 */
.symbol-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color, #e1e5e9);
    background: var(--bg-secondary, #f8f9fa);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.btn-refresh {
    padding: 8px 16px;
    background: var(--primary-color, #007bff);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-refresh:hover {
    background: var(--primary-color-dark, #0056b3);
    transform: translateY(-1px);
}

.last-update {
    font-size: 12px;
    color: var(--text-secondary, #666);
    margin-left: auto;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary, #666);
    font-size: 16px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .symbol-modal-content {
        width: 95vw;
        max-height: 95vh;
    }
    
    .symbol-grid {
        grid-template-columns: 1fr;
    }
    
    .symbol-categories {
        justify-content: center;
    }
    
    .category-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .last-update {
        margin-left: 0;
        text-align: center;
    }
}