/**
 * 弹幕样式
 * @author MCCMS Team
 * @date 2026-04-06
 */

/* 弹幕输入栏 */
.danmaku-input-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    max-width: 90%;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    padding: 15px 20px;
    z-index: 10000;
    display: none;
    align-items: center;
    gap: 10px;
}

.danmaku-input-bar.show {
    display: flex;
}

.danmaku-input-wrapper {
    flex: 1;
    display: flex;
    gap: 10px;
}

.danmaku-tools {
    display: flex;
    align-items: center;
}

.danmaku-tool-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.danmaku-tool-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 弹幕工具面板 */
.danmaku-tool-panel {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    max-width: 90%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 10001;
    padding: 20px;
    display: none;
}

.danmaku-tool-panel.show {
    display: block;
}

.tool-section {
    margin-bottom: 15px;
}

.tool-section:last-child {
    margin-bottom: 0;
}

.tool-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.mode-group, .weight-group {
    display: flex;
    gap: 8px;
}

.mode-group .btn, .weight-group .btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.mode-group .btn:hover, .weight-group .btn:hover {
    border-color: #007bff;
}

.mode-group .btn.active, .weight-group .btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.color-group {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

.color-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}



/* 弹幕设置面板 */
.danmaku-setting-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 280px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 10001;
    padding: 20px;
    display: none;
}

.danmaku-setting-panel.show {
    display: block;
}

.danmaku-input-wrapper {
    flex: 1;
    display: flex;
    gap: 10px;
}

.danmaku-input {
    flex: 1;
    height: 40px;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0 15px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
    outline: none;
}

.danmaku-input::placeholder {
    color: #999;
}

.danmaku-input:focus {
    border-color: #007bff;
    background: rgba(255, 255, 255, 0.15);
}

.danmaku-send-btn {
    width: 80px;
    height: 40px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.danmaku-send-btn:hover {
    background: #0056b3;
}

.danmaku-send-btn:active {
    transform: scale(0.98);
}



.danmaku-setting-panel .setting-item {
    margin-bottom: 15px;
}

.danmaku-setting-panel .setting-item:last-child {
    margin-bottom: 0;
}

.danmaku-setting-panel .setting-item label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
}

.danmaku-setting-panel .setting-item input[type="range"] {
    width: 100%;
}

.danmaku-setting-panel .btn-group {
    display: flex;
    gap: 8px;
}

.danmaku-setting-panel .btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    font-size: 13px;
    transition: all 0.2s;
}

.danmaku-setting-panel .btn:hover {
    border-color: #007bff;
}

.danmaku-setting-panel .btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.danmaku-setting-panel .btn-toggle {
    width: 100%;
    padding: 10px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.danmaku-setting-panel .btn-toggle.active {
    background: #28a745;
}

.danmaku-setting-panel .btn-toggle:not(.active) {
    background: #dc3545;
}

/* 弹幕容器 */
.danmaku-container {
    position: relative !important;
    overflow: visible !important;
}

.danmaku-container canvas {
    /* Canvas 现在使用 fixed 定位，由 JS 控制 */
    position: fixed !important;
    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
    pointer-events: none !important;
    z-index: 999999 !important;
    display: block;
}

/* 弹幕操作菜单 */
.danmaku-menu {
    position: fixed;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 6px;
    padding: 6px 8px;
    z-index: 10000001;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: danmaku-menu-fade-in 0.2s ease;
    pointer-events: auto;
    min-width: 50px;
}

@keyframes danmaku-menu-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.danmaku-menu .menu-item {
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    user-select: none;
    padding: 6px 12px;
    white-space: nowrap;
}

.danmaku-menu .menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 弹幕设置面板 */
.danmaku-setting {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 300px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 100;
    padding: 20px;
    display: none;
}

.danmaku-setting.show {
    display: block;
}

.danmaku-setting .item {
    margin-bottom: 15px;
}

.danmaku-setting .item label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #666;
}

.danmaku-setting .item input[type="range"] {
    width: 100%;
}

.danmaku-setting .item .btn-group {
    display: flex;
    gap: 10px;
}

.danmaku-setting .item .btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    font-size: 12px;
}

.danmaku-setting .item .btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* 发送弹幕弹窗 */
.danmaku-send-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px 12px 0 0;
    padding: 20px;
    z-index: 200;
    display: none;
}

.danmaku-send-modal.show {
    display: block;
}

.danmaku-send-modal textarea {
    width: 100%;
    height: 80px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    font-size: 16px;
    resize: none;
    box-sizing: border-box;
}

.danmaku-send-modal textarea:focus {
    outline: none;
    border-color: #007bff;
}

.danmaku-send-modal .char-count {
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.danmaku-send-modal .color-picker {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.danmaku-send-modal .color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
}

.danmaku-send-modal .color-option.active {
    border-color: #333;
}

.danmaku-send-modal .mode-picker {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.danmaku-send-modal .mode-option {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    font-size: 14px;
}

.danmaku-send-modal .mode-option.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.danmaku-send-modal .actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.danmaku-send-modal .btn {
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.danmaku-send-modal .btn-cancel {
    background: #f5f5f5;
    border: none;
}

.danmaku-send-modal .btn-send {
    background: #007bff;
    color: #fff;
    border: none;
}

.danmaku-send-modal .btn-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 弹幕按钮 */
.danmaku-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    transition: all 0.3s;
}

.danmaku-btn:hover {
    background: rgba(0, 123, 255, 0.8);
    transform: scale(1.1);
}

.danmaku-btn.active {
    background: rgba(0, 123, 255, 0.8);
}

/* 弹幕列表 */
.danmaku-list {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 10px;
    z-index: 20;
    display: none;
}

.danmaku-list.show {
    display: block;
}

.danmaku-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.danmaku-item:last-child {
    border-bottom: none;
}

.danmaku-item .content {
    color: #333;
    margin-bottom: 5px;
}

.danmaku-item .meta {
    font-size: 12px;
    color: #999;
    display: flex;
    justify-content: space-between;
}

.danmaku-item .actions {
    margin-top: 5px;
}

.danmaku-item .actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: #007bff;
    padding: 2px 5px;
}

.danmaku-item .actions button:hover {
    text-decoration: underline;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .danmaku-setting {
        width: 280px;
        right: 10px;
        top: 50px;
    }
    
    .danmaku-send-modal {
        padding: 15px;
    }
    
    .danmaku-btn {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
    }
}
