/* PawLog Social Features Styles */

/* Social Content Container */
.social-content {
    padding: 1rem 0;
    padding-bottom: calc(100px + var(--safe-area-bottom));
}

@media (min-width: 768px) {
    .social-content {
        padding-bottom: 2rem;
    }
}

/* Tab Navigation */
.social-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--color-surface);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
}

.social-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.social-tab:hover {
    background: var(--color-background);
    color: var(--color-text);
}

.social-tab.active {
    background: var(--color-primary);
    color: white;
}

.social-tab-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--color-accent, #FF3B30);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.social-tab.active .social-tab-badge {
    background: rgba(255, 255, 255, 0.3);
}

/* Section Container */
.social-section {
    display: none;
}

.social-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

/* User Card */
.user-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-card:hover {
    transform: translateX(4px);
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.user-card:active {
    transform: scale(0.98);
}

.user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    overflow: hidden;
}

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

.user-info {
    flex: 1;
    min-width: 0;
}

.user-handle {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.user-dog-name {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.user-dog-name svg {
    width: 14px;
    height: 14px;
}

.user-meta {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.user-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.user-actions .btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Friend Request Card */
.friend-request-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.friend-request-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.friend-request-message {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    padding: 0.75rem;
    background: var(--color-background);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    font-style: italic;
}

.friend-request-actions {
    display: flex;
    gap: 0.5rem;
}

/* Chat List */
.chat-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.chat-item:first-child {
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.chat-item:last-child {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    border-bottom: none;
}

.chat-item:hover {
    background: var(--color-tint);
}

.chat-item.unread {
    background: rgba(var(--color-primary-rgb, 0, 122, 255), 0.05);
}

.chat-item.unread .user-handle {
    font-weight: 700;
}

.chat-unread-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--color-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

.chat-last-message {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.25rem;
}

.chat-item.unread .chat-last-message {
    font-weight: 500;
    color: var(--color-text);
}

.chat-timestamp {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.chat-item.unread .chat-timestamp {
    right: 3rem;
}

/* Search Bar */
.social-search {
    margin-bottom: 1.5rem;
}

.search-input-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-tint);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--color-text-secondary);
    pointer-events: none;
}

.search-results {
    margin-top: 0.75rem;
}

/* Empty State */
.social-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-secondary);
}

.social-empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.social-empty h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.social-empty p {
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
}

/* Chat Window */
.chat-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-background);
    z-index: 2500;
    display: none;
    flex-direction: column;
}

.chat-window.active {
    display: flex;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.chat-back-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-primary);
    transition: all 0.2s ease;
}

.chat-back-button:hover {
    background: var(--color-tint);
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.chat-header-info {
    flex: 1;
}

.chat-header-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text);
}

.chat-header-status {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message-item {
    display: flex;
    gap: 0.5rem;
    animation: messageSlideIn 0.3s ease-out;
}

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

.chat-message-item.sent {
    flex-direction: row-reverse;
}

.chat-message-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    word-wrap: break-word;
}

.chat-message-item.received .chat-message-bubble {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-bottom-left-radius: 4px;
}

.chat-message-item.sent .chat-message-bubble {
    background: var(--color-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message-time {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.chat-message-item.sent .chat-message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
}

.chat-input-container {
    padding: 1rem;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 0.625rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: var(--color-background);
    color: var(--color-text);
    font-size: 0.9375rem;
    font-family: inherit;
    resize: none;
    transition: all 0.2s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.chat-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send-button:hover {
    transform: scale(1.05);
}

.chat-send-button:active {
    transform: scale(0.95);
}

.chat-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Profile View Modal */
.profile-view-modal {
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    max-width: 500px;
    width: 90%;
    background: var(--color-surface);
    border-radius: 16px;
    overflow: hidden;
}

/* Profile modal specific overlay positioning */
#profile-view-modal.modal-overlay {
    align-items: center;
}

.profile-view-header {
    text-align: center;
    padding: 2rem 1rem 1rem;
    background: linear-gradient(180deg, var(--color-tint) 0%, transparent 100%);
}

.profile-view-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--color-surface);
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    border: 4px solid var(--color-background);
    overflow: hidden;
}

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

.profile-view-handle {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.profile-view-name {
    font-size: 1rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.profile-view-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.profile-view-section {
    margin-bottom: 1.5rem;
}

.profile-view-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.profile-view-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-view-info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--color-surface);
    border-radius: 12px;
}

.profile-view-info-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--color-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.profile-view-info-content {
    flex: 1;
}

.profile-view-info-label {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.125rem;
}

.profile-view-info-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text);
}

.profile-view-actions {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 0.75rem;
}

.profile-view-actions .btn {
    flex: 1;
}

/* Responsive Design */
@media (max-width: 640px) {
    .user-card {
        padding: 0.75rem;
    }

    .user-avatar {
        width: 48px;
        height: 48px;
    }

    .social-tabs {
        gap: 0.25rem;
        padding: 0.375rem;
    }

    .social-tab {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Dark Theme Support */
body.dark-theme .chat-window {
    background: var(--color-background);
}

body.dark-theme .chat-message-item.received .chat-message-bubble {
    background: var(--color-surface);
    border-color: var(--color-border);
}
