@import url('../../../assets/css/design-system.css');

/**
 * 頭像選擇器組件樣式
 */

/* ==========================================
   Modal 樣式
   ========================================== */

.avatar-selector-modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.avatar-selector-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.avatar-selector-dialog {
    position: relative;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal 標題欄 */
.avatar-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.avatar-selector-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.avatar-selector-close-btn {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
}

.avatar-selector-close-btn:hover {
    color: #1f2937;
    background: #f3f4f6;
    border-radius: 0.25rem;
}

/* Modal 內容區域 */
.avatar-selector-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Modal 按鈕欄 */
.avatar-selector-footer {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.avatar-selector-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.avatar-selector-btn-cancel {
    background: #e5e7eb;
    color: #1f2937;
}

.avatar-selector-btn-cancel:hover {
    background: #d1d5db;
}

.avatar-selector-btn-confirm {
    background: #4e83c9;
    color: white;
}

.avatar-selector-btn-confirm:hover {
    background: #3a62a8;
}

.avatar-selector-container {
    width: 100%;
}

/* 頭像標籤頁 */
.avatar-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #E5E7EB;
}

.avatar-tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    color: #6B7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avatar-tab-btn:hover {
    color: var(--color-primary);
}

.avatar-tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* 標籤頁內容 */
.avatar-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

/* 預設頭像標籤內容默認顯示 */
#presetAvatarTab {
    display: block;
}

.avatar-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 預設頭像網格 */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.avatar-item {
    position: relative;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #D1D5DB;
    transition: all 0.3s ease;
    background: white;
    aspect-ratio: 1;
}

.avatar-item:hover {
    border-color: var(--color-primary);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.2);
}

.avatar-item.selected {
    border: 4px solid var(--color-primary);
    transform: scale(1.05);
}

.avatar-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.avatar-item:hover img {
    transform: scale(1.1);
}

/* 上傳區域 */
.avatar-upload-area {
    margin-bottom: 1.5rem;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 2rem;
    border: 3px dashed #D1D5DB;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #F9FAFB;
}

.upload-placeholder:hover {
    border-color: var(--color-primary);
    background: #F0F4FF;
}

.upload-placeholder i {
    font-size: 2.5rem;
    color: var(--color-primary);
}

.upload-placeholder p {
    margin: 0;
    font-weight: 500;
    color: #1F2937;
}

.upload-hint {
    font-size: 0.75rem;
    color: #6B7280;
}

/* 社交頭像預覽 */
.social-avatar-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    background: #F9FAFB;
    border-radius: 1rem;
}

.social-avatar-preview img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 按鈕樣式 */
.btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: #3A62A8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* 當前頭像預覽 */
.avatar-current-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 1.5rem;
    margin-bottom: 2rem;
    background: #f9fafb;
    border-radius: 0.75rem;
}

.avatar-display {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 4px solid #4e83c9;
    overflow: hidden;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.avatar-display:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.3);
}

.avatar-display img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-info {
    text-align: center;
}

.avatar-source {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .avatar-current-preview {
        padding: 1.5rem 1rem;
        margin-bottom: 1.5rem;
    }

    .avatar-display {
        width: 120px;
        height: 120px;
        border-width: 4px;
    }

    .avatar-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.75rem;
    }

    .avatar-tabs {
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }

    .avatar-tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }

    .upload-placeholder {
        padding: 2rem 1rem;
    }

    .upload-placeholder i {
        font-size: 2rem;
    }

    .upload-placeholder p {
        font-size: 0.875rem;
    }

    .upload-hint {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .avatar-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 0.5rem;
    }

    .avatar-tabs {
        gap: 0.25rem;
        margin-bottom: 1rem;
    }

    .avatar-tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.7rem;
    }

    .avatar-tab-btn i {
        display: none;
    }

    .avatar-current-preview {
        padding: 1rem;
    }

    .avatar-display {
        width: 100px;
        height: 100px;
        border-width: 3px;
    }

    .avatar-source {
        font-size: 0.75rem;
    }
}
