/* Header & Search */
.header-section { text-align: center; margin-bottom: 40px; color: white; }
.toolbar {
    background: var(--card);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
}
input, select {
    background: #334155;
    border: 1px solid #475569;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    flex: 1;
}

/* Grid System */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding-bottom: 40px;
}
.card {
    background: var(--card);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #334155;
    position: relative;
}
.card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.4);
}
.card-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-bottom: 3px solid var(--primary);
}
.card-info { padding: 20px; }
.card-info h3 { margin: 0 0 5px 0; font-size: 1.25rem; color: var(--accent); }
.meta { font-size: 0.85rem; color: white; }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 1003;
    padding: 20px;
}
.modal-content {
    background: var(--card);
    width: 100%;
    max-width: 800px;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: 2px solid white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1010;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.modal-close:hover { background: #ff4444; }

.modal-body { display: grid; grid-template-columns: 1.2fr 1fr; min-height: 450px; }

/* Carousel/Gallery Styles */
.carousel-container { 
    position: relative; 
    width: 100%; 
    height: 100%; 
    background: #000; 
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.modal-img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}
.prev-img, .next-img {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 15px 12px;
    cursor: pointer;
    font-size: 24px;
    z-index: 1005;
    transition: background 0.3s;
    user-select: none;
}
.prev-img:hover, .next-img:hover { background: rgba(0,0,0,0.9); }
.prev-img { left: 0; border-radius: 0 8px 8px 0; }
.next-img { right: 0; border-radius: 8px 0 0 8px; }

.img-counter {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    letter-spacing: 1px;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Modal Text & Stats */
.modal-text { padding: 30px; overflow-y: auto; max-height: 500px; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 20px 0;
    background: rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    color: white;
    border: 1px solid #334155;
}
.stats-grid div {
    background: white;
    color: black;
    padding: 8px 4px;
    border-radius: 8px;
    font-size: 0.9rem;
}
.stats-grid strong { display: block; font-size: 0.7rem; text-transform: uppercase; opacity: 0.7; }

/* Responsive adjustments */
@media (max-width: 800px) {
    .modal-body { grid-template-columns: 1fr; }
    .modal-content { max-width: 95%; max-height: 90vh; overflow-y: auto; }
    .carousel-container { height: 300px; }
    .toolbar { flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
