/* ==========================================================================
    3.1. ОСНОВНЫЕ КОМПОНЕНТЫ (шапка, карточки, кнопки, формы)
    ========================================================================== */

/* --- ШАПКА --- */
.site-header {
    background: var(--bg-header);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 100;
}
.site-header .container {
    overflow: visible;
}
html.light-theme .site-header {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.site-header .logo {
    height: 50px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    border-radius: 5px;
}
.site-header .logo img {
    height: 100%;
    width: auto;
    display: block;
    transition: filter 0.3s ease;
}
html.dark-theme .site-header .logo img {
    filter: drop-shadow(0 0 15px rgba(200, 220, 255, 0.4));
}
.site-header nav ul {
    padding: 0;
    margin: 0;
    list-style: none;
    display: flex;
}
.site-header nav ul li {
    margin-left: 5px;
}
.site-header nav ul li a {
    display: block;
    padding: 8px 15px;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
    font-weight: 500;
    color: var(--header-text);
    text-transform: uppercase;
    text-decoration: none;
}
.site-header nav ul li a:hover {
    background-color: var(--accent-blue);
    color: #fff;
}
.site-header nav ul li.active a {
    background-color: var(--accent-blue);
    color: #fff;
}
.header-right-side {
    display: flex;
    align-items: center;
    gap: 15px;
}
.site-header .mobile-nav-toggle {
    display: none;
}

/* --- ПОИСК В ШАПКЕ --- */
.header-search {
    position: relative;
    display: flex;
    align-items: center;
}
.header-search-container {
    display: block;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    z-index: 101;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}
.header-search-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.header-search-form {
    background: var(--bg-header);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    /* Новая красивая тень с голубым подсветом */
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.12),
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 0 20px color-mix(in srgb, var(--accent-blue) 20%, transparent);
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
    transition: box-shadow 0.3s ease;
}

/* Лёгкая анимация при наведении */
.header-search-form:hover {
    box-shadow:
        0 6px 14px rgba(0, 0, 0, 0.15),
        0 12px 28px rgba(0, 0, 0, 0.1),
        0 0 25px color-mix(in srgb, var(--accent-blue) 35%, transparent);
}
.header-search-form input[type="search"] {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 15px;
    border-radius: 6px;
    width: 100%;
    font-size: 1em;
}
.header-search-form input[type="search"]:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue) 25%, transparent);
    outline: none;
}
.search-option {
    display: flex;
    align-items: center;
    font-size: 0.9em;
}
.search-option input[type="checkbox"] {
    margin-right: 8px;
    width: auto;
}
.search-option label {
    color: var(--text-secondary);
    cursor: pointer;
}
.search-option input[type="checkbox"]:disabled + label {
    cursor: default;
    opacity: 0.7;
}

/* --- ИКОНКИ И ПЕРЕКЛЮЧАТЕЛИ --- */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--header-icon);
    cursor: pointer;
    font-size: 18px;
    width: 32px;
    height: 32px;
}
#theme-toggle .fa-sun { display: none; }
#theme-toggle .fa-moon { display: block; }
#theme-toggle.is-light .fa-sun { display: block; }
#theme-toggle.is-light .fa-moon { display: none; }

/* --- ОБЩИЕ СТИЛИ КАРТОЧЕК --- */
.slider-card, .news-card-square, .news-card-long, .contact-card, .department-info-box, .search-page-form, .no-results, .page-card, .forum-user-panel, .section-header, .topics-table, .forum-post, .method-header, .shichko-bio-section, .tab-intro, .content-section, .resources-page-header, .resource-card, .reply-form-container, .poll-container {
    background: var(--bg-cards);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
html.light-theme .slider-card, html.light-theme .news-card-square, html.light-theme .news-card-long, html.light-theme .contact-card, html.light-theme .department-info-box, html.light-theme .search-page-form, html.light-theme .no-results, html.light-theme .page-card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.slider-card h3, .news-card-square h3 {
    color: var(--text-primary);
}
.slider-card a:hover h3 {
    color: var(--accent-blue);
}
.contact-card .contact-details, .department-info-box p, .page-card p {
    color: var(--text-secondary);
}
.contact-card .contact-details strong {
    color: var(--text-primary);
}
.actions-container, .contact-card .admin-actions {
    border-top: 1px solid var(--border-color);
}
.news-date {
    font-size: 0.9em;
    color: #888;
    margin-bottom: 10px;
    display: block;
}

/* --- КАРТОЧКИ НОВОСТЕЙ --- */
.news-card-square, .news-card-long {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.news-card-square img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: all 0.4s ease-in-out;
}
.news-card-square:hover img {
    transform: scale(1.1);
}
.news-card-square .content {
    padding: 15px;
    transition: all 0.4s ease-in-out;
}
.news-card-square:hover .content {
    transform: scale(1.05);
}
.news-card-long {
    position: relative;
    align-items: flex-end;
    min-height: 250px;
}
.news-card-long .card-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    transition: all 0.4s ease-in-out;
}
.news-card-long:hover .card-bg {
    transform: scale(1.1);
}
.news-card-long .title-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
    padding: 20px 15px 15px 15px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    transition: all 0.4s ease-in-out;
}
.news-card-long:hover .title-overlay {
    transform: scale(1.05);
}
.news-card-long h3, .news-card-square h3 {
    margin: 0;
    font-size: 1.2em;
}
.news-card-long .title-overlay h3, .news-card-long .title-overlay .news-date {
    color: #fff !important;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
}
.news-card-long:hover, .news-card-square:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.news-card-square .content .news-date {
    margin-bottom: 5px;
}
.news-card-long .title-overlay .news-date {
    font-size: 0.8em;
    margin-bottom: 5px;
}

/* --- СЛАЙДЕР НОВОСТЕЙ --- */
.news-slider-wrapper {
    position: relative;
    padding-bottom: 20px;
}
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.slider-header h2 {
    margin: 0;
}
.news-slider {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 20px;
}
.slider-card {
    flex: 0 0 280px;
    overflow: hidden;
}
.slider-card a {
    text-decoration: none;
    display: block;
    overflow: hidden;
}
.slider-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    transition: all 0.4s ease-in-out;
}
.slider-card a:hover img {
    transform: scale(1.1);
}
.slider-card h3 {
    font-size: 1.1em;
    padding: 15px 15px 5px 15px;
    margin: 0;
    transition: all 0.4s ease-in-out;
}
.slider-card .news-date {
    transition: all 0.4s ease-in-out;
    padding: 0 15px 10px;
    font-size: 0.8em;
}
.slider-card a:hover h3, .slider-card a:hover .news-date {
    transform: scale(1.05);
}

/* --- КНОПКИ --- */
.btn-search {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    padding: 10px;
    width: 100%;
    font-weight: 500;
    transition: background-color 0.2s;
}
.btn-search:hover {
    background-color: var(--accent-hover);
}
.actions-container a, .admin-actions a, a.btn-add, a.btn-edit, a.btn-delete, a.btn-share, .login-btn, a.btn-manage {
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 6px;
    color: #fff;
    display: inline-block;
    font-weight: 500;
}
a.btn-edit, .btn-edit { background: #ffc107; color: #212529; }
a.btn-delete, .btn-delete { background: #dc3545; }
a.btn-share, .btn-share { background: #6c757d; }
a.btn-add, .btn-add { background: var(--accent-blue); color: #fff; padding: 10px 20px; border-radius: 6px; margin-bottom: 20px; }
a.btn-manage { background: var(--accent-blue); color: #fff; margin-bottom: 30px; }
.all-news-btn {
    background: var(--accent-blue);
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.3s;
    flex-shrink: 0;
}
.all-news-btn:hover {
    background: var(--accent-hover);
}
.login-btn {
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue) !important;
}
.login-btn:hover {
    background-color: var(--accent-blue);
    color: #fff !important;
}
.card-share-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(13, 110, 253, 0.8);
}
.news-card-square:hover .card-share-btn, .news-card-long:hover .card-share-btn {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}
.card-share-btn:hover {
    transform: scale(1.1) !important;
    background: rgba(13, 110, 253, 1);
}

/* --- МОДАЛЬНЫЕ ОКНА --- */
.share-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.share-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.share-modal-content {
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    position: relative;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    background: var(--bg-cards);
    border: 1px solid var(--border-color);
}
.share-modal-overlay.active .share-modal-content {
    transform: scale(1);
}
.share-modal-content h3 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.5em;
    color: var(--text-primary);
}
.share-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    border: none;
    background: none;
    cursor: pointer;
    transition: color 0.2s;
    color: #aaa;
}
.share-modal-close:hover {
    color: var(--accent-blue);
}
.share-icons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 25px;
}
.share-icon {
    font-size: 28px;
    color: #fff;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s ease;
}
.share-icon:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.share-icon.vk { background: #4a76a8; }
.share-icon.ok { background: #ee8208; }
.share-icon.tg { background: #24a1de; }
.share-icon.wa { background: #25d366; }
.share-subtitle {
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.share-link-container {
    display: flex;
    margin-top: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
}
.share-link-container input {
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    border: none;
    flex-grow: 1;
    padding: 10px 15px;
}
.share-link-container input:focus {
    outline: none;
}
.share-link-container button {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    padding: 0 18px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}
.share-link-container button:hover {
    background: var(--accent-hover);
}

/* --- КОНТАКТЫ --- */
.contact-card {
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 20px;
    gap: 20px;
    transition: all 0.3s ease;
}
.contact-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
.contact-card img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid var(--accent-blue);
}
.contact-card .card-content-wrapper {
    display: flex;
    flex-direction: column;
    text-align: left;
    width: 100%;
}
.contact-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.4em;
    color: var(--text-primary);
}
.contact-card .contact-details {
    font-size: 0.9em;
    margin-bottom: 15px;
}
.contact-card .contact-details p {
    margin: 4px 0;
    word-wrap: break-word;
}
.contact-card .admin-actions {
    margin-top: auto;
    padding-top: 10px;
    width: 100%;
}

/* --- СТРАНИЦА НОВОСТИ --- */
.latest-news-full, .single-news {
    background: var(--bg-cards);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px 40px;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 40px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}
.latest-news-full h1, .single-news h1 {
    font-size: 2.4em;
    margin-bottom: 10px;
    line-height: 1.2;
    text-align: center;
}
.latest-news-full .news-date, .single-news .news-date {
    margin-bottom: 30px;
    text-align: center;
    display: block;
}
.latest-news-image-wrapper, .single-news-image-wrapper {
    display: block;
    margin: 0 auto 30px auto;
    border: 4px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    max-width: 700px;
}
.latest-news-image-wrapper img, .single-news-image-wrapper img {
    display: block;
    width: 100%;
}
.latest-news-full .content, .single-news-content {
    font-size: 1.1em;
    line-height: 1.8;
    color: var(--text-primary);
    max-width: 75ch;
    margin-left: auto;
    margin-right: auto;
}
.latest-news-full .content p, .single-news-content p {
    margin-bottom: 1.5em;
}
.latest-news-full .content strong, .single-news-content strong {
    color: var(--text-primary);
}
.latest-news-full .content a, .single-news-content a {
    color: var(--accent-blue);
    text-decoration: underline;
}

/* --- ФОРМЫ --- */
.form-container {
    background: var(--bg-cards);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
}
.form-group input, .form-group textarea, .form-group select {
    background: var(--bg-main);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-sizing: border-box;
    padding: 10px;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue) 25%, transparent);
    outline: none;
}
.form-group textarea {
    height: 150px;
}
.form-group button {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    padding: 12px;
    width: 100%;
    font-weight: 500;
    transition: background-color 0.2s, opacity 0.2s;
}
.form-group button:hover {
    background-color: var(--accent-hover);
}
.form-group button:disabled {
    background-color: var(--text-secondary);
    opacity: 0.6;
    cursor: not-allowed;
}
.form-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border: 1px solid #badbcc;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}
.form-error {
    color: #842029;
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}
.form-divider {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 30px 0;
}
.form-container .btn-delete {
    background-color: #dc3545;
    width: 100%;
}
.form-container .btn-delete:hover {
    background-color: #bb2d3b;
}
.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}
.form-group-checkbox label {
    margin-bottom: 0;
    font-size: 0.9em;
    color: var(--text-secondary);
}
.form-group-checkbox a {
    color: var(--accent-blue);
    text-decoration: underline;
}
.privacy-policy-group {
    margin-bottom: 1rem;
}

/* --- СТРАНИЦА ПОИСКА --- */
.search-page-form {
    padding: 20px;
    margin-bottom: 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}
.search-page-form .form-group {
    flex-grow: 1;
    margin-bottom: 0;
}
.search-page-form .form-group:last-child {
    flex-grow: 0;
}
.search-page-form button {
    width: auto;
}
.search-results-list .news-item {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 20px;
    background: var(--bg-cards);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.search-results-list .search-result-image {
    width: 200px;
    height: 120px;
    object-fit: cover;
    flex-shrink: 0;
}
.search-results-list .news-item-content {
    flex-grow: 1;
    padding: 15px;
}
.search-results-list .news-item-content .rendered-content {
    max-height: 60px;
    overflow: hidden;
    position: relative;
    color: var(--text-secondary);
}
.search-results-list .news-item-content .rendered-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20px;
    background: linear-gradient(to top, var(--bg-cards), transparent);
}
.no-results {
    padding: 30px;
    text-align: center;
}
.search-results-container h2 {
    margin-bottom: 20px;
}
.search-results-container mark {
    background-color: var(--accent-blue);
    color: #fff;
    padding: 2px 0;
}

/* --- СТРАНИЦА ВХОДА (ADMIN) --- */
.login-page-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    transition: background-color 0.3s;
}
.login-form {
    max-width: 400px;
    width: 100%;
}
html.light-theme .login-page-body {
    background-color: #e9ebee;
}
html.light-theme .login-page-body .form-container {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
html.light-theme .login-page-body .form-group input {
    background: #f1f4f6;
    border-color: #ccc;
}

/* --- НАЧАЛО ИЗМЕНЕНИЙ: СТИЛИ ДЛЯ COOKIE BANNER --- */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    padding: 15px;
    display: none; /* Изначально скрыт, управляется JS */
    transform: translateY(100%); /* Начальное положение за экраном */
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}
.cookie-consent-banner.show {
    transform: translateY(0); /* Конечное положение на экране */
}
.cookie-consent-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 25px;
    background-color: var(--bg-cards-translucent, rgba(31, 41, 55, 0.9)); /* Полупрозрачный фон */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    backdrop-filter: blur(10px); /* Эффект размытия для современных браузеров */
    -webkit-backdrop-filter: blur(10px);
}
.cookie-consent-content p {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.9em;
    flex-grow: 1;
}
.cookie-consent-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}
.btn-cookie {
    padding: 8px 18px;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-size: 0.9em;
    transition: background-color 0.2s, color 0.2s;
}
.btn-cookie-details {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-cookie-details:hover {
    background-color: var(--bg-main);
    color: var(--text-primary);
}
.btn-cookie-accept {
    background-color: var(--accent-blue);
    color: #fff;
}
.btn-cookie-accept:hover {
    background-color: var(--accent-hover);
}
/* --- КОНЕЦ ИЗМЕНЕНИЙ --- */
