@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

.text {
    white-space-collapse: break-spaces;
}

:root {
    --bg-color: #0f0f0f;
    --card-bg: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: #333333;
    --danger: #ef4444;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
    font-weight: 500;
}

nav a:hover,
nav a.active {
    color: var(--accent);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.card h3 {
    margin-bottom: 0.5rem;
}

.card .metadata {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

button:hover {
    background: var(--accent-hover);
}

button.secondary {
    background: transparent;
    border: 1px solid var(--border-color);
}

button.danger {
    background: var(--danger);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input,
select,
textarea {
    width: 100%;
    background: #252525;
    border: 1px solid var(--border-color);
    padding: 0.8rem;
    color: white;
    border-radius: 6px;
    outline: none;
}

input:focus {
    border-color: var(--accent);
}

#chat-viewer {
    max-width: 800px;
}

.messages-list {
    height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-right: 0.5rem;
}

.message {
    padding: 0.8rem;
    border-radius: 8px;
    background: #252525;
    margin-bottom: 0.8rem;
}

.message .sender {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 0.2rem;
}

.message .time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    float: right;
}

/* Chat Overhaul */
.chat-container {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 500px;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
}

.chat-sidebar {
    width: 320px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.02);
}

.chat-sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
}

.chat-sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 1.25rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
}

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

.chat-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--accent);
}

.chat-item h4 {
    margin: 0 0 0.4rem 0;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.15);
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    /* Most recent at bottom visually (visually 0 is bottom) */
}

#messages-content {
    display: flex;
    flex-direction: column-reverse;
    width: 100%;
}

.message-bubble {
    max-width: 80%;
    padding: 0.8rem 1.1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    position: relative;
    line-height: 1.5;
    word-wrap: break-word;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-bubble.received {
    align-self: flex-start;
    background: #2a2a2a;
    border-bottom-left-radius: 2px;
}

.message-bubble.sent {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 2px;
}

.message-info {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.chat-input-area {
    padding: 1.25rem;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.chat-input-area input {
    flex: 1;
    background: #252525;
}

button.small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Loading Spinner */
.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
}

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

.load-more {
    text-align: center;
    padding: 1.5rem;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.load-more:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.info-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-item.full-width {
    grid-column: span 2;
}

.info-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.info-value {
    font-size: 1rem;
    font-weight: 500;
    word-break: break-all;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.badge.premium {
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    color: white;
}

.badge.verified {
    background: var(--success);
    color: white;
}

.badge.danger {
    background: var(--danger);
    color: white;
}