/**
 * 弹幕批注系统组件样式
 */

/* ====== 弹幕容器 ====== */
#danmaku-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99990;
    overflow: hidden;
}

/* ====== 批注工具栏 ====== */
#danmaku-toolbar {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 99995;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateX(60px);
    transition: all 0.3s ease;
}

#danmaku-toolbar.show {
    opacity: 1;
    transform: translateX(0);
}

.danmaku-tool-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.danmaku-tool-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.danmaku-tool-btn.active {
    background: linear-gradient(135deg, #FF6B35, #FF8F5A);
    color: white;
}

.danmaku-tool-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ====== 单条弹幕 ====== */
.danmaku-item {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    max-width: 260px;
    animation: danmaku-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 点选弹幕 - 小气泡 */
.danmaku-point {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.95),
            rgba(255, 255, 255, 0.85));
    backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 10px 14px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.danmaku-point::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 框选弹幕 - 半透明区域 */
.danmaku-area {
    background: rgba(255, 107, 53, 0.08);
    border: 2px dashed rgba(255, 107, 53, 0.3);
    border-radius: 8px;
    padding: 12px;
}

/* 弹幕内容 */
.danmaku-content {
    font-size: 13px;
    line-height: 1.5;
    color: #374151;
    word-wrap: break-word;
}

/* 弹幕头部 */
.danmaku-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.danmaku-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ddd, #bbb);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.danmaku-username {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
}

.danmaku-level {
    font-size: 9px;
    padding: 1px 4px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    border-radius: 6px;
    font-weight: 600;
}

/* 弹幕底部操作 */
.danmaku-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: #9ca3af;
}

.danmaku-like-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    color: #9ca3af;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 10px;
    transition: all 0.2s;
}

.danmaku-like-btn:hover {
    background: rgba(255, 107, 53, 0.1);
    color: #FF6B35;
}

.danmaku-like-btn.liked {
    color: #FF6B35;
}

/* ====== 批注输入弹窗 ====== */
#danmaku-input-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#danmaku-input-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.danmaku-modal-content {
    background: white;
    border-radius: 20px;
    padding: 24px;
    width: 320px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#danmaku-input-modal.show .danmaku-modal-content {
    transform: scale(1) translateY(0);
}

.danmaku-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.danmaku-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #374151;
}

.danmaku-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #9ca3af;
    cursor: pointer;
}

.danmaku-textarea {
    width: 100%;
    height: 100px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.danmaku-textarea:focus {
    border-color: #FF6B35;
}

.danmaku-color-picker {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

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

.danmaku-color-btn:hover,
.danmaku-color-btn.selected {
    transform: scale(1.2);
    border-color: #374151;
}

.danmaku-submit-btn {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: linear-gradient(135deg, #FF6B35, #FF8F5A);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.danmaku-submit-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.danmaku-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ====== 选区指示器 ====== */
#danmaku-selection-area {
    position: fixed;
    border: 2px dashed #FF6B35;
    background: rgba(255, 107, 53, 0.1);
    pointer-events: none;
    z-index: 99998;
    display: none;
}

/* ====== 点击标记 ====== */
#danmaku-click-marker {
    position: fixed;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #FF6B35;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    z-index: 99998;
    animation: marker-pulse 0.5s ease forwards;
}

/* ====== 动画 ====== */
@keyframes danmaku-appear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes marker-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.5;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* 移动端 */
@media (max-width: 480px) {
    #danmaku-toolbar {
        bottom: 80px;
        right: 16px;
    }

    .danmaku-tool-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .danmaku-item {
        max-width: 200px;
    }

    .danmaku-modal-content {
        width: 280px;
    }
}