/* 用戶界面樣式 */

/* 已登入用戶操作區域 */
.user-actions-logged {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 收藏按鈕樣式 */
.favorites-btn {
    position: relative;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorites-btn:hover {
    background: #f5f5f5;
    color: #e74c3c;
}

.favorites-btn svg {
    width: 20px;
    height: 20px;
}

/* 收藏數量徽章 */
.favorites-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #e74c3c;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.favorites-count[data-count="0"] {
    display: none;
}

/* 用戶頭像按鈕 */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background: #f8f9fa;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.user-avatar:hover {
    border-color: #007bff;
    transform: scale(1.05);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-avatar span {
    font-weight: bold;
    font-size: 16px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* 用戶下拉選單 */
.user-menu {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
    margin-top: 8px;
}

.user-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 15px;
    width: 12px;
    height: 12px;
    background: white;
    border: 1px solid #ddd;
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
}

.user-info {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.user-name {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    margin-bottom: 2px;
}

.user-email {
    font-size: 12px;
    color: #666;
}

.user-dropdown hr {
    margin: 0;
    border: none;
    border-top: 1px solid #eee;
}

.user-dropdown a {
    display: block;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
}

.user-dropdown a:hover {
    background: #f8f9fa;
    color: #007bff;
}

.user-dropdown a:last-child {
    color: #dc3545;
}

.user-dropdown a:last-child:hover {
    background: #fff5f5;
    color: #dc3545;
}

/* 模態框樣式增強 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    max-width: 800px;
    width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    margin: 0;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    font-size: 20px;
    font-weight: 600;
}

.modal-content .close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.modal-content .close:hover {
    color: #000;
}

/* 用戶個人資料樣式 */
.user-profile {
    padding: 24px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.profile-avatar {
    flex-shrink: 0;
}

.profile-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ddd;
}

.avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f8f9fa;
    border: 3px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    color: #666;
}

.profile-info {
    flex: 1;
}

.info-row {
    display: flex;
    margin-bottom: 12px;
    align-items: center;
}

.info-row label {
    font-weight: 600;
    color: #555;
    min-width: 100px;
    margin-right: 12px;
}

.info-row span {
    color: #333;
}

.membership-level {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.membership-level.member {
    background: #e3f2fd;
    color: #1976d2;
}

.membership-level.vip {
    background: #fff3e0;
    color: #f57c00;
}

/* 收藏和歷史記錄列表 */
.favorites-list,
.history-list {
    padding: 16px;
}

.favorite-item,
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.favorite-item:hover,
.history-item:hover {
    background: #f8f9fa;
    border-color: #ddd;
}

.favorite-info,
.history-info {
    flex: 1;
}

.favorite-info h4,
.history-info h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
}

.favorite-info p,
.history-info p {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: #666;
}

.content-type {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.remove-favorite {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.remove-favorite:hover {
    background: #c82333;
}

/* 空狀態樣式 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

.error {
    text-align: center;
    padding: 40px 20px;
    color: #dc3545;
    font-size: 16px;
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin: 16px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .user-actions-logged {
        gap: 10px;
    }
    
    .user-avatar {
        width: 36px;
        height: 36px;
    }
    
    .user-dropdown {
        min-width: 180px;
        right: -20px;
    }
    
    .user-profile {
        flex-direction: column;
        text-align: center;
    }
    
    .info-row {
        flex-direction: column;
        text-align: left;
        align-items: flex-start;
    }
    
    .info-row label {
        min-width: auto;
        margin-bottom: 4px;
    }
}

/* 收藏列表樣式 */
.favorites-list, .history-list {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.favorite-item, .history-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    margin-bottom: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.favorite-item:hover, .history-item:hover {
    background: #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.favorite-cover, .history-cover {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.favorite-cover img, .history-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.favorite-item:hover .favorite-cover img,
.history-item:hover .history-cover img {
    transform: scale(1.05);
}

.favorite-info, .history-info {
    flex: 1;
    min-width: 0;
}

.favorite-info h4, .history-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-favorite {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.remove-favorite:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.remove-favorite svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* 空狀態樣式 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

.empty-state::before {
    content: "📱";
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
}

/* 載入狀態樣式 */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

.loading::before {
    content: "⏳";
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
}

/* 錯誤狀態樣式 */
.error {
    text-align: center;
    padding: 40px 20px;
    color: #e74c3c;
    font-size: 16px;
    background: #fff5f5;
    border-radius: 8px;
    margin: 20px;
}

.error::before {
    content: "⚠️";
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .favorite-item, .history-item {
        gap: 12px;
        padding: 10px;
    }
    
    .favorite-cover, .history-cover {
        width: 50px;
        height: 50px;
    }
    
    .favorite-info h4, .history-info h4 {
        font-size: 14px;
    }
    
    .remove-favorite {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .remove-favorite svg {
        width: 14px;
        height: 14px;
    }
}