/* Shared Styles for My Videos & My Notes */
:root {
    --primary-color: #8b5cf6;
    --primary-hover: #7c3aed;
    --bg-color: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-border: rgba(255, 255, 255, 0.9);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    min-height: 100vh;
    color: var(--text-primary);
}

/* Background Decoration */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    filter: blur(80px);
    opacity: 0.6;
}

.orb {
    position: absolute;
    border-radius: 50%;
    animation: float 20s infinite ease-in-out;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: rgba(139, 92, 246, 0.15);
    top: -10%;
    left: -10%;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: rgba(236, 72, 153, 0.15);
    bottom: -10%;
    right: -5%;
    animation-delay: -5s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, -30px);
    }
}

/* Layout */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(139, 92, 246, 0.1);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 20px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.back-btn:hover {
    color: var(--primary-color);
    transform: translateX(-5px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

/* Grid Layout */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* Card Styles */
.item-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    cursor: pointer;
}

.item-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background-color: #e2e8f0;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-duration {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-text {
    font-size: 1.25rem;
    font-weight: 500;
}

/* Note specific */
.note-card .card-body {
    padding-top: 1rem;
}

.note-quote {
    font-style: italic;
    color: #4b5563;
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 3px solid var(--primary-color);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        padding: 1rem;
    }
}

/* 删除按钮 */
.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.note-card:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* 视频来源 */
.video-source {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--primary-color);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.video-source:hover {
    text-decoration: underline;
}

/* 内容展开处理 */
/* 内容展开处理 */
.note-content-wrapper {
    position: relative;
    max-height: 100px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.note-card:hover .note-content-wrapper {
    max-height: 500px;
    /* 修复：改为自动滚动，防止溢出遮挡其他内容 */
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    /* Space for scrollbar */
}

/* Custom Scrollbar for notes */
.note-content-wrapper::-webkit-scrollbar {
    width: 4px;
}

.note-content-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.note-content-wrapper::-webkit-scrollbar-thumb {
    background-color: rgba(139, 92, 246, 0.2);
    border-radius: 4px;
}

.note-content-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: rgba(139, 92, 246, 0.4);
}

/* 遮罩，未悬停时显示 */
.note-content-mask {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.9));
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.note-card:hover .note-content-mask {
    opacity: 0;
}

/* Ensure text is not clamped when expanded */
.note-card:hover .card-title,
.note-card:hover .note-quote,
.note-card:hover .note-md-content {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    display: block;
}

/* Markdown Styles for Notes */
.note-md-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.note-md-content h1,
.note-md-content h2,
.note-md-content h3 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0.8em 0 0.4em;
    color: #1e293b;
    line-height: 1.4;
}

.note-md-content hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1em 0;
}

.note-md-content ul,
.note-md-content ol {
    padding-left: 1.25em;
    margin: 0.5em 0;
}

.note-md-content li {
    margin-bottom: 0.25em;
}

.note-md-content p {
    margin: 0.5em 0;
    /* Avoid huge gaps */
}

.note-md-content code {
    background: #f1f5f9;
    padding: 0.1em 0.3em;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--primary-color);
}

.note-md-content pre {
    background: #f8fafc;
    padding: 0.8em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5em 0;
    border: 1px solid #e2e8f0;
}

.note-md-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: 0.85em;
}

.note-md-content blockquote {
    border-left: 3px solid var(--primary-color);
    margin: 0.8em 0;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(139, 92, 246, 0.03);
    padding: 0.5em 1em;
    border-radius: 4px;
}

.note-md-content strong {
    color: #0f172a;
    font-weight: 600;
}


/* Batch Management Styles */
.batch-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.batch-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.1);
}

.batch-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Checkboxes on cards */
.item-card {
    position: relative;
    /* Ensure positioning context for checkbox */
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.batch-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 24px;
    height: 24px;
    z-index: 20;
    /* Higher than delete btn */
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    /* Ignore clicks when hidden */

    /* Custom Checkbox Look */
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--text-secondary);
    border-radius: 6px;
    display: grid;
    place-content: center;
    cursor: pointer;
}

.batch-mode .batch-checkbox {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Checkmark icon using CSS pseudo-element */
.batch-checkbox::before {
    content: "";
    width: 65%;
    height: 65%;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    background-color: white;
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.batch-checkbox:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.batch-checkbox:checked::before {
    transform: scale(1);
}

/* Export Dropdown */
.export-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.export-menu {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.9);
    background: white;
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    min-width: 120px;
    gap: 2px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Remove margin, use bottom positioning + bridge */
}

/* Invisible bridge to prevent closing when crossing gap */
.export-menu::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 10px;
    /* Covers the 8px gap */
}

.export-wrapper:hover .export-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0) scale(1);
}

.export-item {
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-item:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

/* Up arrow for menu */
.export-menu::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: white transparent transparent transparent;
}


/* Selected Card Styling */
.item-card.selected {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(139, 92, 246, 0.15);
}

/* Batch Action Bar */
.batch-action-bar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    /* Hidden by default */
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.1);
    backdrop-filter: blur(16px);
    padding: 12px 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 400px;
    justify-content: space-between;
}

.batch-mode .batch-action-bar {
    transform: translateX(-50%) translateY(0);
}

.batch-info {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.batch-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn.delete {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

.action-btn.export {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary-color);
}

.action-btn.export:hover {
    background: rgba(139, 92, 246, 0.2);
    transform: translateY(-1px);
}

.select-all-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.select-all-btn:hover {
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.02);
}

/* Custom Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    /* High z-index */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 320px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-icon {
    width: 48px;
    height: 48px;
    background: #FFEBEE;
    color: #FF5252;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn.cancel {
    background: #F5F5F5;
    color: var(--text-secondary);
}

.modal-btn.cancel:hover {
    background: #E0E0E0;
}

.modal-btn.confirm {
    background: #FFEBEE;
    color: #FF5252;
}

.modal-btn.confirm:hover {
    background: #FFCDD2;
}