/* css/codes.css */

/* === Общая структура === */
.codes-main {
    padding-top: 120px;
    padding-bottom: 40px;
}

.codes-main .container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 40px;
}

.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.codes-main h1 {
    font-size: 2rem;
    color: var(--text-color);
    margin: 0;
}

#searchInput {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    width: 250px;
}

#searchInput::placeholder {
    color: var(--text-secondary);
}

/* === Сетка кодов === */
.codes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 30px;
}

.code-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    min-height: 450px; /* Увеличенная высота */
    overflow: hidden; /* Убираем скроллы */
}

.code-card h3 {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 15px;
    text-align: center;
}

.code-card pre {
    flex: 1;
    margin: 0;
    padding: 10px;
    background: var(--secondary-color);
    border-radius: 8px;
    overflow: hidden; /* Убираем скроллы */
    font-size: 1.3rem;
    line-height: 1.7;
    white-space: pre-wrap; /* Чтобы текст переносился */
}

.code-card code {
    font-family: 'Courier New', monospace;
    color: var(--text-color);
}

.copy-btn {
    margin-top: 15px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    align-self: center;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Адаптивность */
@media (max-width: 768px) {
    .codes-grid {
        grid-template-columns: 1fr;
    }
    .header-section {
        flex-direction: column;
        gap: 15px;
    }
    #searchInput {
        width: 100%;
    }
}