/* ====================================
   MESSAGES SCREEN STYLES
   ==================================== */

:root {
    --primary: #ffd700;
    --bg: #050505;
    --card-bg: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
    --text-muted: #888;
    --success-green: #4ade80;
    --error-red: #ff6b6b;
    --hover-bg: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: white;
    line-height: 1.6;
}

/* ====================================
   MESSAGES CONTAINER
   ==================================== */

.messages-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
}

/* ====================================
   HEADER
   ==================================== */

.messages-header {
    margin-bottom: 2rem;
}

.messages-header h1 {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), #ffa500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

/* ====================================
   MESSAGES CONTENT
   ==================================== */

.messages-content {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    min-height: 500px;
}

/* ====================================
   CHATS LIST
   ==================================== */

.chats-list {
    display: flex;
    flex-direction: column;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: white;
    transition: all 0.3s;
    position: relative;
}

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

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

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

.chat-item.unread:hover {
    background: rgba(255, 215, 0, 0.1);
}

/* Avatar with online indicator */
.chat-avatar {
    position: relative;
    flex-shrink: 0;
}

.chat-avatar img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--border);
    object-fit: cover;
    transition: all 0.3s;
}

.chat-item:hover .chat-avatar img {
    border-color: var(--primary);
}

.chat-item.unread .chat-avatar img {
    border-color: var(--primary);
}

/* Optional: Online indicator */
.chat-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: var(--success-green);
    border: 2px solid var(--bg);
    border-radius: 50%;
    display: none;
    /* Show this when user is online */
}

.chat-avatar.online::after {
    display: block;
}

/* ====================================
   CHAT INFO
   ==================================== */

.chat-info {
    flex: 1;
    min-width: 0;
    /* Allow text truncation */
}

.chat-name {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-username {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-muted);
}

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

.chat-last-message.empty {
    font-style: italic;
    color: #666;
}

.chat-item.unread .chat-last-message {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

/* ====================================
   CHAT META
   ==================================== */

.chat-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

.chat-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.unread-badge {
    background: linear-gradient(135deg, var(--primary), #ffa500);
    color: black;
    font-size: 0.75rem;
    font-weight: 900;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* ====================================
   NO CHATS STATE
   ==================================== */

.no-chats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    min-height: 500px;
}

.no-chats-icon {
    color: var(--text-muted);
    opacity: 0.5;
    margin-bottom: 1.5rem;
}

.no-chats h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: white;
}

.no-chats p {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 400px;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.explore-btn {
    background: linear-gradient(135deg, var(--primary), #ffa500);
    color: black;
    text-decoration: none;
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.explore-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.4);
}

/* ====================================
   ALERT STYLES (if needed)
   ==================================== */

.alert {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: var(--success-green);
}

.alert-error {
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: var(--error-red);
}

.alert-info {
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: var(--primary);
}

/* ====================================
   LOADING STATE
   ==================================== */

.loading-skeleton {
    padding: 1.5rem;
}

.skeleton-chat {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
}

.skeleton-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--card-bg) 0%, rgba(255, 255, 255, 0.08) 50%, var(--card-bg) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-content {
    flex: 1;
}

.skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, var(--card-bg) 0%, rgba(255, 255, 255, 0.08) 50%, var(--card-bg) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.long {
    width: 90%;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ====================================
   SEARCH BAR (Optional Enhancement)
   ==================================== */

.messages-search {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

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

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    color: white;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 215, 0, 0.05);
}

.search-input::placeholder {
    color: var(--text-muted);
}

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

/* ====================================
   RESPONSIVE DESIGN
   ==================================== */

@media (max-width: 768px) {
    .messages-container {
        padding: 1rem;
    }

    .messages-header h1 {
        font-size: 2rem;
    }

    .chat-item {
        padding: 1rem;
    }

    .chat-avatar img {
        width: 48px;
        height: 48px;
    }

    .chat-name {
        font-size: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .chat-username {
        font-size: 0.8rem;
    }

    .chat-last-message {
        font-size: 0.875rem;
    }

    .chat-time {
        font-size: 0.75rem;
    }

    .unread-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .no-chats {
        padding: 3rem 1.5rem;
        min-height: 400px;
    }

    .no-chats h2 {
        font-size: 1.5rem;
    }

    .no-chats p {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .messages-header h1 {
        font-size: 1.75rem;
    }

    .chat-item {
        padding: 0.875rem;
        gap: 0.75rem;
    }

    .chat-avatar img {
        width: 44px;
        height: 44px;
    }

    .chat-meta {
        gap: 0.375rem;
    }

    .no-chats-icon svg {
        width: 48px;
        height: 48px;
    }

    .explore-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
}

/* ====================================
   HOVER EFFECTS & TRANSITIONS
   ==================================== */

.chat-item {
    animation: fadeIn 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for chat list items */
.chat-item:nth-child(1) {
    animation-delay: 0.05s;
}

.chat-item:nth-child(2) {
    animation-delay: 0.1s;
}

.chat-item:nth-child(3) {
    animation-delay: 0.15s;
}

.chat-item:nth-child(4) {
    animation-delay: 0.2s;
}

.chat-item:nth-child(5) {
    animation-delay: 0.25s;
}

/* ====================================
   DARK MODE ENHANCEMENTS
   ==================================== */

@media (prefers-color-scheme: dark) {
    /* Already optimized for dark mode */
}

/* ====================================
   ACCESSIBILITY
   ==================================== */

.chat-item:focus {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.explore-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ====================================
   CUSTOM SCROLLBAR
   ==================================== */

.chats-list::-webkit-scrollbar {
    width: 8px;
}

.chats-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.chats-list::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 4px;
}

.chats-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.5);
}