/**
 * KvFaveMsg 文章收藏零件樣式
 * 用於「我的收藏」頁面（會員中心）
 */

/* ========== CSS Variables ========== */
.kvfave-container {
    --kvfave-primary: #2d5a45;
    --kvfave-primary-light: #3d7a5d;
    --kvfave-primary-dark: #1d3a2d;
    --kvfave-accent: #e8b339;
    --kvfave-bg: #faf8f5;
    --kvfave-card: #ffffff;
    --kvfave-text: #2c3e2d;
    --kvfave-muted: #6b7c6b;
    --kvfave-border: #e5e8e5;
    --kvfave-shadow-sm: 0 2px 8px rgba(45, 90, 69, 0.08);
    --kvfave-shadow-md: 0 4px 20px rgba(45, 90, 69, 0.12);
    --kvfave-shadow-lg: 0 8px 32px rgba(45, 90, 69, 0.16);
    --kvfave-radius-sm: 8px;
    --kvfave-radius-md: 12px;
    --kvfave-radius-lg: 16px;
    --kvfave-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Container ========== */
.kvfave-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--kvfave-text);
    line-height: 1.6;
}

/* ========== Header ========== */
.kvfave-header {
    text-align: center;
    margin-bottom: 48px;
}

.kvfave-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--kvfave-primary);
    margin: 0 0 8px 0;
}

.kvfave-header h1::before {
    content: '♥';
    color: var(--kvfave-accent);
    margin-right: 12px;
}

.kvfave-header p {
    color: var(--kvfave-muted);
    font-size: 1.1rem;
    margin: 0;
}

/* ========== Layout ========== */
.kvfave-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
}

@media (max-width: 900px) {
    .kvfave-layout {
        grid-template-columns: 1fr;
    }
}

/* ========== Sidebar ========== */
.kvfave-sidebar {
    position: sticky;
    top: 24px;
    height: fit-content;
}

.kvfave-sidebar-card {
    background: var(--kvfave-card);
    border-radius: var(--kvfave-radius-lg);
    box-shadow: var(--kvfave-shadow-sm);
    overflow: hidden;
}

.kvfave-sidebar-title {
    padding: 20px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--kvfave-primary);
    border-bottom: 1px solid var(--kvfave-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.kvfave-sidebar-title::before {
    content: '≡';
    font-size: 1.2rem;
}

.kvfave-category-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.kvfave-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    cursor: pointer;
    transition: var(--kvfave-transition);
    border-left: 3px solid transparent;
}

.kvfave-category-item:hover {
    background: rgba(45, 90, 69, 0.04);
}

.kvfave-category-item.active {
    background: rgba(45, 90, 69, 0.08);
    border-left-color: var(--kvfave-primary);
}

.kvfave-category-item.active .kvfave-category-name {
    color: var(--kvfave-primary);
    font-weight: 600;
}

.kvfave-category-name {
    font-size: 0.95rem;
    color: var(--kvfave-text);
    transition: var(--kvfave-transition);
}

.kvfave-category-count {
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--kvfave-border);
    color: var(--kvfave-muted);
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--kvfave-transition);
}

.kvfave-category-item.active .kvfave-category-count {
    background: var(--kvfave-primary);
    color: white;
}

/* Mobile Sidebar */
@media (max-width: 900px) {
    .kvfave-sidebar {
        position: static;
    }

    .kvfave-category-list {
        display: flex;
        flex-wrap: wrap;
        padding: 12px;
        gap: 8px;
    }

    .kvfave-category-item {
        padding: 10px 16px;
        border-radius: var(--kvfave-radius-sm);
        border-left: none;
        background: var(--kvfave-border);
    }

    .kvfave-category-item.active {
        background: var(--kvfave-primary);
    }

    .kvfave-category-item.active .kvfave-category-name,
    .kvfave-category-item.active .kvfave-category-count {
        color: white;
    }

    .kvfave-category-item.active .kvfave-category-count {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* ========== Content Area ========== */
.kvfave-content {
    min-height: 400px;
}

.kvfave-content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.kvfave-current-category {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--kvfave-text);
    margin: 0;
}

.kvfave-result-count {
    color: var(--kvfave-muted);
    font-size: 0.95rem;
}

/* ========== Cards Grid ========== */
.kvfave-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

@media (max-width: 600px) {
    .kvfave-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Article Card ========== */
.kvfave-card {
    background: var(--kvfave-card);
    border-radius: var(--kvfave-radius-lg);
    box-shadow: var(--kvfave-shadow-sm);
    overflow: hidden;
    transition: var(--kvfave-transition);
    position: relative;
}

.kvfave-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--kvfave-shadow-lg);
}

.kvfave-card-image {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.kvfave-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.kvfave-card:hover .kvfave-card-image img {
    transform: scale(1.05);
}

.kvfave-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 14px;
    background: var(--kvfave-primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 20px;
    box-shadow: var(--kvfave-shadow-sm);
}

.kvfave-remove-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--kvfave-shadow-md);
    transition: var(--kvfave-transition);
    opacity: 0;
    font-size: 14px;
    color: #ef4444;
}

.kvfave-card:hover .kvfave-remove-btn {
    opacity: 1;
}

.kvfave-remove-btn:hover {
    background: #fee2e2;
    transform: scale(1.1);
}

.kvfave-card-body {
    padding: 20px;
}

.kvfave-card-body h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--kvfave-text);
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kvfave-card-body h3 a {
    color: inherit;
    text-decoration: none;
    transition: var(--kvfave-transition);
}

.kvfave-card-body h3 a:hover {
    color: var(--kvfave-primary);
}

.kvfave-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--kvfave-muted);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.kvfave-card-body p {
    color: var(--kvfave-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kvfave-card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--kvfave-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kvfave-card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--kvfave-primary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--kvfave-transition);
}

.kvfave-card-link:hover {
    gap: 10px;
}

/* ========== Empty State ========== */
.kvfave-empty {
    text-align: center;
    padding: 80px 24px;
    background: var(--kvfave-card);
    border-radius: var(--kvfave-radius-lg);
    box-shadow: var(--kvfave-shadow-sm);
}

.kvfave-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: rgba(45, 90, 69, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--kvfave-primary);
}

.kvfave-empty h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--kvfave-text);
    margin: 0 0 8px 0;
}

.kvfave-empty p {
    color: var(--kvfave-muted);
    margin: 0 0 24px 0;
}

/* ========== Button ========== */
.kvfave-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--kvfave-primary);
    color: white;
    border: none;
    border-radius: var(--kvfave-radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--kvfave-transition);
}

.kvfave-btn:hover {
    background: var(--kvfave-primary-dark);
    transform: translateY(-2px);
    color: white;
}

/* ========== Loading State ========== */
.kvfave-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
}

.kvfave-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--kvfave-border);
    border-top-color: var(--kvfave-primary);
    border-radius: 50%;
    animation: kvfave-spin 1s linear infinite;
}

@keyframes kvfave-spin {
    to {
        transform: rotate(360deg);
    }
}

.kvfave-loading p {
    margin-top: 16px;
    color: var(--kvfave-muted);
}

/* ========== Login Prompt ========== */
.kvfave-login-prompt {
    text-align: center;
    padding: 60px 24px;
    background: linear-gradient(135deg, var(--kvfave-primary) 0%, var(--kvfave-primary-light) 100%);
    border-radius: var(--kvfave-radius-lg);
    color: white;
}

.kvfave-login-prompt h2 {
    font-size: 1.5rem;
    margin: 0 0 12px 0;
}

.kvfave-login-prompt p {
    opacity: 0.9;
    margin: 0 0 24px 0;
}

.kvfave-login-prompt .kvfave-btn {
    background: white;
    color: var(--kvfave-primary);
}

.kvfave-login-prompt .kvfave-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--kvfave-shadow-lg);
}

/* ========== Pagination ========== */
.kvfave-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.kvfave-pagination:empty {
    display: none;
}

.kvfave-page-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--kvfave-card);
    border: 1px solid var(--kvfave-border);
    border-radius: var(--kvfave-radius-sm);
    color: var(--kvfave-text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--kvfave-transition);
}

.kvfave-page-btn:hover:not(.active):not(:disabled) {
    border-color: var(--kvfave-primary);
    color: var(--kvfave-primary);
}

.kvfave-page-btn.active {
    background: var(--kvfave-primary);
    border-color: var(--kvfave-primary);
    color: white;
}

.kvfave-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== Modal ========== */
.kvfave-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: var(--kvfave-transition);
}

.kvfave-modal.show {
    opacity: 1;
    visibility: visible;
}

.kvfave-modal-content {
    background: white;
    padding: 32px;
    border-radius: var(--kvfave-radius-lg);
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: var(--kvfave-transition);
}

.kvfave-modal.show .kvfave-modal-content {
    transform: scale(1);
}

.kvfave-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: #fef2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #ef4444;
}

.kvfave-modal h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.kvfave-modal p {
    color: var(--kvfave-muted);
    margin: 0 0 24px 0;
}

.kvfave-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.kvfave-modal-btn {
    padding: 12px 24px;
    border-radius: var(--kvfave-radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--kvfave-transition);
    border: none;
}

.kvfave-modal-btn-cancel {
    background: var(--kvfave-border);
    color: var(--kvfave-text);
}

.kvfave-modal-btn-cancel:hover {
    background: #d1d5db;
}

.kvfave-modal-btn-confirm {
    background: #ef4444;
    color: white;
}

.kvfave-modal-btn-confirm:hover {
    background: #dc2626;
}

/* ========== Toast ========== */
.kvfave-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--kvfave-text);
    color: white;
    padding: 14px 24px;
    border-radius: var(--kvfave-radius-md);
    box-shadow: var(--kvfave-shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10001;
    opacity: 0;
    transition: var(--kvfave-transition);
}

.kvfave-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.kvfave-toast-icon {
    color: #22c55e;
}

/* ========== Error State ========== */
.kvfave-error {
    text-align: center;
    padding: 80px 24px;
    background: var(--kvfave-card);
    border-radius: var(--kvfave-radius-lg);
    box-shadow: var(--kvfave-shadow-sm);
}

.kvfave-error-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: #fef2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #ef4444;
}