/* Сброс стилей и базовые настройки */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Основные переменные цветов - технологическая палитра */
:root {
    --primary-color: #2C3E50;      /* Темно-синий */
    --secondary-color: #3498DB;    /* Синий */
    --accent-color: #1ABC9C;       /* Бирюзовый */
    --background-light: #ECF0F1;   /* Светло-серый */
    --background-dark: #BDC3C7;    /* Серый */
    --text-dark: #2C3E50;         /* Темно-синий */
    --text-light: #7F8C8D;        /* Средне-серый */
    --border-color: #95A5A6;      /* Серый */
    --shadow-color: rgba(44, 62, 80, 0.1);
    --code-bg: #1E1E1E;           /* Темный фон для кода */
    --code-text: #D4D4D4;         /* Светлый текст для кода */
}

/* Основные стили для body */
body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--background-light) 0%, var(--background-dark) 100%);
    min-height: 100vh;
}

/* Стили для header и навигации */
header {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    box-shadow: 0 2px 10px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-menu {
    list-style: none;
    display: flex;
    justify-content: center;
    padding: 1rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    transition: all 0.3s ease;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.nav-menu a.active {
    background: var(--accent-color);
    color: white;
}

/* Стили для главного контейнера */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Hero секция */
.hero {
    text-align: center;
    padding: 3rem 1rem;
    background: white;
    border-radius: 20px;
    box-shadow: 0 5px 20px var(--shadow-color);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
    opacity: 0.05;
}

.hero h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    position: relative;
}

.hero h2 {
    font-size: 1.8rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    position: relative;
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
    position: relative;
}

/* Стили для контента */
.content article {
    background: white;
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 15px;
    box-shadow: 0 3px 15px var(--shadow-color);
    transition: transform 0.3s ease;
}

.content article:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px var(--shadow-color);
}

.content h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.content p {
    margin-bottom: 1rem;
    color: var(--text-light);
    line-height: 1.8;
}

.content ol, .content ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.content li {
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

/* Сетка элементов */
.elements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.element-card {
    background: linear-gradient(135deg, #f5f7fa, white);
    padding: 1.5rem;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.element-card:hover {
    border-color: var(--accent-color);
    transform: scale(1.05);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.element-card h4 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

/* Пример кода */
.code-example {
    background: var(--code-bg);
    border-radius: 10px;
    padding: 1.5rem;
    overflow-x: auto;
    margin-top: 1rem;
    box-shadow: 0 3px 10px var(--shadow-color);
    max-width: 100%;
    /* Защита от копирования */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.code-example pre {
    margin: 0;
    overflow-x: auto;
    max-width: 100%;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.code-example code {
    color: var(--code-text);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    display: block;
    white-space: pre;
    word-wrap: normal;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Подсветка синтаксиса */
.code-example .comment {
    color: #6A9955;
}

.code-example .keyword {
    color: #569CD6;
}

.code-example .string {
    color: #CE9178;
}

.code-example .function {
    color: #DCDCAA;
}

/* Сообщение при попытке копирования */
.code-example::after {
    content: '📝 Код защищен от копирования. Пожалуйста, введите вручную для лучшего запоминания.';
    display: none;
    position: absolute;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.9rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    white-space: nowrap;
}

.code-example:hover::after {
    display: block;
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* Список ресурсов */
.resources-list {
    list-style: none;
    margin-left: 0;
}

.resources-list li {
    background: linear-gradient(135deg, #f5f7fa, white);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    transition: all 0.3s ease;
}

.resources-list li:hover {
    background: linear-gradient(135deg, white, #f5f7fa);
    border-left-color: var(--secondary-color);
    transform: translateX(5px);
}

.resources-list a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.resources-list a:hover {
    text-decoration: underline;
}

/* Секция features */
.features {
    margin-top: 3rem;
}

.features h3 {
    text-align: center;
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 3px 15px var(--shadow-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.feature:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px var(--shadow-color);
}

.feature-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.feature h4 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.feature p {
    color: var(--text-light);
}

/* Footer */
footer {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-content {
    text-align: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-content p {
    margin-bottom: 0.5rem;
    color: white;
}

/* Адаптивность */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero h2 {
        font-size: 1.5rem;
    }
    
    .nav-menu {
        flex-direction: column;
        align-items: center;
    }
    
    .nav-menu li {
        margin: 0.5rem 0;
    }
    
    main {
        padding: 1rem;
    }
    
    .content article {
        padding: 1.5rem;
    }
    
    .elements-grid {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
}

/* Анимации при загрузке */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero, .content article, .feature {
    animation: fadeIn 0.6s ease-out;
}

.content article:nth-child(2) {
    animation-delay: 0.2s;
}

.content article:nth-child(3) {
    animation-delay: 0.4s;
}

.content article:nth-child(4) {
    animation-delay: 0.6s;
}

/* Кастомная полоса прокрутки */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--code-bg);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--secondary-color), var(--primary-color));
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-color), var(--accent-color));
}

/* Угол между вертикальным и горизонтальным скроллбаром */
::-webkit-scrollbar-corner {
    background: var(--code-bg);
}

/* Специально для блоков кода */
.code-example::-webkit-scrollbar-track {
    background: var(--code-bg);
}

.code-example::-webkit-scrollbar-corner {
    background: var(--code-bg);
}