/* ============================================
   БАЗОВЫЕ СТИЛИ И ПЕРЕМЕННЫЕ
   ============================================ */
:root {
    --primary-color: #4a90e2;
    --primary-dark: #357ab8;
    --accent-color: #e94560;
    --dark-bg: #1a1a2e;
    --dark-secondary: #16213e;
    --text-light: #e0e0e0;
    --text-dark: #333;
    --white: #ffffff;
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.15);
    --shadow-lg: 0 6px 20px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: Arial, sans-serif;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    color: var(--text-dark);
}

/* ============================================
   КОНТЕЙНЕРЫ
   ============================================ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    background: #adadad;
    border-radius: var(--radius-lg);
    text-align: center;
}

/* ============================================
   ХЕДЕР
   ============================================ */
header {
    position: relative;
    width: calc(100% - 10px);
    background: var(--white);
    padding: 1rem 0;
    margin: 5px 5px 2rem 5px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    min-height: 180px;
}

.header-background,
.main-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    border-radius: var(--radius-lg);
}

header .container {
    position: relative;
    z-index: 10;
    background: transparent;
    padding: 15px;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    color: #0014ff;
}

.logo-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.site-logo {
    height: 120px;
    width: auto;
    border-radius: var(--radius-lg);
    margin: 10px;
    transition: var(--transition);
    box-shadow: 0 2px 15px rgba(0,0,0,0.4);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    padding: 5px;
}

.site-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* ============================================
   НАВИГАЦИЯ
   ============================================ */
.dropdown-menu ul {
    list-style: none;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.dropdown-menu li {
    position: relative;
}

.dropdown-menu a {
    display: block;
    padding: 10px 18px;
    text-decoration: none;
    color: black;
    background-color: var(--white);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    white-space: nowrap;
    font-weight: bold;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-sm);
}

.dropdown-menu a:hover {
    background-color: rgba(53, 122, 184, 0.9);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.submenu {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.95);
    min-width: 180px;
    box-shadow: 0px 4px 15px rgba(0,0,0,0.25);
    z-index: 1000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,0,0,0.1);
    margin-top: 5px;
}

.menu-item:hover .submenu {
    display: block !important;
}

.submenu li a {
    padding: 12px 15px;
    color: var(--text-dark);
    background: transparent;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    white-space: nowrap;
    text-align: left;
}

.submenu li:last-child a {
    border-bottom: none;
}

.submenu li a:hover {
    background-color: rgba(74, 144, 226, 0.1);
    color: var(--primary-color);
}

/* ============================================
   ОСНОВНОЙ КОНТЕНТ
   ============================================ */
main {
    position: relative;
    width: calc(100% - 10px);
    margin: 0 5px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    min-height: 500px;
    padding: 20px 0;
}

main > .container {
    position: relative;
    z-index: 10;
    background: rgba(89, 170, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
}

main section,
main #map-container,
main > h3,
#news-container {
    position: relative;
    z-index: 15;
}

main > h3 {
    color: var(--white);
    text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    padding: 15px 30px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 255, 255, 0.3);
    font-size: 1.8rem;
    margin: 20px 0;
}

/* ============================================
   ФОРМЫ И СЕКЦИИ ВХОДА
   ============================================ */
#login-section,
#logout-section,
#featured-news {
    background: rgba(74, 144, 226, 0.9);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 20px;
}

#login-section,
#logout-section {
    max-width: 350px;
    margin: 1rem auto;
    padding: 1.5rem;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: opacity 0.3s ease, visibility 0.3s ease, height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
}

#featured-news {
    max-width: 700px;
    margin: clamp(10px, 4vw, 40px);
    background: var(--white);
}

form {
    max-width: 320px;
    margin: 20px auto;
    padding: 20px;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

main form {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    padding: 25px;
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #ddd;
    border-radius: 4px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74,144,226,0.2);
}

/* ============================================
   КАРТА
   ============================================ */
#map-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 800px;
    height: 400px;
    margin: 20px auto;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 15px;
}

#map {
    width: 100%;
    height: 100%;
}

/* ============================================
   ХЭШТЕГИ
   ============================================ */
#hashtags-section {
    margin: 2rem auto;
    padding: 1.5rem;
    background: var(--primary-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    max-width: 800px;
    text-align: center;
}

.hashtags-container,
.post-hashtags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin: 1rem 0;
}

.hashtag {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--white), #86c1ff);
    color: black;
    border-radius: 25px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.hashtag:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.hashtag.active {
    background: linear-gradient(135deg, #5aa0e6, var(--primary-color));
    border-color: var(--primary-dark);
}

.hashtag-count {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-left: 0.4rem;
    background: rgba(255,255,255,0.2);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
}

.post-hashtag {
    display: inline-flex;
    margin: 5px;
    background: #e4efff;
    color: black;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-decoration: none;
    border: 1px solid var(--primary-color);
}

.post-hashtag:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* ============================================
   КНОПКИ
   ============================================ */
button, .btn-primary, .btn-create, .read-more-btn, .share-btn {
    padding: 12px 20px;
    background: black;
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    margin: 5px;
    font-weight: bold;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-sm);
}

button:hover, .btn-primary:hover, .btn-create:hover, .read-more-btn:hover, .share-btn:hover {
    background: rgba(53, 122, 184, 0.9);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary, .back-btn {
    background: rgba(108, 117, 125, 0.85);
    color: var(--white);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover, .back-btn:hover {
    background: rgba(84, 91, 98, 0.9);
    transform: translateY(-2px);
}

.btn-logout {
    background: rgba(220, 53, 69, 0.85);
    color: var(--white);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-logout:hover {
    background: rgba(200, 35, 51, 0.9);
    transform: translateY(-2px);
}

/* ============================================
   НОВОСТИ (ЛЕНТА)
   ============================================ */
#news-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.news-item,
.news-card {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    padding: 25px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.news-item:hover,
.news-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

main .news-item,
main .news-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
    font-size: 0.9rem;
    color: #666;
}

.news-image {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 6px;
    margin: 1rem 0;
}

/* ============================================
   СТРАНИЦА ПОСТА
   ============================================ */
.post-full {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    max-width: 900px;
    margin: 0 auto;
}

.post-title {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 20px;
    line-height: 1.3;
    word-wrap: break-word;
}

.post-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.post-image {
    display: block;
    margin: 0 0 30px 0;
    text-align: center;
}

.post-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-dark);
    margin: 0 0 30px 0;
    clear: both;
}

.video-container {
    position: relative;
    width: 100%;
    margin: 20px 0 30px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    clear: both;
}

.video-container iframe,
.video-container video {
    width: 100%;
    display: block;
}

.video-container iframe {
    aspect-ratio: 16/9;
    border: none;
}

.post-tags {
    margin: 30px 0 20px;
    padding: 15px 0;
    clear: both;
}

.tag {
    display: inline-block;
    background: #f0f0f0;
    padding: 5px 12px;
    margin: 5px 5px 0 0;
    border-radius: 20px;
    text-decoration: none;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.tag:hover {
    background: var(--primary-color);
    color: var(--white);
}

.post-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    clear: both;
}

/* ============================================
   ПАНЕЛЬ АВТОРИЗАЦИИ
   ============================================ */
.auth-compact {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.auth-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #0099ff;
    color: var(--white);
    border: 2px solid var(--white);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: var(--transition);
}

.auth-toggle:hover {
    background: #0008ff;
    transform: scale(1.1);
}

.auth-panel {
    position: absolute;
    top: 60px;
    right: 0;
    width: 280px;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.auth-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    animation: fadeIn 0.3s ease forwards;
}

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

.auth-panel .user-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-panel .user-actions button,
.auth-panel .user-actions a {
    width: 100%;
    padding: 10px;
    text-align: center;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition);
}

.auth-panel .user-actions button {
    background: #dc3545;
    color: var(--white);
    border: none;
    cursor: pointer;
}

.auth-panel .user-actions button:hover {
    background: #c82333;
}

.auth-panel .user-actions a {
    background: #007bff;
    color: var(--white);
}

.auth-panel .user-actions a:hover {
    background: #0056b3;
}

/* ============================================
   БЕГУЩАЯ СТРОКА (РАБОЧАЯ ВЕРСИЯ)
   ============================================ */
#news-ticker-container {
    width: 100% !important;
    margin-bottom: 20px !important;
    position: relative !important;
    z-index: 100 !important;
    overflow: visible !important;
}

#news-ticker-container > div {
    width: 100% !important;
    max-width: none !important;
}

/* ============================================
   ПАГИНАЦИЯ И СТАТУСЫ
   ============================================ */
#pagination {
    position: relative;
    z-index: 15;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-top: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.loading-spinner {
    text-align: center;
    padding: 3rem;
    font-size: 1.1rem;
    color: #666;
}

.error-message {
    text-align: center;
    padding: 3rem;
    color: #dc3545;
    font-size: 1.1rem;
}

/* ============================================
   ФУТЕР
   ============================================ */
footer {
    width: calc(100% - 10px);
    background: var(--white);
    padding: 1rem 0;
    margin: 2rem 5px 0 5px;
    text-align: center;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

footer .container {
    color: black;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */
@media (max-width: 768px) {
    header {
        min-height: 150px;
        padding: 0.5rem 0;
    }
    
    .logo-title {
        flex-direction: column;
        padding: 15px;
    }
    
    .site-logo {
        height: 80px;
    }
    
    .dropdown-menu ul {
        gap: 8px;
    }
    
    .dropdown-menu a {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .news-item,
    .news-card {
        max-width: 95%;
        padding: 18px;
    }
    
    .post-title {
        font-size: 1.5rem;
    }
    
    .post-full {
        padding: 20px;
    }
    
    .post-content {
        font-size: 1rem;
    }
    
    main {
        min-height: 400px;
        padding: 15px 0;
    }
    
    main > .container {
        padding: 15px;
        border-radius: var(--radius-lg);
    }
    
    main > h3 {
        font-size: 1.5rem;
        padding: 12px 20px;
    }
    
    .auth-compact {
        top: 10px;
        right: 10px;
    }
    
    .auth-panel {
        width: 250px;
    }
}

@media (max-width: 480px) {
    .post-full {
        padding: 15px;
    }
    
    .post-title {
        font-size: 1.3rem;
    }
    
    main > h3 {
        font-size: 1.3rem;
        padding: 10px 15px;
    }
    
    .news-item,
    .news-card {
        padding: 15px;
    }
}