/**
 * 現代化收藏框樣式 - 獨立版本
 * 完全獨立的樣式，不依賴其他CSS文件
 */

/* 收藏框容器 */
.modern-favbox-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    width: 100%;
    height: 450px; /* 减小高度 */
    max-height: 80vh; /* 响应式高度，确保在小屏幕上不会超出视口 */
    display: flex; /* 使用flex布局 */
    flex-direction: column; /* 垂直排列 */
}

/* 收藏框頭部 */
.modern-favbox-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 20px; /* 减小上下内边距，优化空间利用 */
    color: white;
    text-align: center;
    position: relative;
    border-radius: 20px 20px 0 0;
    height: 60px; /* 固定头部高度 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.modern-favbox-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
    border-radius: 20px 20px 0 0;
}

.modern-favbox-title {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.modern-favbox-title i {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.9);
    animation: modern-favbox-pulse 2s infinite;
}

@keyframes modern-favbox-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.modern-favbox-music-name {
    font-size: 20px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    color: white;
}

/* 收藏框內容 */
.modern-favbox-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px;
    flex: 1; /* 自动填充剩余空间 */
    overflow: hidden; /* 移除外层滚动条 */
    display: flex;
    flex-direction: column;
    position: relative; /* 相对定位 */
    border-radius: 0 0 20px 20px; /* 设置底部圆角，修复尖角问题 */
}

.modern-favbox-section {
    margin-bottom: 10px; /* 进一步减小部分间距 */
    flex-shrink: 0; /* 防止部分被压缩 */
}

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

/* 让包含列表的部分可以伸展 - 保持在顶部 */
.modern-favbox-section.list-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* 允许内容溢出时滚动 */
    max-height: 200px; /* 限制最大高度 */
    order: 1; /* 列表区域在顶部 */
}

/* 包含操作按钮的section - 在列表之后 */
.modern-favbox-section:has(.modern-favbox-actions) {
    order: 2; /* 操作按钮在中间 */
}

/* 包含新增表单的section - 移动到最后 */
.modern-favbox-section:has(.modern-favbox-add-form) {
    order: 3; /* 新增表单在最后 */
    margin-top: 0 !important; /* 移除自动推到底部的设置 */
    margin-bottom: 0 !important; /* 底部无边距 */
}

/* 兼容不支持 :has() 的浏览器 - 使用类名 */
.modern-favbox-actions-section {
    order: 2 !important; /* 操作按钮在中间 */
}

.modern-favbox-add-form-section {
    order: 3 !important; /* 新增表单在最后 */
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* 新增表单区域 */
.modern-favbox-add-form {
    margin-top: 0 !important; /* 移除自动推到底部 */
    margin-bottom: 0 !important;
}

/* 標籤 */
.modern-favbox-label {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 8px 12px; /* 进一步减小内边距 */
    border-radius: 10px;
    margin-bottom: 10px; /* 进一步减小底部间距 */
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.modern-favbox-label::before {
    content: '🎵';
    font-size: 18px;
}

.modern-favbox-selected {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    backdrop-filter: blur(5px);
    color: white;
}

/* 歌單列表 */
.modern-favbox-list {
    max-height: 180px; /* 进一步减少列表高度 */
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 10px;
    border: 1px solid #e9ecef;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    flex: 1; /* 让列表区域自动填充剩余空间 */
    margin-bottom: 5px; /* 减少底部间距 */
    min-height: 100px; /* 减小最小高度 */
    flex-shrink: 1; /* 允许在需要时被压缩 */
}

.modern-favbox-list::-webkit-scrollbar {
    width: 8px;
}

.modern-favbox-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modern-favbox-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

.modern-favbox-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* 歌單項目 */
.modern-fav-box-item {
    margin-bottom: 8px; /* 减小项目间距 */
    transition: all 0.3s ease;
}

.modern-fav-box-item:last-child {
    margin-bottom: 0;
}

.modern-fav-box-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px; /* 减小内边距 */
    background: white;
    border-radius: 10px; /* 调整圆角 */
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent; /* 减小边框宽度 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 14px; /* 调整字体大小 */
}

.modern-fav-box-item a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #6e64c6 100%);
}

.modern-fav-box-item a i {
    color: #667eea;
    font-size: 18px;
    transition: all 0.3s ease;
}

.modern-fav-box-item a:hover i {
    transform: scale(1.2);
    color: #764ba2;
}

.modern-fav-box-name {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.modern-fav-box-count {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* 選中狀態 */
.modern-fav-box-selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.modern-fav-box-selected a {
    color: white;
    background: transparent;
}

.modern-fav-box-selected a i {
    color: white;
}

.modern-fav-box-selected .modern-fav-box-count {
    background: rgb(105 114 217);
    color: white;
}

/* 添加表單 - 移动到底部 */
.modern-favbox-add-form {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 10px 0 0 0; /* 顶部边距，底部无边距 */
    padding: 0; /* 移除所有内边距 */
    position: relative; /* 确保定位正确 */
    z-index: 5; /* 确保在其他元素之上 */
    flex-shrink: 0; /* 防止被压缩 */
    order: 999; /* 使用 order 属性将表单移动到底部 */
}

.modern-favbox-input {
    flex: 1;
    padding: 10px 15px; /* 减小内边距 */
    border: 1px solid #e9ecef; /* 减小边框宽度 */
    border-radius: 10px;
    font-size: 14px;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: 40px; /* 固定高度 */
}

.modern-favbox-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.modern-favbox-add-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0 15px; /* 水平内边距 */
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    height: 40px; /* 固定高度，与输入框一致 */
    min-width: 100px; /* 最小宽度 */
}

.modern-favbox-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* 操作按鈕 - 内嵌式 */
.modern-favbox-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 0; /* 移除所有边距 */
    padding: 0; /* 移除内边距 */
    z-index: 10;
    flex-shrink: 0; /* 防止被压缩 */
    border-top: none; /* 移除顶部边框 */
}

.modern-favbox-btn {
    padding: 0 15px; /* 减少水平内边距 */
    border-radius: 8px; /* 减小圆角 */
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px; /* 减小间距 */
    min-width: 80px; /* 减小最小宽度 */
    justify-content: center;
    height: 36px; /* 减小高度 */
    font-size: 13px; /* 减小字体 */
}

.modern-favbox-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.modern-favbox-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.modern-favbox-btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.modern-favbox-btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4);
    background: linear-gradient(135deg, #5a6268 0%, #343a40 100%);
}

/* 消息區域 */
.modern-favbox-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    font-weight: 500;
}

.modern-favbox-error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.modern-favbox-success {
    background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(81, 207, 102, 0.3);
}

/* 收藏成功弹窗 - 现代化美观样式 */
.favorite-success-toast {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(8px);
    z-index: 10001 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

.favorite-success-toast.show {
    opacity: 1 !important;
    pointer-events: auto !important;
}

.favorite-success-toast-content-wrapper {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(0.9) !important;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a1a3e 50%, #1a1a1a 100%);
    border: 1px solid rgba(170, 60, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(170, 60, 255, 0.2);
    padding: 30px 40px;
    min-width: 320px;
    max-width: 500px;
    width: auto !important;
    margin: 0 !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
}

.favorite-success-toast.show .favorite-success-toast-content-wrapper {
    transform: translate(-50%, -50%) scale(1) !important;
}

/* 加载弹窗样式 */
.modern-favbox-loading-layer .layui-layer-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a1a3e 50%, #1a1a1a 100%) !important;
    border-radius: 10px !important;
    padding: 0 !important;
}

.modern-favbox-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
}

.modern-favbox-loading-spinner {
    font-size: 48px;
    color: #aa3cff;
    margin-bottom: 20px;
    animation: spin 1s linear infinite;
}

.modern-favbox-loading-spinner i {
    display: block;
}

.modern-favbox-loading-text {
    color: #e0e0e0;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.favorite-success-toast-content-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(170, 60, 255, 0.1) 50%, transparent 70%);
    border-radius: 20px;
    pointer-events: none;
}

.favorite-success-toast-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.favorite-success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(81, 207, 102, 0.4);
    animation: favoriteSuccessPulse 0.6s ease-out;
}

.favorite-success-icon i {
    font-size: 32px;
    color: white;
}

@keyframes favoriteSuccessPulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.favorite-success-title {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #aa3cff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.favorite-success-message {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin-bottom: 20px;
}

.favorite-success-message a {
    color: #51cf66;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    margin-top: 8px;
    padding: 6px 16px;
    background: rgba(81, 207, 102, 0.1);
    border: 1px solid rgba(81, 207, 102, 0.3);
    border-radius: 20px;
}

.favorite-success-message a:hover {
    color: #40c057;
    background: rgba(81, 207, 102, 0.2);
    border-color: rgba(81, 207, 102, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(81, 207, 102, 0.3);
}

.favorite-success-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.favorite-success-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: rotate(90deg);
}

.modern-favbox-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.modern-favbox-loading i {
    font-size: 18px;
    animation: modern-favbox-spin 1s linear infinite;
}

@keyframes modern-favbox-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .modern-favbox-container {
        margin: 10px;
        border-radius: 15px;
        height: 450px; /* 减小移动设备上的高度 */
    }
    
    .modern-favbox-content {
        padding: 15px;
    }
    
    .modern-favbox-header {
        padding: 10px 15px;
        height: 50px; /* 减小移动设备上的头部高度 */
    }
    
    .modern-favbox-list {
        max-height: 200px; /* 减小移动设备上的列表高度 */
    }
    
    .modern-favbox-add-form {
        flex-direction: column;
        gap: 10px;
    }
    
    .modern-favbox-input, 
    .modern-favbox-add-btn {
        width: 100%;
        height: 36px; /* 减小移动设备上的输入框和按钮高度 */
    }
    
    .modern-favbox-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .modern-favbox-btn {
        width: 100%;
        height: 36px; /* 减小移动设备上的按钮高度 */
    }
}

/* Layer.js 樣式覆蓋 */
.modern-favbox-layer {
    background: transparent !important; /* 移除弹窗本身的白色背景 */
    border-radius: 20px !important; /* 恢复完整圆角 */
    overflow: hidden !important;
    border: none !important; /* 移除所有边框 */
    padding: 0 !important; /* 移除弹窗内边距 */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15) !important; /* 使用自定义阴影 */
}

.modern-favbox-layer .layui-layer-content {
    background: transparent !important; /* 确保内容区域透明 */
    border-radius: 20px !important;
    overflow: hidden !important;
    padding: 0 !important; /* 移除所有内边距 */
    margin: 0 !important; /* 移除所有外边距 */
    border: none !important; /* 移除内容区域边框 */
}

/* 隐藏Layer.js标题栏 */
.modern-favbox-layer .layui-layer-title {
    display: none !important; /* 完全隐藏标题栏 */
    background: transparent !important;
}

/* 隐藏Layer.js底部调整大小区域 */
.modern-favbox-layer .layui-layer-resize {
    display: none !important;
}

/* 隐藏并移除 layui-layer-btn 区域（如果有） */
.modern-favbox-layer .layui-layer-btn {
    display: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
}

/* 移除 layui-layer 相关的所有边框 */
.modern-favbox-layer,
.modern-favbox-layer .layui-layer-content,
.modern-favbox-layer .layui-layer-title,
.modern-favbox-layer .layui-layer-setwin,
.modern-favbox-layer .layui-layer-border {
    border: none !important;
    outline: none !important;
}

/* 移除底部多余边距 */
.modern-favbox-container {
    margin: 0 !important; /* 确保容器没有外边距 */
}

.modern-favbox-content {
    padding-bottom: 15px !important; /* 只保留底部少量内边距，确保内容不贴底 */
}

/* 确保最后一个元素没有多余的底部边距 */
.modern-favbox-content > *:last-child {
    margin-bottom: 0 !important;
}

.modern-favbox-actions {
    margin-bottom: 0 !important; /* 确保操作按钮区域没有底部边距 */
    padding-bottom: 0 !important;
} 