/* Сброс */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    padding: 20px;
    line-height: 1.6;
}

/* === Верхняя панель (фиксированная) === */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.search-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    max-width: 80%;
}

.search-container input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}

.btn-add {
    margin-left: auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2e7d32;
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-menu {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #555;
}

/* Чтобы dropdown позиционировался относительно контейнера кнопки */
.menu-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 40px;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    list-style: none;
    width: 180px;
    padding: 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: none;
}

/* Открытие по классу .show (по клику) */
.dropdown-menu.show {
    display: block;
}

/* Дополнительно можно открыть по hover, если нужно такое поведение */
.menu-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu li a {
    display: block;
    padding: 8px 16px;
    text-decoration: none;
    color: #333;
}

.dropdown-menu li a:hover {
    background: #f0f0f0;
}

/* === ГАЛЕРЕЯ КАРТОЧЕК === */
.main-content {
    margin-top: 60px;
    padding: 20px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); /* обновлено */
    gap: 20px;
    row-gap: 30px;
    padding-bottom: 60px;
}

.card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    background: white;
    transition: transform 0.2s ease;
    /* удалён max-width: 300px; чтобы карточка заполняла колонку */
    width: 100%;
    height: fit-content;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid #eee;
}

.card-info {
    padding: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.card-info strong {
    font-weight: 600;
    color: #000;
}

.card-info div {
    margin: 4px 0;
}

.card-info .title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.card-info .type {
    font-size: 13px;
    color: #555;
    margin-bottom: 4px;
}

.card-info .diameter {
    font-size: 13px;
    color: #555;
    margin-top: 8px;
}

/* === МОДАЛЬНЫЕ ОКНА === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1001;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 1002;
    padding: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #555;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.modal-buttons .btn-save {
    background: #2e7d32;
    color: white;
}

.modal-buttons .btn-cancel {
    background: #ccc;
    color: #333;
}
