:root {
    --primary-color: #4a6cf7;
    --primary-light: #6a88f7;
    --bg-color: #f8fafc9d;
    --bg: url('/assets/img/bg.png') no-repeat center center fixed;
    --card-bg: #ffffff6f;
    --text-color: #2d3748;
    --text-light: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
    --transition: all 0.3s ease;
}

.dark-mode {
    --primary-color: #5b7cfa;
    --primary-light: #7a97fa;
    --bg-color: #1a202c;
    --bg: #1a202c;
    --card-bg: #2d3748;
    --text-color: #f7fafc;
    --text-light: #cbd5e0;
    --border-color: #4a5568;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

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

body {
    background: var(--bg);
    background-size: cover;
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
    padding: 20px;
    min-height: 100vh;
}

.container {
    margin: 80px auto 30px;
    padding: 0 20px;
    max-width: 800px;
}

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

.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-color);
    box-shadow: var(--shadow);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.chat-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-color);
    color: white;
    padding: 10px 16px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    margin-top: 10px;
}

.chat-link:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

.message-form {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

input,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
    transition: var(--transition);

}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

.avatar-section {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.avatar-preview {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 1.2rem;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.avatar-options {
    flex: 1;
}

.avatar-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.toggle-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

input[disabled],
textarea[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
}

.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.color-option.selected {
    border-color: var(--text-color);
    transform: scale(1.1);
}

.markdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.markdown-toggle input {
    width: auto;
}

.submit-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    font-size: 16px;
}

.submit-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

.search-box {
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
    position: relative;
}

.search-box input {
    padding-left: 40px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.messages-container {
    margin-bottom: 30px;
}

.message-card {
    backdrop-filter: blur(10px);
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.message-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.message-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 1rem;
    background-size: cover;
    background-position: center;
}

.message-info {
    flex: 1;
}

.message-author {
    font-weight: 600;
    color: var(--text-color);
}

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

.message-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
}

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

.message-content {
    margin-bottom: 16px;
    line-height: 1.6;
}

.message-content p {
    margin-bottom: 10px;
}

.reply-form {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.reply-form textarea {
    margin-bottom: 10px;
    min-height: 80px;
}

.replies {
    margin-top: 16px;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
}

.reply-card {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.reply-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.reply-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 0.8rem;
    background-size: cover;
    background-position: center;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
}

.page-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
}

.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-btn:hover:not(.active) {
    background: var(--bg-color);
}

.admin-panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.admin-login {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.admin-login input {
    flex: 1;
}

.admin-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.admin-btn:hover {
    background: var(--primary-light);
}

.admin-actions {
    display: flex;
    gap: 10px;
}

.delete-btn {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}

.delete-btn:hover {
    background: #c53030;
}

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

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
}

@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    .message-form,
    .message-card {
        padding: 16px;
    }

    .avatar-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .replies {
        padding-left: 10px;
    }
}
