/**
 * Profile Modal & Messaging Styles
 * @author Claude Code
 * @date 2025-11-25
 */

/* =========================================
   PROFILE MODAL - Bootstrap Modal Override
   ========================================= */

#profileModal .modal-content {
    border-radius: 16px;
    border: none;
    overflow: hidden;
}

#profileModal .modal-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-bottom: none;
    padding: 1.25rem 1.5rem;
}

#profileModal .modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

#profileModal .modal-header .btn-close:hover {
    opacity: 1;
}

#profileModal .modal-body {
    padding: 0;
}

#profileModal .modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 1.5rem;
}

/* Profile Header Section */
.profile-modal-header {
    text-align: center;
    padding: 2rem 1.5rem 1.5rem;
    background: linear-gradient(180deg, rgba(0, 123, 255, 0.05) 0%, transparent 100%);
}

.profile-modal-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    margin-bottom: 1rem;
}

.profile-modal-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.25rem;
}

.profile-modal-member-since {
    font-size: 0.85rem;
    color: #6c757d;
}

.profile-modal-bio {
    font-size: 0.95rem;
    color: #495057;
    margin-top: 0.75rem;
    font-style: italic;
}

/* Stats Grid */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.profile-stat-item {
    text-align: center;
    padding: 1rem 0.5rem;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.profile-stat-item:last-child {
    border-right: none;
}

.profile-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #007bff;
    line-height: 1;
}

.profile-stat-label {
    font-size: 0.7rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* Recent Catches Section */
.profile-section {
    padding: 1rem 1.5rem;
}

.profile-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.profile-catches-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.profile-catch-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.profile-catch-item:hover {
    transform: scale(1.05);
}

.profile-catch-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-catch-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
}

.profile-catch-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    padding: 0.5rem 0.25rem 0.25rem;
    color: white;
    font-size: 0.65rem;
}

.profile-catch-species {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Teams Section */
.profile-teams-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.profile-team-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s ease;
}

.profile-team-badge:hover {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.profile-team-badge i {
    font-size: 0.75rem;
}

/* No Data States */
.profile-no-data {
    text-align: center;
    padding: 1rem;
    color: #adb5bd;
    font-size: 0.85rem;
}

/* Action Buttons */
.profile-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
}

.profile-actions .btn {
    flex: 1;
    padding: 0.6rem 1rem;
    font-weight: 600;
    border-radius: 8px;
}

.btn-message {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
    color: white;
}

.btn-message:hover {
    background: linear-gradient(135deg, #0069d9 0%, #004085 100%);
    color: white;
}

.btn-view-profile {
    background: white;
    border: 2px solid #007bff;
    color: #007bff;
}

.btn-view-profile:hover {
    background: #007bff;
    color: white;
}

/* Blocked User State */
.profile-blocked-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #856404;
}

.profile-blocked-notice i {
    color: #ffc107;
}

/* Loading State */
.profile-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6c757d;
}

.profile-modal-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
}

/* =========================================
   MESSAGING STYLES
   ========================================= */

/* Message Input in Modal */
.profile-message-input {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.profile-message-input .form-control {
    border-radius: 20px;
    padding-right: 3rem;
    border: 2px solid #e9ecef;
}

.profile-message-input .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15);
}

.profile-message-input .btn-send {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: #007bff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.profile-message-input .btn-send:hover {
    background: #0056b3;
}

/* =========================================
   MESSAGES INBOX PAGE
   ========================================= */

.messages-container {
    max-width: 800px;
    margin: 0 auto;
}

.messages-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.messages-header h2 {
    margin: 0;
    font-weight: 700;
}

.unread-badge {
    background: #dc3545;
    color: white;
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Conversation List */
.conversation-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.conversation-item:last-child {
    border-bottom: none;
}

.conversation-item:hover {
    background: #f8f9fa;
}

.conversation-item.unread {
    background: rgba(0, 123, 255, 0.05);
}

.conversation-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 1rem;
    flex-shrink: 0;
}

.conversation-content {
    flex: 1;
    min-width: 0;
}

.conversation-name {
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 0.15rem;
}

.conversation-item.unread .conversation-name {
    font-weight: 700;
}

.conversation-preview {
    font-size: 0.85rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-meta {
    text-align: right;
    flex-shrink: 0;
    margin-left: 1rem;
}

.conversation-time {
    font-size: 0.75rem;
    color: #adb5bd;
    margin-bottom: 0.25rem;
}

.conversation-unread-count {
    background: #007bff;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: auto;
}

/* Empty State */
.messages-empty {
    text-align: center;
    padding: 3rem 2rem;
    color: #6c757d;
}

.messages-empty i {
    font-size: 3rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.messages-empty h5 {
    color: #495057;
    margin-bottom: 0.5rem;
}

/* Conversation View */
.conversation-view {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 400px;
}

.conversation-view-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
}

.conversation-view-header .btn-back {
    margin-right: 1rem;
    color: #6c757d;
}

.conversation-view-header .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 0.75rem;
}

.conversation-view-header .name {
    font-weight: 600;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.message-bubble {
    max-width: 70%;
    margin-bottom: 0.75rem;
    clear: both;
}

.message-bubble.mine {
    float: right;
}

.message-bubble.theirs {
    float: left;
}

.message-bubble .bubble-content {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.message-bubble.mine .bubble-content {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-bubble.theirs .bubble-content {
    background: #f1f3f5;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
}

.message-bubble .bubble-time {
    font-size: 0.7rem;
    color: #adb5bd;
    margin-top: 0.25rem;
    text-align: right;
}

.message-bubble.theirs .bubble-time {
    text-align: left;
}

/* Message Input */
.message-input-area {
    padding: 1rem;
    border-top: 1px solid #f0f0f0;
}

.message-input-form {
    display: flex;
    gap: 0.75rem;
}

.message-input-form .form-control {
    border-radius: 24px;
    padding: 0.75rem 1.25rem;
    border: 2px solid #e9ecef;
}

.message-input-form .form-control:focus {
    border-color: #007bff;
    box-shadow: none;
}

.message-input-form .btn-send {
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* =========================================
   DARK MODE SUPPORT
   ========================================= */

html.dark-mode #profileModal .modal-content {
    background: #1e1e2d;
    color: #e9ecef;
}

html.dark-mode #profileModal .modal-header {
    background: linear-gradient(135deg, #375a7f 0%, #2c4a6b 100%);
}

html.dark-mode .profile-modal-header {
    background: linear-gradient(180deg, rgba(55, 90, 127, 0.1) 0%, transparent 100%);
}

html.dark-mode .profile-modal-name {
    color: #e9ecef;
}

html.dark-mode .profile-modal-bio {
    color: #adb5bd;
}

html.dark-mode .profile-stats-grid {
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark-mode .profile-stat-item {
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark-mode .profile-stat-value {
    color: #81D4FA;
}

html.dark-mode .profile-team-badge {
    background: #2d2d3d;
    border-color: #3d3d4d;
    color: #e9ecef;
}

html.dark-mode .profile-team-badge:hover {
    background: #375a7f;
    border-color: #375a7f;
}

html.dark-mode .profile-message-input {
    background: #181818;
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark-mode .profile-message-input .form-control {
    background: #2d2d3d;
    border-color: #3d3d4d;
    color: #e9ecef;
}

html.dark-mode .conversation-list {
    background: #1e1e2d;
}

html.dark-mode .conversation-item {
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark-mode .conversation-item:hover {
    background: #2d2d3d;
}

html.dark-mode .conversation-item.unread {
    background: rgba(55, 90, 127, 0.2);
}

html.dark-mode .conversation-name {
    color: #e9ecef;
}

html.dark-mode .conversation-view {
    background: #1e1e2d;
}

html.dark-mode .conversation-view-header {
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark-mode .message-bubble.theirs .bubble-content {
    background: #2d2d3d;
    color: #e9ecef;
}

html.dark-mode .message-input-area {
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark-mode .message-input-form .form-control {
    background: #2d2d3d;
    border-color: #3d3d4d;
    color: #e9ecef;
}

/* =========================================
   MOBILE RESPONSIVE
   ========================================= */

@media (max-width: 576px) {
    #profileModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    #profileModal .modal-content {
        border-radius: 0;
        height: 100%;
    }

    .profile-modal-avatar {
        width: 80px;
        height: 80px;
    }

    .profile-modal-name {
        font-size: 1.25rem;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-stat-item:nth-child(2) {
        border-right: none;
    }

    .profile-stat-item:nth-child(3),
    .profile-stat-item:nth-child(4) {
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    .profile-catches-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .conversation-view {
        height: calc(100vh - 150px);
    }

    .message-bubble {
        max-width: 85%;
    }
}

/* =========================================
   CLICKABLE PROFILE TRIGGERS
   ========================================= */

.profile-trigger {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.profile-trigger:hover {
    opacity: 0.8;
}

/* Feed card user clickable */
.feed-card .feed-user-info {
    cursor: pointer;
}

.feed-card .feed-user-info:hover .feed-user-name {
    color: #007bff;
    text-decoration: underline;
}

/* Leaderboard row user clickable */
.leaderboard-entry .user-info-clickable {
    cursor: pointer;
}

.leaderboard-entry .user-info-clickable:hover .user-name {
    color: #007bff;
}

/* Members list clickable */
.member-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.member-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
