/* =========================
   User Profile Page
   Version: 6.6.7
   ========================= */

/* Profile Page Container */
.profile-page {
    min-height: 100vh;
    background: #F8FAFB;
    padding-bottom: 60px;
}

/* Profile Header */
.profile-header {
    background: #2C5F7F;
    padding: 60px 16px 24px;
    text-align: center;
    position: relative;
}

/* Profile Header Top Bar */
.profile-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px;
    z-index: 10;
}

.profile-header-icons {
    display: flex;
    gap: 8px;
}

.profile-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.profile-icon-btn:active {
    transform: scale(0.95);
}

.profile-back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.profile-back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.profile-back-btn:active {
    transform: scale(0.95);
}

/* Profile Avatar Container */
.profile-avatar-container {
    position: relative;
    display: inline-block;
    margin-bottom: 16px;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.profile-avatar-large .emoji {
    font-size: 64px;
}

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

/* Edit Icon (본인 프로필에서만) */
.profile-edit-icon {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

.profile-edit-icon:hover {
    transform: scale(1.1);
}

/* Profile Info */
.profile-username {
    color: white;
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.profile-bio {
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    line-height: 1.4;
    margin: 0 0 16px 0;
    padding: 0 20px;
    word-wrap: break-word;
}

.profile-bio-empty {
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.profile-bio-edit-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 4px;
}

/* Profile Action Buttons */
.profile-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}

.profile-action-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.profile-action-btn.primary {
    background: white;
    color: var(--primary);
}

.profile-action-btn.primary:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
}

.profile-action-btn.secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.profile-action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.profile-action-btn.following {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Profile Stats */
.profile-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    color: white;
}

.profile-stat {
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.profile-stat:hover {
    transform: translateY(-2px);
}

.profile-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-stat-label {
    display: block;
    font-size: 13px;
    opacity: 0.9;
}

/* Profile Tabs */
.profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-white);
    position: sticky;
    top: 0;
    z-index: 99;
}

.profile-tab {
    flex: 1;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.profile-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.profile-tab:hover {
    background: var(--bg-main);
}

/* Profile Tab Content */
.profile-tab-content {
    min-height: 300px;
    background: var(--bg-white);
}

/* Threads Feed List in Profile */
.profile-tab-content .threads-feed-list {
    background: var(--bg-white);
}

/* User List (Followers/Following) */
.user-list {
    padding: 0;
    background: var(--bg-white);
}

.user-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
    cursor: pointer;
}

.user-list-item:hover {
    background: var(--bg-main);
}

.user-list-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    overflow: hidden;
}

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

.user-list-info {
    flex: 1;
}

.user-list-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-list-time {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.user-list-btn {
    padding: 6px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.user-list-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.user-list-btn.following {
    background: var(--border-light);
    color: var(--text-secondary);
}

.user-list-btn.following:hover {
    background: #e74c3c;
    color: white;
}

/* Empty State */
.profile-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.profile-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.profile-empty-text {
    font-size: 16px;
    font-weight: 500;
}

/* Profile Edit Modal */
.profile-edit-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: 9999;
    padding: 20px;
}

.profile-edit-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.profile-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.profile-edit-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
}

.profile-edit-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.profile-edit-close:hover {
    background: var(--bg-main);
}

.profile-edit-body {
    padding: 24px;
}

.profile-edit-section {
    margin-bottom: 24px;
}

.profile-edit-section:last-child {
    margin-bottom: 0;
}

.profile-edit-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.profile-edit-avatar-preview {
    text-align: center;
    margin-bottom: 16px;
}

.profile-edit-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 52px;
    border: 3px solid var(--border-light);
    overflow: hidden;
}

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

.profile-edit-btns {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.profile-edit-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    background: white;
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-edit-btn:hover {
    background: var(--bg-main);
}

.profile-edit-btn.danger {
    color: #e74c3c;
    border-color: #e74c3c;
}

.profile-edit-btn.danger:hover {
    background: #e74c3c;
    color: white;
}

.profile-edit-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.profile-edit-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.profile-edit-char-count {
    text-align: right;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.profile-edit-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}

.profile-edit-footer button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-edit-footer .btn-cancel {
    background: var(--bg-main);
    color: var(--text-primary);
}

.profile-edit-footer .btn-cancel:hover {
    background: var(--border-light);
}

.profile-edit-footer .btn-save {
    background: var(--primary);
    color: white;
}

.profile-edit-footer .btn-save:hover {
    background: var(--primary-dark);
}

.profile-edit-footer .btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Message Modal */
.message-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: 9999;
    padding: 20px;
}

.message-modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.message-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.message-modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.message-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.message-modal-close:hover {
    background: var(--bg-main);
}

.message-modal-body {
    padding: 24px;
}

.message-modal-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.message-modal-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.message-modal-char-count {
    text-align: right;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.message-modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}

.message-modal-footer button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.message-modal-footer .btn-cancel {
    background: var(--bg-main);
    color: var(--text-primary);
}

.message-modal-footer .btn-cancel:hover {
    background: var(--border-light);
}

.message-modal-footer .btn-send {
    background: var(--primary);
    color: white;
}

.message-modal-footer .btn-send:hover {
    background: var(--primary-dark);
}

.message-modal-footer .btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 375px) {
    .profile-avatar-large {
        width: 100px;
        height: 100px;
    }
    
    .profile-avatar-large .emoji {
        font-size: 52px;
    }
    
    .profile-username {
        font-size: 22px;
    }
}
