/* Базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Переключатель тем */
.theme-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.theme-button {
    background: rgba(128, 128, 128, 0.3);
    border: 1px solid rgba(128, 128, 128, 0.5);
    color: inherit;
    padding: 5px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-button img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.theme-button:hover {
    background: rgba(128, 128, 128, 0.5);
}

.theme-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: inherit;
    border: 1px solid rgba(128, 128, 128, 0.5);
    border-radius: 8px;
    overflow: hidden;
    display: none;
    min-width: 120px;
    backdrop-filter: blur(10px);
}

.theme-dropdown.show {
    display: block;
}

.theme-option {
    padding: 0px 20px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-option img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.theme-option:hover {
    background: rgba(128, 128, 128, 0.3);
}

/* ТЕМА: УТРО (нежно-светло-жёлтая с бежевыми оттенками) */
body.theme-morning {
    background: linear-gradient(135deg, #FFF8E7 0%, #FFE4B5 50%, #F5DEB3 100%);
    color: #5D4E37;
}

body.theme-morning header {
    text-align: center;
    margin-bottom: 40px;
}

body.theme-morning h1 {
    color: #D2691E;
    text-shadow: none;
}

body.theme-morning h2 {
    color: #CD853F;
    border-bottom-color: rgba(205, 133, 63, 0.3);
}

body.theme-morning a {
    color: #D2691E;
}

body.theme-morning a:hover {
    color: #8B4513;
}

body.theme-morning .language-item {
    background: rgba(255, 248, 231, 0.8);
    border-color: rgba(210, 105, 30, 0.3);
}

body.theme-morning .language-item:hover {
    border-color: #D2691E;
    box-shadow: 0 0 20px rgba(210, 105, 30, 0.3);
}

body.theme-morning .flag {
    border-color: rgba(210, 105, 30, 0.3);
}

body.theme-morning .language-item:hover .flag {
    border-color: #D2691E;
}

body.theme-morning .language-name {
    color: #5D4E37;
}

body.theme-morning .back-link {
    color: #D2691E;
    background: rgba(210, 105, 30, 0.05);
    border-color: rgba(210, 105, 30, 0.3);
}

body.theme-morning .back-link:hover {
    color: #8B4513;
    background: rgba(210, 105, 30, 0.1);
    border-color: rgba(139, 69, 19, 0.6);
}

body.theme-morning .content p {
    color: #5D4E37;
}

body.theme-morning .content strong {
    color: #8B4513;
}

body.theme-morning .method-description {
    background: rgba(255, 248, 231, 0.8);
    border-left-color: #D2691E;
    border-color: rgba(210, 105, 30, 0.3);
}

body.theme-morning .method-description h2 {
    color: #D2691E;
}

body.theme-morning .method-description p {
    color: #5D4E37;
}

body.theme-morning .section {
    background: rgba(255, 248, 231, 0.8);
    border-color: rgba(210, 105, 30, 0.3);
}

body.theme-morning .section:hover {
    border-color: #D2691E;
}

body.theme-morning .section-title {
    color: #D2691E;
    border-bottom-color: rgba(210, 105, 30, 0.3);
}

body.theme-morning .article-list li::before {
    color: #D2691E;
}

body.theme-morning .article-list a {
    color: #5D4E37;
}

body.theme-morning .article-list a:hover {
    color: #D2691E;
}

body.theme-morning footer {
    background: rgba(245, 222, 179, 0.9);
    border-top-color: rgba(210, 105, 30, 0.2);
}

body.theme-morning .copyright {
    color: #8B7355;
}

body.theme-morning .social-link {
    color: #D2691E;
    border-color: rgba(210, 105, 30, 0.3);
    background: rgba(210, 105, 30, 0.05);
}

body.theme-morning .social-link:hover {
    color: #8B4513;
    border-color: rgba(139, 69, 19, 0.6);
}

/* ТЕМА: ДЕНЬ (светлая) */
body.theme-day {
    background: #ffffff;
    color: #333333;
}

body.theme-day header {
    text-align: center;
    margin-bottom: 40px;
}

body.theme-day h1 {
    color: #2c3e50;
    text-shadow: none;
}

body.theme-day h2 {
    color: #34495e;
    border-bottom-color: rgba(44, 62, 80, 0.3);
}

body.theme-day a {
    color: #3498db;
}

body.theme-day a:hover {
    color: #2980b9;
}

body.theme-day .language-item {
    background: rgba(236, 240, 241, 0.8);
    border-color: rgba(52, 152, 219, 0.3);
}

body.theme-day .language-item:hover {
    border-color: #3498db;
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.3);
}

body.theme-day .flag {
    border-color: rgba(52, 152, 219, 0.3);
}

body.theme-day .language-item:hover .flag {
    border-color: #3498db;
}

body.theme-day .language-name {
    color: #333333;
}

body.theme-day .back-link {
    color: #3498db;
    background: rgba(52, 152, 219, 0.05);
    border-color: rgba(52, 152, 219, 0.3);
}

body.theme-day .back-link:hover {
    color: #2980b9;
    background: rgba(52, 152, 219, 0.1);
    border-color: rgba(41, 128, 185, 0.6);
}

body.theme-day .content p {
    color: #333333;
}

body.theme-day .content strong {
    color: #2c3e50;
}

body.theme-day .method-description {
    background: rgba(236, 240, 241, 0.8);
    border-left-color: #3498db;
    border-color: rgba(52, 152, 219, 0.3);
}

body.theme-day .method-description h2 {
    color: #3498db;
}

body.theme-day .method-description p {
    color: #333333;
}

body.theme-day .section {
    background: rgba(236, 240, 241, 0.8);
    border-color: rgba(52, 152, 219, 0.3);
}

body.theme-day .section:hover {
    border-color: #3498db;
}

body.theme-day .section-title {
    color: #3498db;
    border-bottom-color: rgba(52, 152, 219, 0.3);
}

body.theme-day .article-list li::before {
    color: #3498db;
}

body.theme-day .article-list a {
    color: #333333;
}

body.theme-day .article-list a:hover {
    color: #3498db;
}

body.theme-day footer {
    background: rgba(236, 240, 241, 0.9);
    border-top-color: rgba(52, 152, 219, 0.2);
}

body.theme-day .copyright {
    color: #7f8c8d;
}

body.theme-day .social-link {
    color: #3498db;
    border-color: rgba(52, 152, 219, 0.3);
    background: rgba(52, 152, 219, 0.05);
}

body.theme-day .social-link:hover {
    color: #2980b9;
    border-color: rgba(41, 128, 185, 0.6);
}

/* ТЕМА: ВЕЧЕР (синяя, тёмная) */
body.theme-evening {
    background: #0a0a0a;
    color: #e0e0e0;
}

body.theme-evening::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 150, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(150, 0, 255, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    z-index: -2;
    pointer-events: none;
}

body.theme-evening::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(90deg, transparent 0%, rgba(0, 150, 255, 0.03) 50%, transparent 100%),
        linear-gradient(0deg, transparent 0%, rgba(150, 0, 255, 0.03) 50%, transparent 100%);
    background-size: 100px 100px;
    z-index: -1;
    pointer-events: none;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(100px, 100px); }
}

body.theme-evening header {
    text-align: center;
    margin-bottom: 60px;
}

body.theme-evening h1 {
    color: #00d4ff;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

body.theme-evening h2 {
    color: #00d4ff;
    border-bottom-color: rgba(0, 212, 255, 0.3);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

body.theme-evening a {
    color: #00d4ff;
}

body.theme-evening a:hover {
    color: #00ffff;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

body.theme-evening .language-item {
    background: rgba(20, 20, 40, 0.6);
    border-color: rgba(0, 212, 255, 0.3);
    backdrop-filter: blur(10px);
}

body.theme-evening .language-item:hover {
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

body.theme-evening .flag {
    border-color: rgba(0, 212, 255, 0.3);
}

body.theme-evening .language-item:hover .flag {
    border-color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
}

body.theme-evening .language-name {
    color: #e0e0e0;
}

body.theme-evening .back-link {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.05);
    border-color: rgba(0, 212, 255, 0.3);
}

body.theme-evening .back-link:hover {
    color: #00ffff;
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

body.theme-evening .content p {
    color: #d1d5db;
}

body.theme-evening .content strong {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

body.theme-evening .method-description {
    background: rgba(0, 212, 255, 0.05);
    border-left-color: #00d4ff;
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

body.theme-evening .method-description h2 {
    color: #00d4ff;
    text-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

body.theme-evening .method-description p {
    color: #d1d5db;
}

body.theme-evening .section {
    background: rgba(20, 20, 40, 0.6);
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
    backdrop-filter: blur(10px);
}

body.theme-evening .section:hover {
    background: rgba(20, 20, 40, 0.8);
    border-color: #00d4ff;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.2);
}

body.theme-evening .section-title {
    color: #00d4ff;
    border-bottom-color: rgba(0, 212, 255, 0.3);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

body.theme-evening .article-list li::before {
    color: #00d4ff;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}

body.theme-evening .article-list a {
    color: #d1d5db;
}

body.theme-evening .article-list a:hover {
    color: #00d4ff;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

body.theme-evening footer {
    background: rgba(10, 10, 10, 0.9);
    border-top-color: rgba(0, 212, 255, 0.2);
}

body.theme-evening .copyright {
    color: #888;
}

body.theme-evening .social-link {
    color: #00d4ff;
    border-color: rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.05);
}

body.theme-evening .social-link:hover {
    color: #00ffff;
    border-color: rgba(0, 255, 255, 0.6);
}

/* ТЕМА: НОЧЬ (инверсия дня - чёрный фон, белый текст) */
body.theme-night {
    background: #000000;
    color: #ffffff;
}

body.theme-night header {
    text-align: center;
    margin-bottom: 40px;
}

body.theme-night h1 {
    color: #ffffff;
    text-shadow: none;
}

body.theme-night h2 {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

body.theme-night a {
    color: #cccccc;
}

body.theme-night a:hover {
    color: #ffffff;
}

body.theme-night .language-item {
    background: rgba(30, 30, 30, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

body.theme-night .language-item:hover {
    border-color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

body.theme-night .flag {
    border-color: rgba(255, 255, 255, 0.3);
}

body.theme-night .language-item:hover .flag {
    border-color: #ffffff;
}

body.theme-night .language-name {
    color: #ffffff;
}

body.theme-night .back-link {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

body.theme-night .back-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
}

body.theme-night .content p {
    color: #e0e0e0;
}

body.theme-night .content strong {
    color: #ffffff;
}

body.theme-night .method-description {
    background: rgba(30, 30, 30, 0.8);
    border-left-color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

body.theme-night .method-description h2 {
    color: #ffffff;
}

body.theme-night .method-description p {
    color: #e0e0e0;
}

body.theme-night .section {
    background: rgba(30, 30, 30, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

body.theme-night .section:hover {
    border-color: #ffffff;
}

body.theme-night .section-title {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

body.theme-night .article-list li::before {
    color: #ffffff;
}

body.theme-night .article-list a {
    color: #e0e0e0;
}

body.theme-night .article-list a:hover {
    color: #ffffff;
}

body.theme-night footer {
    background: rgba(0, 0, 0, 0.9);
    border-top-color: rgba(255, 255, 255, 0.2);
}

body.theme-night .copyright {
    color: #888;
}

body.theme-night .social-link {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

body.theme-night .social-link:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.6);
}

/* Общие стили для всех тем */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    flex: 1;
    width: 100%;
}

.languages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.language-item {
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.flag {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 15px;
    object-fit: cover;
    transition: all 0.3s ease;
}

.language-item:hover .flag {
    transform: scale(1.1);
}

.language-item a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.language-name {
    font-size: 18px;
    font-weight: 400;
    line-height: 1.6;
    margin-top: 10px;
}

.back-link {
    display: inline-block;
    margin-bottom: 25px;
    text-decoration: none;
    font-weight: 400;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 6px;
}

.content {
    margin-top: 35px;
}

.content h2 {
    font-size: 2em;
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.content p {
    margin-bottom: 20px;
    text-align: justify;
    font-size: 1.1em;
    line-height: 1.8;
}

.content a {
    text-decoration: underline;
    font-weight: 400;
    transition: all 0.3s ease;
}

.content strong {
    font-weight: 600;
}

.content ol {
    margin-left: 30px;
    margin-bottom: 20px;
}

.content ol li {
    margin-bottom: 10px;
}

.method-description {
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 40px;
    border-left-width: 4px;
    border-left-style: solid;
}

.method-description h2 {
    font-size: 2em;
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.method-description p {
    margin-bottom: 18px;
    text-align: justify;
    font-size: 1.1em;
    line-height: 1.8;
}

.method-description a {
    text-decoration: none;
    font-weight: 400;
    transition: all 0.3s ease;
    padding-bottom: 2px;
}

.contents {
    margin-top: 40px;
}

.contents > h2 {
    font-size: 2.4em;
    margin-bottom: 30px;
    padding-bottom: 15px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section {
    margin-bottom: 35px;
    padding: 25px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.section-title {
    font-size: 1.6em;
    font-weight: 400;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom-width: 2px;
    border-bottom-style: solid;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-title.no-link {
    color: inherit;
}

.article-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-list li {
    margin-bottom: 12px;
    padding-left: 25px;
    position: relative;
    transition: transform 0.2s ease;
}

.article-list li:hover {
    transform: translateX(5px);
}

.article-list li::before {
    content: "▸";
    position: absolute;
    left: 0;
    font-weight: bold;
    font-size: 1.1em;
}

.article-list a {
    text-decoration: none;
    font-size: 1.05em;
    transition: all 0.3s ease;
    display: inline-block;
    padding: 4px 0;
}

.article-list a:hover {
    transform: translateX(3px);
}

footer {
    padding: 30px 20px;
    margin-top: auto;
    text-align: center;
    border-top-width: 1px;
    border-top-style: solid;
}

.copyright {
    font-size: 14px;
    margin-bottom: 20px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border-width: 1px;
    border-style: solid;
    transition: transform 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.social-link:hover {
    transform: scale(1.1);
}

.social-link img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: brightness(0.85);
    transition: filter 0.3s ease;
}

.social-link:hover img {
    filter: brightness(1);
}

/* Адаптивность */
@media (max-width: 768px) {
    .languages-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .container {
        padding: 20px 15px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .contents > h2 {
        font-size: 2em;
    }
    
    .section {
        padding: 20px;
    }
    
    .method-description {
        padding: 25px;
    }
    
    .content h2 {
        font-size: 1.6em;
    }
    
    .content p {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 24px;
    }
    
    .container {
        padding: 15px 10px;
    }
    
    .contents > h2 {
        font-size: 1.8em;
    }
}
