/* --- Modern Grid Layout --- */
.custom-grid-container {
    gap: 32px !important;
}

.art-card {
    background: #1e1e2e;
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    position: relative; /* Essential for the toast to overlay */
    cursor: pointer;
}

.art-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* --- The Display Box (Flush & Centered) --- */
.art-display {
    position: relative;
    aspect-ratio: 16 / 10; 
    width: 100%;
    overflow: hidden;
    display: flex;           /* Centers the image */
    align-items: center; 
    justify-content: center;
    background: #0d0d14;
    padding: 0;
}

.art-display img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* Forces image to fill all empty space */
    transition: transform 0.6s ease;
}

.art-card:hover .art-display img {
    transform: scale(1.1);
}

/* --- Floating Badges (Mapped to your PHP) --- */
.click-badge {
    position: absolute;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffb86c; /* Warm orange flame color */
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 800;
    z-index: 3;
    top: 12px;
    right: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- Updated "Copied" Toast Overlay --- */
.copy-toast {
    position: absolute;
    inset: 0;               /* Covers the entire card */
    background: rgba(255, 70, 85, 0.85); /* Valorant Red with Transparency */
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 900;
    font-size: 28px;        /* Punchy size */
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 100;           /* Stays above images/badges */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(1.1);  /* Start slightly zoomed out */
}

/* Triggered by the parent class */
.art-card.just-copied .copy-toast {
    opacity: 1;
    transform: scale(1);    /* Snap to normal size */
}

/* --- Details Section --- */
.art-details {
    padding: 24px 20px;
}

.art-title {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 6px 0;
    line-height: 1.2;
}

.art-meta-row {
    font-size: 13px;
    color: #9494b8;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.art-meta-row svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    margin-right: 6px;
}

.author-name {
    color: #ff2a6d;
    font-weight: 800;
}


/*Smooth Feel*/
.post-item-wrapper {
    transition: opacity 0.3s ease;
}
.custom-grid-container {
    display: grid;
    /* This ensures 'order' property works */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
}

/* Ensure the mini-grid behaves exactly like the main grid */
#textart-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Ensure the toast stays INSIDE the card */
.art-card {
    position: relative; /* This is the most important line */
}

/* If the mini-grid layout looks different than the main one, 
   force the same dimensions */
.mini-layout .art-card {
    min-height: 250px; 
}


/* 1. MAIN CONTAINER */
.custom-controls-wrapper {
    display: flex;
    flex-direction: column; /* Stack filters on top of search/sort */
    gap: 20px;
    padding: 20px;
    background: #111111; /* Deeper dark for better contrast */
    border: 1px solid #222;
    border-radius: 12px;
    margin-bottom: 30px;
    position: sticky;
    top: 20px;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* 2. FILTER BUTTONS ROW */
.custom-tax-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn {
    background: #1a1a1a;
    color: #888;
    border: 1px solid #333;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    color: #fff;
    border-color: #5B26B9;
    background: rgba(91, 38, 185, 0.1);
}

.filter-btn.active {
    background: #5B26B9;
    color: #fff;
    border-color: #5B26B9;
    box-shadow: 0 0 15px rgba(91, 38, 185, 0.3);
}

/* 3. SEARCH & SORT ROW */
.search-sort-row {
    display: flex;
    align-items: flex-end; /* Aligns input and select box bottoms */
    justify-content: space-between;
    gap: 15px;
}

/* Search Input */
.search-wrapper {
    position: relative;
    flex-grow: 1;
}

.search-wrapper input {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 12px 15px 12px 42px;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-wrapper input:focus {
    outline: none;
    border-color: #5B26B9;
}

.search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    fill: #555;
    pointer-events: none;
}

/* Sort Dropdown */
.sort-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 160px;
}

.sort-wrapper label {
    font-size: 10px;
    font-weight: 800;
    color: #555;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sort-wrapper select {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 11px 35px 11px 15px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23555555'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
}

.sort-wrapper select:focus {
    outline: none;
    border-color: #FF4453;
}

/* 4. RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .custom-controls-wrapper {
        top: 10px;
        padding: 15px;
    }

    .search-sort-row {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-wrapper {
        min-width: 100%;
    }
}