/* New Components for Search, Friends, and Messages */

/* ===== SEARCH COMPONENTS ===== */
.search-container {
    padding: 20px;
}

.search-header h2 {
    margin-bottom: 20px;
    color: var(--text-color);
}

.search-bar-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    font-size: 1rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(127, 0, 255, 0.1);
}

.search-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.filter-btn {
    padding: 8px 20px;
    border: 2px solid var(--border-color);
    background: var(--white);
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    color: var(--text-body);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-card {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.user-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info {
    flex: 1;
}

.user-info h3 {
    margin-bottom: 5px;
    color: var(--text-color);
}

.username {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.bio {
    color: var(--text-body);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.hobby-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hobby-tag {
    padding: 4px 12px;
    background: rgba(127, 0, 255, 0.1);
    color: var(--primary-color);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
}

.user-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.btn-add-friend,
.btn-message,
.btn-accept {
    padding: 10px 20px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add-friend {
    background: var(--primary-color);
    color: var(--white);
}

.btn-add-friend:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-message {
    background: var(--accent-color);
    color: var(--white);
}

.btn-message:hover {
    background: #e6006f;
    transform: translateY(-2px);
}

.btn-accept {
    background: #10b981;
    color: var(--white);
}

.btn-accept:hover {
    background: #059669;
}

.friend-badge,
.pending-badge {
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.friend-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.pending-badge {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* ===== FRIENDS COMPONENTS ===== */
.friends-container {
    padding: 20px;
}

.friends-header h2 {
    margin-bottom: 20px;
    color: var(--text-color);
}

.friends-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.badge-count {
    background: var(--accent-color);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.friend-card {
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.friend-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.friend-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
}

.friend-info h3 {
    margin-bottom: 5px;
    color: var(--text-color);
}

.friend-since {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 10px;
}

.friend-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-remove,
.btn-reject {
    padding: 8px 16px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    background: #ef4444;
    color: var(--white);
}

.btn-remove:hover,
.btn-reject:hover {
    background: #dc2626;
}

.requests-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.request-card {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    align-items: center;
}

.request-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.request-info {
    flex: 1;
}

.request-time {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 5px;
}

.request-actions {
    display: flex;
    gap: 10px;
}

.request-status {
    display: flex;
    align-items: center;
}

/* ===== MESSAGES COMPONENTS ===== */
.messages-container {
    display: flex;
    height: calc(100vh - 100px);
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.conversations-sidebar {
    width: 350px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.conversations-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.conversations-header h3 {
    color: var(--text-color);
    margin: 0;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    gap: 12px;
    padding: 15px 20px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.conversation-item:hover {
    background: rgba(127, 0, 255, 0.05);
}

.conversation-item.active {
    background: rgba(127, 0, 255, 0.1);
    border-left: 3px solid var(--primary-color);
}

.conv-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.conv-info {
    flex: 1;
    min-width: 0;
}

.conv-info h4 {
    margin-bottom: 5px;
    color: var(--text-color);
    font-size: 1rem;
}

.last-message {
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.conv-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.unread-badge {
    background: var(--accent-color);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.chat-placeholder i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.chat-window {
    flex: 1;
    display: none;
    flex-direction: column;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 15px;
    align-items: center;
}

.chat-friend-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-friend-info h3 {
    margin: 0;
    color: var(--text-color);
}

.chat-friend-status {
    color: #10b981;
    font-size: 0.85rem;
    margin: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 60%;
    padding: 12px 16px;
    border-radius: 16px;
    position: relative;
}

.message.sent .message-bubble {
    background: var(--primary-color);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
    background: var(--bg-color);
    color: var(--text-body);
    border-bottom-left-radius: 4px;
}

.message-bubble p {
    margin: 0 0 5px 0;
    word-wrap: break-word;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    font-size: 1rem;
    transition: var(--transition);
}

.message-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-send {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* ===== UTILITY STATES ===== */
.loading,
.empty-state,
.error-state,
.empty-conversations {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    text-align: center;
}

.loading i,
.empty-state i,
.error-state i,
.empty-conversations i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.error-state {
    color: #ef4444;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .messages-container {
        flex-direction: column;
    }

    .conversations-sidebar {
        width: 100%;
        max-height: 40%;
    }

    .friends-grid {
        grid-template-columns: 1fr;
    }

    .user-card {
        flex-direction: column;
    }

    .user-actions {
        flex-direction: row;
        width: 100%;
    }

    .message-bubble {
        max-width: 80%;
    }
}

/* ===== PROFILE COMPONENTS ===== */
.profile-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.profile-header-card {
    position: relative;
    overflow: hidden;
    padding: 0;
    margin-bottom: 25px;
}

.profile-cover {
    height: 150px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
}

.profile-info-section {
    padding: 20px 30px;
    display: flex;
    align-items: flex-end;
    gap: 25px;
    margin-top: -60px;
}

.profile-avatar-wrapper {
    position: relative;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 5px solid var(--white);
    object-fit: cover;
    background: var(--white);
}

.btn-edit-avatar {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--white);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.btn-edit-avatar:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.profile-details {
    padding-bottom: 10px;
    flex: 1;
}

.profile-details h2 {
    margin: 0 0 5px 0;
    font-size: 1.8rem;
    color: var(--text-color);
}

.profile-details .username {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 10px;
}

.profile-details .bio {
    color: var(--text-body);
    font-size: 1rem;
    max-width: 600px;
}

.profile-content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.card-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.hobbies-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.hobby-tag.editable {
    padding-right: 30px;
    position: relative;
}

.remove-hobby {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
}

.remove-hobby:hover {
    opacity: 1;
    color: #ef4444;
}

.add-hobby-form {
    display: flex;
    gap: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 12px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-muted);
    font-weight: 500;
}

.close-modal {
    float: right;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: .5;
    cursor: pointer;
}

.close-modal:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .profile-info-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-top: -50px;
    }

    .profile-content-grid {
        grid-template-columns: 1fr;
    }
}