/* ============================================
   INBOX PAGE STYLES
   ============================================ */

/* Inbox Layout */
.inbox-layout {
    display: grid;
    grid-template-columns: 350px 1fr 320px;
    gap: 1.5rem;
    height: calc(100vh - 200px);
    min-height: 600px;
}

/* Sidebar - Message List */
.inbox-sidebar {
    background: var(--card-bg);
    border: 1px solid rgba(74, 124, 184, 0.2);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.inbox-sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(74, 124, 184, 0.2);
}

.inbox-search {
    position: relative;
    margin-bottom: 1rem;
}

.inbox-search svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.inbox-search input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    background: var(--bg-secondary);
    border: 1px solid rgba(74, 124, 184, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
}

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

.inbox-filters {
    display: flex;
    gap: 0.5rem;
}

.inbox-filter-btn {
    flex: 1;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid rgba(74, 124, 184, 0.3);
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.inbox-filter-btn:hover {
    background: rgba(74, 124, 184, 0.1);
    color: var(--text-primary);
}

.inbox-filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

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

.message-item {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.message-item.read .message-sender-name {
    color: var(--text-muted);
    font-weight: 500;
}

.message-item.read .message-preview,
.message-item.read .message-time {
    color: var(--text-muted);
}

.message-item:hover {
    background: rgba(74, 124, 184, 0.1);
}

.message-item.active {
    background: rgba(74, 124, 184, 0.15);
}

.message-item.unread {
    background: rgba(138, 92, 246, 0.1);
}

.message-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.message-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4A7CB8 0%, #8A5CF6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    position: relative;
}

.message-avatar.online::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #10B981;
    border: 2px solid var(--card-bg);
    border-radius: 50%;
}

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

.message-sender {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.message-sender-name {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.message-item.unread .message-sender-name {
    font-weight: 700;
    color: var(--accent-primary);
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-item.unread .message-preview {
    font-weight: 600;
    color: var(--text-primary);
}

.unread-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    margin-left: 0.5rem;
}

.seen-indicator {
    margin-left: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Main Chat Area */
.inbox-main {
    background: var(--card-bg);
    border: 1px solid rgba(74, 124, 184, 0.2);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.inbox-profile {
    background: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.35);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 280px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.profile-empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    gap: 0.75rem;
}

.profile-empty-state svg {
    width: 72px;
    height: 72px;
    opacity: 0.6;
}

.profile-empty-state h3 {
    color: var(--text-primary);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.05rem;
}

.profile-hero {
    position: relative;
    background: radial-gradient(circle at 30% 20%, rgba(138, 92, 246, 0.25), transparent 40%),
                radial-gradient(circle at 80% 0%, rgba(74, 124, 184, 0.25), transparent 35%),
                var(--bg-secondary);
    border: 1px solid rgba(74, 124, 184, 0.25);
    border-radius: 12px;
    padding: 1.25rem;
    overflow: hidden;
}

.profile-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.25) 100%);
    pointer-events: none;
}

.profile-identity {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1;
}

.profile-avatar {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0f172a, #111827);
    border: none;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.4rem;
}

.profile-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    color: #e5e7eb;
    margin-bottom: 0.15rem;
}

.profile-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.profile-tag .tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-weight: 600;
    font-size: 0.8rem;
}

.profile-section {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 0, 0, 0.35);
    border-radius: 10px;
    padding: 0.9rem 1rem;
}

.profile-section h4 {
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
}

.profile-section .profile-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

.profile-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-link-row {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 0, 0, 0.35);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-primary);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.profile-link-row:hover {
    border-color: rgba(138, 92, 246, 0.35);
    background: rgba(138, 92, 246, 0.08);
}

.profile-link-row span {
    font-weight: 600;
}

.profile-link-row .profile-count {
    color: var(--text-muted);
    font-weight: 500;
}

.profile-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.profile-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

.profile-status.offline .status-dot {
    background: #6b7280;
}

.chat-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(74, 124, 184, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4A7CB8 0%, #8A5CF6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 1.2rem;
}

.chat-user-details h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.chat-user-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10B981;
}

.status-indicator.offline {
    background: #6B7280;
}

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

.chat-action-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(74, 124, 184, 0.3);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-action-btn:hover {
    background: rgba(74, 124, 184, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-bubble {
    max-width: 70%;
    padding: 1rem;
    border-radius: 12px;
    position: relative;
    animation: messageSlideIn 0.3s ease-out;
}

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

.message-bubble.received {
    align-self: flex-start;
    background: var(--bg-secondary);
    border: 1px solid rgba(74, 124, 184, 0.2);
}

.message-bubble.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(74, 124, 184, 0.3), rgba(138, 92, 246, 0.3));
    border: 1px solid rgba(138, 92, 246, 0.4);
}

.message-content {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.message-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-bubble.sent .message-meta {
    gap: 0.75rem;
}

.message-status {
    display: flex;
    align-items: center;
}

/* Date Divider */
.date-divider {
    text-align: center;
    margin: 1rem 0;
    position: relative;
}

.date-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: rgba(74, 124, 184, 0.2);
}

.date-divider span {
    position: relative;
    background: var(--card-bg);
    padding: 0.25rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-radius: 20px;
}

/* Message Input */
.chat-input-area {
    padding: 1.5rem;
    border-top: 1px solid rgba(74, 124, 184, 0.2);
}

.chat-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

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

.input-action-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(74, 124, 184, 0.3);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.input-action-btn:hover {
    background: rgba(74, 124, 184, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid rgba(74, 124, 184, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    resize: none;
    min-height: 40px;
    max-height: 120px;
}

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

.send-btn {
    width: 40px;
    height: 40px;
    background: var(--accent-primary);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    background: rgba(138, 92, 246, 0.8);
    transform: scale(1.05);
}

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

/* Empty State */
.inbox-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.inbox-empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.inbox-empty-state h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Scrollbar */
.messages-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.messages-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(74, 124, 184, 0.3);
    border-radius: 3px;
}

.messages-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 124, 184, 0.5);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .inbox-layout {
        grid-template-columns: 280px 1fr 260px;
        gap: 1rem;
    }

    .inbox-sidebar {
        max-width: 280px;
    }

    .inbox-profile {
        max-width: 260px;
    }
}

@media (max-width: 1024px) {
    .inbox-layout {
        grid-template-columns: 300px 1fr;
    }

    .inbox-profile {
        display: none;
    }

    .chat-messages {
        padding: 1.25rem;
    }
}

@media (max-width: 900px) {
    .inbox-layout {
        grid-template-columns: 260px 1fr;
    }

    .inbox-sidebar {
        max-width: 260px;
    }

    .inbox-search input {
        font-size: 0.85rem;
        padding: 0.7rem 1rem 0.7rem 2.5rem;
    }

    .message-item {
        padding: 0.9rem;
    }
}

@media (max-width: 768px) {
    .inbox-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .inbox-sidebar {
        display: none;
        max-width: 100%;
    }

    .inbox-sidebar.mobile-visible {
        display: flex;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 80%;
        max-width: 350px;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }

    .inbox-main {
        min-height: 400px;
    }

    .chat-header {
        padding: 1.25rem;
    }

    .chat-avatar {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .chat-user-details h3 {
        font-size: 1rem;
    }

    .message-bubble {
        max-width: 85%;
        padding: 0.8rem 1rem;
    }

    .message-text {
        font-size: 0.9rem;
    }

    .message-time {
        font-size: 0.7rem;
    }

    .chat-input-wrapper {
        flex-wrap: wrap;
        padding: 1rem;
    }

    .input-actions {
        order: 2;
        width: 100%;
        justify-content: flex-start;
        margin-top: 0.5rem;
    }
}

@media (max-width: 600px) {
    .inbox-main {
        min-height: 340px;
    }

    .chat-header {
        padding: 1rem;
    }

    .chat-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .chat-user-details h3 {
        font-size: 0.95rem;
    }

    .chat-user-status {
        font-size: 0.8rem;
    }

    .message-bubble {
        padding: 0.7rem 0.9rem;
    }

    .message-text {
        font-size: 0.85rem;
    }

    .chat-input {
        font-size: 0.9rem;
        padding: 0.8rem 1rem;
    }

    .btn-send {
        padding: 0.8rem 1.25rem;
        font-size: 0.9rem;
    }

    .inbox-filter-btn {
        font-size: 0.75rem;
        padding: 0.45rem;
    }
}

@media (max-width: 480px) {
    .inbox-sidebar-header {
        padding: 1rem;
    }

    .inbox-search input {
        padding: 0.65rem 0.9rem 0.65rem 2.25rem;
        font-size: 0.8rem;
    }

    .message-item {
        padding: 0.8rem;
    }

    .message-sender-name {
        font-size: 0.9rem;
    }

    .message-preview,
    .message-time {
        font-size: 0.75rem;
    }

    .chat-header {
        padding: 0.85rem;
    }

    .chat-messages {
        padding: 1rem;
        gap: 0.8rem;
    }

    .message-bubble {
        padding: 0.65rem 0.85rem;
    }

    .chat-input-wrapper {
        padding: 0.85rem;
        gap: 0.6rem;
    }

    .chat-input {
        padding: 0.7rem 0.9rem;
        font-size: 0.85rem;
    }

    .btn-send {
        padding: 0.7rem 1.1rem;
        font-size: 0.85rem;
    }
}
