:root {
    --lego-red: #ff3333;
    --lego-yellow: #ffcc00;
}

/* Override container for wider grid */
.container {
    max-width: 1600px;
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: center; /* Vertical center */
}

input[type="text"], select {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--cyan);
    color: var(--cyan);
    padding: 0.8rem;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

input[type="text"]:focus, select:focus {
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
    border-color: #fff;
}

input[type="text"] {
    width: 300px;
}

/* Grid Override */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

/* LIST VIEW OVERRIDE */
.grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.grid.list-view .card {
    flex-direction: row;
    height: 150px;
}

.grid.list-view .card img {
    height: 100%;
    width: 150px;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
}

.grid.list-view .card-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 2rem;
}

.grid.list-view .card-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.grid.list-view .price-tag {
    margin-top: 0;
}

/* Card Styling */
.card {
    background: var(--glass-bg);
    border: 1px solid rgba(255, 51, 51, 0.3); /* Red border for Lego vibe */
    padding: 0; /* Image needs full width in grid */
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(255, 51, 51, 0.3);
    border-color: var(--lego-red);
}

.card img {
    width: 100%;
    height: 250px;
    object-fit: contain;
    background: rgba(255,255,255,0.05); /* Slight white tint provided context */
    padding: 2rem;
    transition: all 0.3s;
}

.card:hover img {
    transform: scale(1.05);
}

.card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.4);
}

.card-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.card-meta {
    font-size: 0.9rem;
    color: var(--cyan);
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
    opacity: 0.8;
}

.price-tag {
    margin-top: auto;
    font-size: 1.5rem;
    color: var(--lego-yellow);
    font-weight: bold;
    text-align: right;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.3);
    font-family: 'Orbitron', sans-serif;
}

/* Badge for Set ID */
.set-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--lego-red);
    color: #fff;
    padding: 2px 8px;
    font-family: 'Orbitron';
    font-size: 0.8rem;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

/* Pagination Controls */
.pagination-controls button {
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--lego-red);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    margin: 0 0.2rem;
    cursor: pointer;
    font-family: 'Orbitron';
    transition: all 0.2s;
}

.pagination-controls button:hover, .pagination-controls button.active {
    background: var(--lego-red);
    color: black;
}

/* Modal Updates */
.modal-content {
    background: #0a0a0a;
    border: 1px solid var(--lego-red);
    box-shadow: 0 0 50px rgba(255, 51, 51, 0.2);
}

.modal h2 {
    color: var(--lego-red);
    text-shadow: 0 0 10px rgba(255, 51, 51, 0.5);
}

#modal-link {
    background: transparent;
    border: 1px solid var(--lego-red);
    color: var(--lego-red);
    transition: all 0.3s;
}

#modal-link:hover {
    background: var(--lego-red);
    color: white;
    box-shadow: 0 0 20px rgba(255, 51, 51, 0.4);
}

/* Modal Base Styles */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .main-header h1 {
        font-size: 2.5rem;
    }

    .grid.list-view .card {
        height: auto;
        flex-direction: column;
    }
    
    .grid.list-view .card img {
        width: 100%;
        height: 200px;
    }

    .grid.list-view .card-content {
        flex-direction: column;
        align-items: flex-start;
    }
}
