/* ===== Interlace.fun — Modern Social Theme ===== */
/* Подключайте Google Fonts в base.html */
/* <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet"> */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== ТЕМЫ ===== */
/* Тёмная (по умолчанию) */
body.theme-dark {
    --bg-primary: #0a0c10;
    --bg-secondary: #1a1d24;
    --bg-card: #1e2128;
    --text-primary: #ffffff;
    --text-secondary: #b0b8c5;
    --accent: #6366f1;
    --accent-hover: #8183f3;
    --border: #2f3540;
    --shadow: rgba(0, 0, 0, 0.3);
    --input-bg: #2c313a;
    --badge-bg: rgba(99, 102, 241, 0.15);
}

/* Тёмно-серая */
body.theme-gray {
    --bg-primary: #1e1f2a;
    --bg-secondary: #2b2d3a;
    --bg-card: #2f313e;
    --text-primary: #f0f2f5;
    --text-secondary: #c0c4cc;
    --accent: #4a80e0;
    --accent-hover: #5a90f0;
    --border: #404352;
    --shadow: rgba(0, 0, 0, 0.25);
    --input-bg: #3a3d4e;
    --badge-bg: rgba(74, 128, 224, 0.15);
}

/* Светлая */
body.theme-light {
    --bg-primary: #f5f7fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1a1e24;
    --text-secondary: #5e6775;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.05);
    --input-bg: #f1f5f9;
    --badge-bg: rgba(37, 99, 235, 0.1);
}

/* ===== ГЛОБАЛЬНЫЕ ЭЛЕМЕНТЫ ===== */
a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

.container {
    display: flex;
    flex: 1;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== БОКОВОЕ МЕНЮ ===== */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 30px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 10px var(--shadow);
}

.sidebar h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 40px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar nav ul {
    list-style: none;
}

.sidebar nav li {
    margin-bottom: 12px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar nav a:hover {
    background: var(--bg-card);
    color: var(--accent);
    transform: translateX(5px);
}

/* ===== ОСНОВНОЙ КОНТЕНТ ===== */
.content {
    flex: 1;
    padding: 30px 40px;
    max-width: 900px;
    margin: 0 auto;
}

/* ===== КАРТОЧКИ (ПОСТЫ, ПРОФИЛЬ, НАСТРОЙКИ) ===== */
.card, .post, .profile-card, .settings-section {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover, .post:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px var(--shadow);
}

/* ===== АВАТАРКИ ===== */
.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    background: var(--bg-secondary);
}

.profile-header {
    display: flex;
    gap: 30px;
    align-items: center;
    margin-bottom: 30px;
}

.profile-avatar img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--accent);
    object-fit: cover;
}

.profile-info h2 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.profile-bio {
    color: var(--text-secondary);
    margin: 12px 0;
    font-size: 1.1rem;
}

/* ===== КАТЕГОРИИ (БАББЛЫ) ===== */
.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.category-bubble {
    background: var(--badge-bg);
    color: var(--accent);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.3);
    transition: all 0.2s;
}

.category-bubble:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Дерево категорий (для выбора) */
.categories-tree {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.category-group {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 16px;
}

.category-parent {
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.category-children {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.category-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    border-radius: 4px;
}

/* ===== ФОРМЫ И КНОПКИ ===== */
input, textarea, select {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border 0.2s, box-shadow 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
}

.btn-outline:hover {
    background: var(--accent);
    color: white;
}

/* ===== ЛЕНТА ПОСТОВ ===== */
.posts-feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post {
    position: relative;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.post-author img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--accent);
}

.post-author a {
    font-weight: 700;
    color: var(--text-primary);
}

.post-content {
    font-size: 1.1rem;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.post-date {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===== СТРАНИЦА НАСТРОЕК ===== */
.settings-section {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 28px;
}

.settings-section h3 {
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--accent);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Переключатель тем */
.theme-selector {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.theme-option {
    flex: 1;
    min-width: 100px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-option:hover {
    border-color: var(--accent);
    background: var(--badge-bg);
}

.theme-option.active {
    border-color: var(--accent);
    background: var(--badge-bg);
}

.theme-option span {
    display: block;
    margin-top: 8px;
    font-weight: 500;
}

/* ===== УВЕДОМЛЕНИЯ (FLASH) ===== */
.flashes {
    list-style: none;
    margin-bottom: 24px;
}

.flash-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid #10b981;
    color: #10b981;
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.flash-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.flash-info {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 12px;
}

/* ===== ФУТЕР ===== */
footer {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    text-align: center;
    padding: 24px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

footer a {
    color: var(--accent);
}

footer a:hover {
    text-decoration: underline;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding: 0;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 20px;
    }

    .content {
        padding: 20px;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .categories-tree {
        grid-template-columns: 1fr;
    }

    .theme-selector {
        flex-direction: column;
    }
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card, .post, .profile-header, .settings-section {
    animation: fadeIn 0.4s ease-out;
}

/* ===== ДОПОЛНИТЕЛЬНЫЕ КЛАССЫ ===== */
.text-gradient {
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}
