/* ===== GRID CONTAINER ===== */
.main-content {
    flex: 1;
   padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    display: flex; /* ДОДАНО! */
    flex-direction: column; /* ДОДАНО! */
}

.grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 20px;
    animation: fadeIn 0.5s ease-in-out;
    width: 100%;
    transition: opacity 0.3s ease;
}

.grid.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute; /* Забираємо з потоку */
}

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

/* ===== BUTTON STRUCTURE ===== */
.button {
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    animation: fadeInUp 0.5s ease-in-out backwards;
    position: relative;
    height: 240px;
}

@keyframes fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.button:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.button:active {
    transform: translateY(-4px) scale(1.01);
}

/* ===== IMAGE SECTION ===== */
.item-image-section {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.item-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
    background: transparent !important;
    
}

.button:hover .item-image {
    transform: scale(1.05);
}

/* ===== TEXT SECTION ===== */
.item-text-section {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35%;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
     background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(5px);
    border-radius: 0 0 20px 20px;
}

/* Категорія - ПРАВИЙ ВЕРХНІЙ КУТОЧОК КНОПКИ */
.item-category {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 5px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 10;
    max-width: calc(100% - 24px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Назва */
.item-name {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #1a1a1a;
    width: 100%;
}

.item-icon-inline {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

/* Опис */
.item-description {
    font-size: 12px;
    line-height: 1.4;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    width: 100%;
}

/* ===== RIPPLE EFFECT ===== */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
    z-index: 100;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ===== IFRAME CONTAINER (всередині main-content) ===== */
.iframe-container {
    flex: 1; /* ВАЖЛИВО! Розтягується на всю доступну висоту */
    width: 100%;
    min-height: 0; /* Дозволяє flex працювати */
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex; /* ДОДАНО! */
    flex-direction: column; /* ДОДАНО! */
}

.iframe-container.active {
    opacity: 1;
    pointer-events: all;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1; /* ДОДАНО! */
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
}
/* ===== RESPONSIVE FOR DESKTOP ===== */
@media (max-width: 1600px) {
    .grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 1200px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}