/* ConnectHub 前台樣式 */

#connecthub-widget {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
}

#connecthub-widget.connecthub-left {
    left: 20px;
}

#connecthub-widget.connecthub-right {
    right: 20px;
}

/* 主按鈕 */
.connecthub-widget-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
    order: 999;
}

.connecthub-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Hide main button when expanded */
.connecthub-widget.active .connecthub-widget-button {
    display: none;
}

.connecthub-widget-button:active {
    transform: translateY(0);
}

.connecthub-widget-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.connecthub-widget-button:hover::before {
    left: 100%;
}

.connecthub-cta-text {
    margin-right: 10px;
    white-space: nowrap;
}

.connecthub-widget-icon {
    display: flex;
    transition: transform 0.3s ease;
}



.connecthub-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 管道列表 */
.connecthub-channels-list {
    display: none;
    flex-direction: column;
    gap: 15px;
    animation: connecthub-fadeIn 0.3s ease;
    margin-bottom: 15px;
}

.connecthub-widget.active .connecthub-channels-list {
    display: flex;
}

@keyframes connecthub-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 管道項目 */
.connecthub-channel-item {
    display: flex;
    align-items: center;
    justify-content: center;
}

.connecthub-channel-link,
.connecthub-close-button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}



.connecthub-channel-link:hover,
.connecthub-close-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    color: white;
    text-decoration: none;
}



.connecthub-channel-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}

.connecthub-channel-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.connecthub-custom-channel-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* 響應式設計 */
@media (max-width: 768px) {
    #connecthub-widget {
        bottom: 15px;
    }
    
    #connecthub-widget.connecthub-left {
        left: 15px;
    }
    
    #connecthub-widget.connecthub-right {
        right: 15px;
    }
    
    .connecthub-widget-button {
        width: 45px;
        height: 45px;
    }
    
    .connecthub-cta-text {
        margin-right: 8px;
        font-size: 13px;
    }
    
    .connecthub-channels-list {
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .connecthub-channel-link,
    .connecthub-close-button {
        width: 40px;
        height: 40px;
    }
    
    .connecthub-channel-icon svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    #connecthub-widget {
        bottom: 10px;
    }
    
    #connecthub-widget.connecthub-left {
        left: 10px;
    }
    
    #connecthub-widget.connecthub-right {
        right: 10px;
    }
    
    .connecthub-widget-button {
        width: 40px;
        height: 40px;
    }
    
    .connecthub-channels-list {
        gap: 10px;
        margin-bottom: 10px;
    }
    
    .connecthub-channel-link,
    .connecthub-close-button {
        width: 35px;
        height: 35px;
    }
    
    .connecthub-channel-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .connecthub-cta-text {
        font-size: 12px;
    }
}

/* 暗色主題支援 */
@media (prefers-color-scheme: dark) {
    .connecthub-channel-link {
        backdrop-filter: blur(10px) brightness(1.1);
    }
}

/* 高對比度支援 */
@media (prefers-contrast: high) {
    .connecthub-widget-button,
    .connecthub-channel-link {
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
}

/* 減少動畫偏好 */
@media (prefers-reduced-motion: reduce) {
    .connecthub-widget-button,
    .connecthub-channel-link,
    .connecthub-channels-list,
    .connecthub-channel-item {
        transition: none;
        animation: none;
    }
    
    .connecthub-widget-button:hover,
    .connecthub-channel-link:hover {
        transform: none;
    }
}

/* 載入狀態 */
.connecthub-loading {
    opacity: 0.7;
    pointer-events: none;
}

.connecthub-loading .connecthub-widget-button {
    cursor: wait;
}

/* 錯誤狀態 */
.connecthub-error .connecthub-widget-button {
    background-color: #dc3545 !important;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 無障礙支援 */
.connecthub-widget-button:focus,
.connecthub-channel-link:focus {
    outline: 2px solid #4F6ACA;
    outline-offset: 2px;
}

/* 隱藏文字供螢幕閱讀器使用 */
.connecthub-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
