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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --error: #ef4444;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease;
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.glass-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.8s ease;
}

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

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    overflow: hidden;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.btn:hover::after {
    left: 100%;
}

.search-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
}

.stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.messages-grid {
    display: grid;
    gap: 1.5rem;
}

.message-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease;
    position: relative;
    overflow: hidden;
}

.message-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.message-card:hover {
    transform: translateX(5px);
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.8);
}

.message-card:hover::before {
    opacity: 1;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.author-name {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
}

.timestamp {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: monospace;
}

.message-content {
    color: var(--text);
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

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

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: var(--success);
}

.notification.error {
    background: var(--error);
}

.highlight {
    background: rgba(99, 102, 241, 0.3);
    padding: 0 2px;
    border-radius: 3px;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

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

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

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 600px) {
    h1 { font-size: 1.8rem; }
    .glass-card { padding: 1.5rem; }
    .search-section { flex-direction: column; }
    .search-input { width: 100%; }
}

.api-status {
    text-align: center;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.api-status.show {
    opacity: 1;
}

.api-status.connected {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.api-status.error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}
/* Admin Panel Styles */
.admin-panel {
    border: 2px solid var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.admin-panel h2 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.admin-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.admin-action-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.admin-action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.admin-action-btn.danger {
    border-color: var(--error);
    color: var(--error);
}

.admin-action-btn.danger:hover {
    background: var(--error);
    color: white;
}

.admin-search-box input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--primary);
    border-radius: 8px;
    color: var(--text);
}

/* Admin Message Controls */
.admin-btn {
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.6;
    transition: all 0.2s;
}

.message-card:hover .admin-btn {
    opacity: 1;
}

.admin-btn:hover {
    transform: scale(1.2);
}

.edit-btn:hover { background: rgba(99, 102, 241, 0.2); border-color: var(--primary); }
.delete-btn:hover { background: rgba(239, 68, 68, 0.2); border-color: var(--error); }
.ban-btn:hover { background: rgba(245, 158, 11, 0.2); border-color: #f59e0b; }

.edited-badge {
    font-size: 0.7rem;
    background: var(--primary);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    opacity: 0.7;
}

.message-card.edited {
    border-left: 3px solid var(--primary);
}

.msg-id {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-family: monospace;
    opacity: 0.5;
}

