/* 用戶系統樣式 */

/* 用戶狀態區 */
.user-area {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    padding-right: 20px;
}

/* 當 user-info 顯示時，隱藏 header 中的 user-area（避免重複顯示） */
.user-area:has(#user-info[style*="display: flex"]) {
    display: none;
}

/* 使用者名稱獨立顯示在右上角 */
.user-info {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999; /* 在 playback-controls 下方，但高於其他元素 */
    display: flex;
    flex-direction: column; /* 垂直排列：使用者名稱在上，其他資訊在下 */
    align-items: flex-end; /* 靠右對齊 */
    gap: 6px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 14px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: auto; /* 確保可以點擊 */
}

/* 調整 playback-controls 位置，避免與使用者名稱重疊 */
.playback-controls {
    top: 90px !important; /* 在使用者名稱下方 */
}

.user-login-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.user-login-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.about-nav-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    text-decoration: none;
    display: inline-block;
}

.about-nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* 使用者資訊移到右上角 */
.user-info {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999; /* 在 playback-controls 下方，但高於其他元素 */
    display: flex;
    flex-direction: column; /* 垂直排列：使用者名稱在上，其他資訊在下 */
    align-items: flex-end; /* 靠右對齊 */
    gap: 6px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 14px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: auto; /* 確保可以點擊 */
    min-width: 150px; /* 確保有足夠寬度 */
}

.user-info .username {
    font-weight: 600;
    color: rgba(255, 255, 255, 1);
    font-size: 0.95rem;
    white-space: nowrap; /* 防止換行 */
}

.user-info .storage-info {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap; /* 防止換行 */
}

/* 調整按鈕排列 */
.user-info .user-profile-btn,
.user-info .user-logout-btn {
    margin-top: 4px;
    width: 100%; /* 按鈕寬度填滿容器 */
    text-align: center;
}

.user-profile-btn {
    padding: 6px 12px;
    background: rgba(74, 144, 226, 0.3);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(74, 144, 226, 0.5);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.user-profile-btn:hover {
    background: rgba(74, 144, 226, 0.5);
    border-color: rgba(74, 144, 226, 0.7);
}

.user-logout-btn {
    padding: 6px 12px;
    background: rgba(255, 71, 87, 0.3);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 71, 87, 0.5);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.user-logout-btn:hover {
    background: rgba(255, 71, 87, 0.5);
    border-color: rgba(255, 71, 87, 0.7);
}

/* Modal 樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal:not(.hidden) {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 250, 250, 0.95) 100%);
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #333;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2d3748;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2d3748;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.primary-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.primary-btn:hover {
    background: linear-gradient(135deg, #357abd 0%, #2a5f8f 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.primary-btn:active {
    transform: translateY(0);
}

.modal-switch {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 0.9rem;
}

.modal-switch a {
    color: #4a90e2;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.modal-switch a:hover {
    text-decoration: underline;
}

.modal-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-size: 0.9rem;
    display: none;
}

.modal-message.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.modal-message.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.modal-message.info {
    display: block;
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 第三方登入樣式 */
.social-login {
    margin-bottom: 25px;
}

.social-login-title {
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 15px;
    font-weight: 500;
}

.social-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    color: #333;
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.social-btn:active {
    transform: translateY(0);
}

.social-icon {
    font-size: 1.2rem;
}

/* Google 按鈕 */
.google-btn {
    border-color: #4285f4;
    color: #4285f4;
}

.google-btn:hover {
    background: #f8f9fa;
    border-color: #357abd;
    color: #357abd;
}

/* Facebook 按鈕 */
.facebook-btn {
    border-color: #1877f2;
    color: #1877f2;
}

.facebook-btn:hover {
    background: #f0f2f5;
    border-color: #166fe5;
    color: #166fe5;
}

/* LINE 按鈕 */
.line-btn {
    border-color: #06c755;
    color: #06c755;
}

.line-btn:hover {
    background: #f0fdf4;
    border-color: #05b349;
    color: #05b349;
}

/* 分隔線 */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: #999;
    font-size: 0.85rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.divider span {
    padding: 0 15px;
}

/* 響應式設計 */
@media (max-width: 600px) {
    .user-area {
        padding-right: 10px;
    }
    
    .user-info {
        flex-direction: column;
        gap: 6px;
        font-size: 0.75rem;
    }
    
    .user-login-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .modal-content {
        padding: 20px;
        width: 95%;
    }
}

