:root {
    --bg-main: black;
    --bg-secondary: #242424;
    --sidebar-bg: black;
    --chat-bg: black;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: rgb(134, 134, 134);
    --accent: white;
    --accent-gradient: black;
    --accent-hover: #4f46e5;
    --online-color: rgba(255, 255, 255, 0.6);
    --bubble-incoming: #01abaa;
    --bubble-outgoing: #016f6e;
    --input-bg: black;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    --glass-blur: blur(20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.12) 0px, transparent 50%);
}

a {
    color: var(--text-primary);
}

button {
    background-color: var(--bg-main);
    border: none;
    color: var(--text-primary);
    transition: .4s;
}

button:hover {
    color: var(--text-secondary);
}

input {
    background: var(--bg-main);
    color: var(--accent);
    border: none;
    padding: 1em;
    transition: .2s;
}

input:focus {
    background-color: var(--text-primary);
    color: var(--bg-main);
    outline: none;
}

.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    backdrop-filter: var(--glass-blur);
}

.app-name {
    font-weight: bolder;
}

/* Sidebar Styling */
.sidebar {
    width: 380px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 20px 20px 0px 20px;
    display: flex;
    flex-direction: column;
    align-items: self-start;
}

#pandora-username {
    font-size: xx-large;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    background: var(--accent-gradient);
    box-shadow: var(--shadow-md);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar img {
    max-width: 100%;
}

.user-avatar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.user-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.status-indicator {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-indicator::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--online-color);
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.icon-btn:active {
    transform: translateY(0);
}

.text-btn {
    font-size: larger;
}

/* Search Bar */
.search-container {
    padding: 16px 20px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

#chat-search {
    width: 100%;
    padding: 12px;
    border: none;
    font-size: 0.9rem;
    transition: all 0.25s ease;
}

#chat-search:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
    color: var(--bg-main);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Chat List container */
.chat-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0 10px 10px 10px;
}

.chat-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 10px 14px 10px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}

.badge {
    background: var(--accent-gradient);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.chat-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.chat-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

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

.chat-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-item-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.chat-item-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.chat-item-msg {
    font-size: 0.82rem;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.chat-item .unread-badge {
    background: var(--accent);
    color: var(--bg-main);
    font-size: 0.7rem;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    padding: 0 4px;
}

.loading-chats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 14px 20px;
    background: var(--bg-secondary);
}

.api-status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--online-color);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Main Chat Area */
.chat-area {
    flex: 1;
    background-color: var(--chat-bg);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Empty State */
.no-chat-state {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    background: radial-gradient(circle at center, rgba(30, 41, 59, 0.2) 0%, transparent 70%);
}

.empty-state-content {
    max-width: 420px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-secondary);
    /* border: 1px solid var(--border-color); */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px auto;
    color: var(--accent);
    font-size: 2rem;
    align-content: center;
}

.empty-state-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.empty-state-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Active Chat Interface */
.active-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-main);
}

.active-contact-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.active-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: none;
}

.active-contact-info h3 {
    font-size: 1rem;
    font-weight: bolder;
}

.contact-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.back-btn {
    display: none;
}

/* Messages Area */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    user-select: text;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.03) 0%, transparent 40%);
}

.message-group {
    display: flex;
    flex-direction: column;
    max-width: 65%;
}

.message-group.incoming {
    align-self: flex-start;
}

.message-group.outgoing {
    align-self: flex-end;
}

.message-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    width: 100%;
    display: flex;
}

.message-indicator {
    width: 0; 
    height: 0;
    margin: 0px 10px;
}

.message-bubble {
    padding: 12px 16px;
    font-size: 0.92rem;
    line-height: 1.5;
    position: relative;
    word-break: break-word;
    box-shadow: var(--shadow-sm);
}

.message-group.incoming .message-bubble {
    background-color: var(--bubble-incoming);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.message-group.outgoing .message-bubble {
    background: var(--bubble-outgoing);
    color: white;
}

.message-group.outgoing .message-indicator {
    border-left: 10px solid transparent;
    border-bottom: 10px solid var(--bubble-outgoing);
    margin-left: auto;
}

.message-group.incoming .message-indicator {
    border-right: 10px solid transparent;
    border-bottom: 10px solid var(--bubble-incoming);
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: .4em;
}

.message-content * {
    user-select: text;
}

.message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 0.7rem;
    margin-top: 4px;
}

.message-image-attachement {
    max-width: 100%;
    max-height: 10em;
}

/* Chat Input Panel */
.chat-input-panel {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.chat-input-panel button {
    background-color: transparent;
}

.input-actions-left {
    display: flex;
    gap: 8px;
}

.input-form {
    flex: 1;
    display: flex;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

#message-input {
    flex: 1;
    padding: 12px 18px;
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--bg-main);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    min-width: 0;
}

#message-input:focus {
    color: var(--text-primary);
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.send-btn {
    width: 44px;
    height: 44px;
    background: var(--accent-gradient);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.send-btn:active {
    transform: scale(0.98) translateY(0);
}

.send-btn i {
    width: 18px;
    height: 18px;
}

/* Scrollbars styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 0px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* Helper classes */
.hidden {
    display: none !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .app-container {
        position: relative;
    }
    
    .sidebar {
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 10;
    }
    
    .sidebar.hidden {
        transform: translateX(-100%);
        display: flex !important;
    }
    
    .chat-area {
        width: 100%;
    }
    
    .back-btn {
        display: flex;
        margin-right: 8px;
    }

    .message-group {
        max-width: 100%;
    }

    .message-image-attachement {
        max-height: 20em;
    }
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    z-index: 100;
    transition: all 0.3s ease;
}

.modal-content {
    width: 100%;
    background: var(--bg-main);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: xx-large;
    font-weight: 600;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.settings-warning {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: auto;
}

.btn {
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.primary-btn {
    background: var(--accent-gradient);
    color: white;
}

.secondary-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.secondary-btn:hover {
    background: var(--text-primary);
    color: var(--bg-main);
}

