/* ===== RESET & CSS VARIABLES ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light theme (фиолетовая палитра) */
    --bg-primary: #faf9ff;
    --bg-secondary: #ffffff;
    --bg-header: #7c5cbf;      /* спокойный фиолетово-лавандовый */
    --text-primary: #1e1b2e;
    --text-secondary: #4a4569;
    --text-muted: #7b7892;
    --border-color: rgba(98, 75, 155, 0.08);
    --shadow: 0 2px 8px rgba(98, 75, 155, 0.06);
    --shadow-hover: 0 8px 30px rgba(98, 75, 155, 0.12);
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --dropdown-bg: rgba(255, 255, 255, 0.98);
}

[data-theme="dark"] {
    --bg-primary: #15142b;
    --bg-secondary: #1e1d3a;
    --bg-header: #7c5cbf;      /* приглушённый тёмно-фиолетовый */
    --text-primary: #f0efff;
    --text-secondary: #cbc9f0;
    --text-muted: #9c99c7;
    --border-color: rgba(139, 118, 210, 0.15);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.5);
    --card-bg: #1e1d3a;
    --input-bg: #2d2b55;
    --dropdown-bg: rgba(30, 29, 58, 0.98);
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

a {
    color: #7c5cbf;
    text-decoration: none;
    transition: color 0.3s ease;
}
a:hover {
    color: #7c5cbf;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== HEADER ===== */
.header {
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 20px;
    border-radius: 16px;
    margin-top: 10px;
    transition: background-color 0.3s ease;
    width: 100%;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
}
.logo-icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}
.logo h1 {
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}
.logo a {
    color: #FFF;
    text-decoration: none;
    transition: color 0.3s ease;
}
.logo a:hover {
    color: #dbeafe;
}

/* Navigation */
.nav-list {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 2rem;
}
.nav-list li {
    position: relative;
}
.nav-list a {
    color: #FFF;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0;
    transition: all 0.3s ease;
    position: relative;
}
.nav-list a:hover {
    color: #dbeafe;
}
.nav-list a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #dbeafe;
    transition: width 0.3s ease;
}
.nav-list a:hover::after {
    width: 100%;
}

/* Dropdowns */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--dropdown-bg);
    backdrop-filter: blur(20px);
    min-width: 200px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    padding: 0.5rem;
    z-index: 1000;
    animation: fadeInUp 0.2s ease;
    list-style: none;
}
.dropdown-menu li {
    margin: 0;
}
.dropdown-menu a {
    color: var(--text-primary);
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}
.dropdown-menu a:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    transform: translateX(4px);
}
.dropdown:hover .dropdown-menu {
    display: block;
}

/* User Menu */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}
.user-menu:hover {
    background: rgba(255, 255, 255, 0.1);
}
.user-avatar-header {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: border-color 0.3s ease;
}
.user-menu:hover .user-avatar-header {
    border-color: rgba(255, 255, 255, 0.6);
}
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-placeholder-header {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e40af 0%, #1e40af 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
}
.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    background: var(--dropdown-bg);
    backdrop-filter: blur(20px);
    min-width: 180px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    padding: 0.5rem;
    z-index: 1000;
    animation: fadeInUp 0.2s ease;
    list-style: none;
}
.user-dropdown li {
    margin: 0;
}
.user-dropdown a {
    color: var(--text-primary);
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}
.user-dropdown a:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    transform: translateX(4px);
}
.user-menu:hover .user-dropdown {
    display: block;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}
.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}
.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #1e1d3a;
    transition: .4s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "☀️";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
}
input:checked + .slider {
    background-color: #1e293b;
}
input:checked + .slider:before {
    transform: translateX(26px);
    content: "🌙";
}
.theme-label {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    gap: 0.4rem;
}
.mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    background: #fff;
    transition: 0.3s;
    border-radius: 2px;
}
.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}
.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}
.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
}
.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}
.btn:hover::before {
    left: 100%;
}
.btn-primary {
    background: #7c5cbf;
    color: white;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover {
    background: #7c5cbf;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
}
.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-primary);
    transform: translateY(-2px);
}
.btn-success {
    background: #10b981;
    color: white;
}
.btn-success:hover {
    background: #059669;
}
.btn-danger {
    background: #ef4444;
    color: white;
}
.btn-danger:hover {
    background: #dc2626;
}
.btn-warning {
    background: #f59e0b;
    color: white;
}
.btn-warning:hover {
    background: #d97706;
}
.btn-info {
    background: #06b6d4;
    color: white;
}
.btn-info:hover {
    background: #0891b2;
}
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}
.btn-edit {
    background: #f59e0b;
    color: white;
}
.btn-edit:hover {
    background: #d97706;
}
.btn-delete {
    background: #ef4444;
    color: white;
}
.btn-delete:hover {
    background: #dc2626;
}
.btn-view {
    background: #06b6d4;
    color: white;
}
.btn-view:hover {
    background: #0891b2;
}
.btn-large {
    padding: 1.25rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
}

/* ===== CARDS (универсальные) ===== */
.content-card,
.announcement-card,
.project-card,
.knowledge-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}
.content-card:hover,
.announcement-card:hover,
.project-card:hover,
.knowledge-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(37, 99, 235, 0.1);
}
.content-card h3,
.announcement-card h3,
.project-card h3,
.knowledge-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}
.content-card p,
.announcement-card p,
.project-card p,
.knowledge-card p {
    color: var(--text-secondary);
    line-height: 1.5;
    flex-grow: 1;
}
.content-card .card-meta,
.announcement-card .announcement-meta,
.project-card .project-meta,
.knowledge-card .knowledge-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.content-card .read-more,
.announcement-card .read-more,
.project-card .read-more,
.knowledge-card .read-more {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

/* Проектные карточки в гриде */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card .badge {
    margin: 0.5rem 0;
}

/* Полная статья проекта */
.project-full {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    margin-top: 2rem;
}
.project-full h1 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
}
.project-full .project-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}
.project-description,
.project-content {
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Статистика на дашборде */
.stats-grid,
.stats-grid-improved {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.stat-card,
.stat-card-improved,
.stat-card-work {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}
.stat-card:hover,
.stat-card-improved:hover,
.stat-card-work:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.stat-card::before,
.stat-card-improved::before,
.stat-card-work::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #1e40af 0%, #1e40af 100%);
}
.stat-icon,
.stat-icon-improved,
.stat-icon-work {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #1e40af 0%, #1e40af 100%);
    color: white;
    flex-shrink: 0;
}
.stat-number,
.stat-number-improved {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}
.stat-label,
.stat-label-improved {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Админские модули */
.admin-modules {
    display: grid;
    gap: 1rem;
}
.admin-module {
    display: block;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.3s;
}
.admin-module:hover {
    background: var(--bg-primary);
    border-color: #2563eb;
    transform: translateY(-2px);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--input-bg);
    color: var(--text-primary);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}
.form-group textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 0.5rem;
}
.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: shake 0.5s ease-in-out;
}
.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 20px;
    text-transform: uppercase;
}
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-admin { background: #dbeafe; color: #1e40af; }
.badge-student { background: #e5e7eb; color: #374151; }
.badge-networking,
.badge-system,
.badge-programming {
    background: linear-gradient(135deg, #2563eb 0%, #2563eb 100%);
    color: white;
}
.badge-planned { background: #e2e8f0; color: #475569; }
.badge-completed { background: #d4edda; color: #155724; }

/* ===== LOGIN PAGE ===== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    font-family: 'Inter', sans-serif;
    position: relative;
    overflow: hidden;
}
.login-background {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1;
}
.login-container {
    background: var(--dropdown-bg);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow-hover);
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 2;
    animation: slideUp 0.8s ease-out;
}
.login-header {
    padding: 1.5rem;
    text-align: center;
    background: #7c5cbf;
    color: white;
    border-radius: 20px 20px 0 0; 
}
.login-form {
    padding: 2rem 2rem 1.5rem;
}
.btn-login {
    background: #7c5cbf;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}
.btn-login:hover {
    transform: translateY(-2px);
}
.login-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* ===== DASHBOARD & ADMIN ===== */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
}
.welcome-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    margin-top: 2rem;
    border: 1px solid var(--border-color);
}
.hero-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    align-items: center;
}
.hero-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}
.feature {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}
.feature-icon { font-size: 1.5em; flex-shrink: 0; }
.hero-image img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

/* Админка */
.admin-page {
    max-width: 1200px;
    margin: 0 auto;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top:2rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.page-actions {
    display: flex;
    gap: 1rem;
}

/* ===== TABLES ===== */
.admin-table-container {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}
.admin-table th {
    background: var(--bg-primary);
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}
.admin-table tr:hover {
    background: var(--bg-primary);
}
.admin-table .actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ===== KNOWLEDGE BASE ===== */
.knowledge-base-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}
.knowledge-article-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 1.75rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.knowledge-article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.article-header h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}
.article-header h2 a {
    color: var(--text-primary);
    text-decoration: none;
}
.article-header h2 a:hover { color: #667eea; }
.article-category {
    background: linear-gradient(135deg, #1e40af 0%, #1e40af 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}
.article-content {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}
.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}
.article-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Связанные статьи */
.related-articles {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2rem;
}
.related-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.related-item a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    display: block;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}
.related-item a:hover {
    background: var(--bg-primary);
    color: #667eea;
    border-left-color: #667eea;
}

/* ===== COURSES & PRACTICE ===== */
.course-card-large {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}
.course-card-large:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.course-header-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.course-progress {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}
.progress-container {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.75rem 0;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}
.course-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}
.course-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== MARKDOWN EDITOR & PREVIEW ===== */
.markdown-editor {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--input-bg);
}
.editor-toolbar {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}
.md-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}
.md-btn:hover {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}
.md-preview {
    padding: 1rem;
    min-height: 200px;
    background: var(--input-bg);
    color: var(--text-primary);
    line-height: 1.6;
}
/* Markdown rendered content */
.markdown-body {
    line-height: 1.7;
    color: var(--text-secondary);
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    color: var(--text-primary);
    margin: 1.5rem 0 0.5rem;
    font-weight: 600;
}
.markdown-body p { margin-bottom: 1rem; }
.markdown-body pre {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
}
.markdown-body code {
    background: var(--bg-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}
.markdown-body ul,
.markdown-body ol {
    margin: 1rem 0;
    padding-left: 2rem;
}
.markdown-body blockquote {
    border-left: 4px solid #667eea;
    background: var(--bg-primary);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
}
.markdown-body img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}
.markdown-body th,
.markdown-body td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    text-align: left;
}
.markdown-body th {
    background: var(--bg-secondary);
    font-weight: 600;
}

/* ===== АНИМАЦИИ И УТИЛИТЫ ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 2rem;
}
.no-data h3 { margin-bottom: 1rem; color: var(--text-primary); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }

/* ===== FOOTER ===== */
.footer {
    background: var(--bg-secondary);
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
    color: var(--text-primary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header-content {height: auto; gap: 1rem; }
    .mobile-menu-toggle { display: flex; }
    .nav { 
        display: none; 
        position: absolute; top: 100%; left: 0; right: 0;
        background: var(--bg-header);
        padding: 1rem; border-radius: 0 0 16px 16px;
        z-index: 999;
    }
    .nav.active { display: block; animation: fadeInUp 0.3s ease; }
    .nav-list { flex-direction: column; gap: 0.5rem; }
    .nav-list a { display: block; padding: 0.75rem 1rem; border-radius: 8px; }
    .nav-list a::after { display: none; }
    .dropdown-menu, .user-dropdown { position: static; box-shadow: none; border: none; background: rgba(255,255,255,0.1); margin-top: 0.5rem; }
    .dropdown-menu a, .user-dropdown a { color: #fff; }
    .user-menu { padding: 0.75rem 1rem; border-radius: 8px; }
    .theme-toggle { margin-left: 0; justify-content: space-between; padding: 0.75rem 1rem; }
    
    .dashboard-grid, .stats-grid, .stats-grid-improved { grid-template-columns: 1fr; }
    .hero-content { grid-template-columns: 1fr; }
    .hero-features { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-actions { flex-direction: column; }
    .admin-table { font-size: 0.8rem; }
    .knowledge-base-grid { grid-template-columns: 1fr; }
    .projects-grid { grid-template-columns: 1fr; }
    
    .login-container { margin: 1rem; max-width: calc(100% - 2rem); }
}

@media (max-width: 480px) {
    .header { margin-top: 0px; border-radius: 0px; }
    .logo h1 { font-size: 1.25rem; }
}

.search-input-group{
      display: flex;
  align-items: center;
}
.search-input{
    height: 40px;
    border-radius: 10px 0 0 10px;
    border: none; /* Убирает основную рамку */
    outline: none;
    padding: 0px 10px;
}

.search-btn{
    height: 40px;
    border-radius: 0 10px 10px 0;
    margin-left: 0px;
    border: none; /* Убирает основную рамку */
    outline: none;
    padding: 0px 10px;
}

.filter-section{
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    margin-top: 2rem;
    border: 1px solid var(--border-color);
}

.active{
    background: var(--bg-header) !important;
    color: #FFF !important;
}

.category-filter{
    background: var(--card-bg);
    padding: 5px 15px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin: 2px;
    margin-top: 10px;
    border: 1px solid var(--border-color);
    color: var(--text-primary)

}

.announcement-full{
        background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    margin-top: 2rem;
    border: 1px solid var(--border-color);
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main {
    flex: 1 0 auto;
}

.footer {
    flex-shrink: 0;
}

/* ===== ПОДВАЛ ===== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-top: 3rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-left p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.social-links a {
    color: var(--text-muted);
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-flex;
}

.social-links a:hover {
    color: #2563eb;
    transform: translateY(-3px);
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    .social-links {
        justify-content: center;
    }
}

/* ===== ФИЛЬТРЫ (общий блок) ===== */
.filter-form {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1 1 200px;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.filter-group input[type="text"],
.filter-group input[type="date"] {
    padding: 0.7rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
    height: 42px; /* единая высота с кнопками */
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

/* Кнопки фильтрации одинакового размера */
.filter-btn {
    height: 42px;
    padding: 0 1.5rem;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

/* Адаптивность */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-group input {
        width: 100%;
    }
}





/* ===== DARK THEME OVERRIDES ===== */
[data-theme="dark"] .badge-active { background: #065f46; color: #d1fae5; }
[data-theme="dark"] .badge-inactive { background: #991b1b; color: #fee2e2; }
[data-theme="dark"] .badge-admin { background: #1e40af; color: #dbeafe; }
[data-theme="dark"] .badge-student { background: #374151; color: #e5e7eb; }
[data-theme="dark"] .alert-error { background: #7f1d1d; color: #fecaca; border-color: #991b1b; }
[data-theme="dark"] .markdown-body pre,
[data-theme="dark"] .markdown-body code { background: var(--bg-secondary); border-color: var(--border-color); }
[data-theme="dark"] ::selection { background: #3b82f6; color: white; }