/* --- view-enhancements.css (FINAL - with Bold Titles) --- */

/* 1. HIDE THE ORIGINAL ROW 1 ELEMENTS */
#az-explorer-content #az-artist-selector,
#az-explorer-content #az-artist-info-display,
#wallpaper-gallery-content #wg-gallery-selector,
#wallpaper-gallery-content #wg-gallery-info-display,
#music-database-content #md-track-selector,
#music-database-content #md-track-info-display,
#wiki-history-content #wh-wiki-selector,
#wiki-history-content #wh-wiki-info-display,
#super-search-content #ss-artist-selector,
#super-search-content #ss-artist-info-display {
    display: none !important;
}

/* 2. VIEW CONTROLS */
.view-controls-container {
    display: flex; flex-wrap: wrap; 
    justify-content: space-between; align-items: center;
    margin-bottom: 15px; padding: 8px; background-color: var(--item-thumb-bg);
    border-radius: 6px; border: 1px solid var(--border-color);
}
.view-switch-buttons button, .view-column-selector select,
.filter-btn {
    background-color: white;
    color: black;
    border: 1px solid #ccc;
    padding: 8px 15px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    font-size: 0.85em;
    border-radius: 5px;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}
.view-column-selector select {
    text-transform: none;
}
.view-switch-buttons button:hover,
.view-column-selector select:hover,
.filter-btn:hover {
    background-color: #f0f0f0;
    border-color: #bbb;
}
.view-switch-buttons button.active,
.filter-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
}
.view-column-selector select:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- NEW: Styles for LAYOUT and FILTERS labels --- */
.view-controls-label {
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-right: 8px;
}

/* 3. PRIMARY FILTER INFO DISPLAY */
.primary-filter-info-container {
    text-align: center; margin-bottom: 15px; padding: 20px;
    background-color: var(--item-bg); border: 1px solid var(--border-strong);
    border-radius: 6px; color: var(--text-secondary); display: none;
}
/* --- *** CHANGE 1A: Make ALL primary filter images bigger (JPGs and PNGs) *** --- */
.primary-filter-info-container img {
    max-width: 100%;
    height: auto;
    max-height: 250px; /* Increased size */
    object-fit: contain;
    margin-bottom: 15px;
    border-radius: 4px;
}
/* --- *** CHANGE 1B: Apply the theme filter ONLY to the PNG images *** --- */
.primary-filter-info-container img[src$=".png"] {
    filter: var(--label-icon-filter);
}
.primary-filter-info-container p { font-size: 1em; line-height: 1.5; margin: 0; }

/* Center headings inside the primary/details info blocks (labels/genres details) */
.primary-filter-info-container h4 { text-align: center; margin: 0 0 10px; }

/* 4. FILTER BUTTONS CONTAINER */
.filter-controls-container {
    display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; margin-bottom: 15px;
    background-color: var(--item-thumb-bg); border-radius: 6px; border: 1px solid var(--border-color);
    align-items: center; /* Vertically align the label and buttons */
}

/* 5. SECONDARY ICON GRID */
.secondary-grid-container {
    display: none; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px; padding: 15px; margin-bottom: 15px;
    background-color: var(--item-bg); border: 1px solid var(--border-color); border-radius: 6px;
}
.secondary-grid-item {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 10px; background-color: var(--item-thumb-bg);
    border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
}
.secondary-grid-item:hover {
    background-color: var(--item-hover-bg); border-color: var(--border-hover); transform: translateY(-2px);
}
.secondary-grid-item.active {
    border-color: var(--border-active); box-shadow: 0 0 8px var(--border-active); background-color: var(--item-hover-bg);
}
/* This section remains correct from the last fix */
.secondary-grid-item img {
    width: 60px; /* Increased size */
    height: 60px; /* Increased size */
    object-fit: contain;
    margin-bottom: 5px;
    /* This correctly uses the theme variable for the smaller icons */
    filter: var(--label-icon-filter);
}
.secondary-grid-item span { font-size: 0.75em; color: var(--text-secondary); word-break: break-word; }

/* 6. MAIN VISUAL CONTAINER */
.visual-container {
    /* Default grid columns: 5 on desktop. Individual viewers may override via column selector. */
    --grid-template-columns: repeat(5, 1fr);
    display: grid; gap: 15px; padding: 10px;
    border: 1px solid var(--border-color); border-radius: 6px;
}

/* 7. VIEW-SPECIFIC STYLES & IMAGE SIZE CHANGES */
.visual-container.view-grid,
.visual-container.view-list { 
    grid-template-columns: var(--grid-template-columns); 
}
.view-grid .visual-item { text-align: center; }
.view-grid .visual-item img { width: 100%; height: 120px; object-fit: contain; }
.view-grid .visual-item p { font-size: 0.8em; }

.visual-container.view-list { gap: 10px; }
.view-list .visual-item { display: flex; align-items: center; gap: 15px; padding: 10px; text-align: left; }
.view-list .visual-item img { width: 100px; height: 100px; object-fit: contain; flex-shrink: 0; }

.visual-container.view-carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 20px; }
.view-carousel .visual-item { flex: 0 0 280px; scroll-snap-align: center; text-align: center; }
.view-carousel .visual-item img { width: 100%; height: 180px; object-fit: contain; }

.visual-item {
    cursor: pointer; background-color: var(--item-bg); border-radius: 4px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-color); overflow: hidden;
    animation: fadeIn 0.4s ease-out; /* <<< THIS LINE IS NEW */
}
.visual-item:hover { transform: translateY(-3px); box-shadow: 0 4px 10px rgba(0,0,0,0.2); border-color: var(--border-hover); }
.visual-item img { border-radius: 4px; margin-bottom: 5px; }
.visual-item p { margin: 0 5px 5px 5px; color: var(--text-secondary); line-height: 1.3; }

/* --- *** CHANGE 1: Make grid/list/carousel titles bold *** --- */
.visual-item .item-title {
    font-weight: bold;
}
.visual-item .description {
    font-size: 0.9em;
    color: var(--text-muted);
}

/* 8. MODAL STYLES */
#modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
#modal-overlay.active { opacity: 1; visibility: visible; }
#modal-content {
    background-color: var(--content-bg); padding: 25px; border-radius: 8px;
    border: 1px solid var(--border-strong); width: 100%; max-width: 900px;
    max-height: 90vh; overflow-y: auto; position: relative;
    transform: scale(0.9); transition: transform 0.3s ease;
}
#modal-overlay.active #modal-content { transform: scale(1); }
#modal-close-btn {
    position: absolute; top: 10px; right: 10px;
    background: var(--item-bg); border: 1px solid var(--border-strong);
    color: var(--text-color); font-size: 1.5em; line-height: 1;
    width: 35px; height: 35px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#modal-close-btn:hover { background-color: var(--item-hover-bg); }

/* 9. DYNAMIC MODAL CONTENT STYLES */
#modal-dynamic-content { text-align: left; }
#modal-dynamic-content .modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
#modal-dynamic-content img.main-image { width: 100%; max-width: 400px; border-radius: 6px; border: 1px solid var(--border-color); margin-bottom: 15px; }
/* --- *** CHANGE 2: Make modal titles bold *** --- */
#modal-dynamic-content h3 { 
    margin-top: 0; 
    color: #007bff; /* CHANGED from var(--accent-color) */
    font-weight: bold; 
}#modal-dynamic-content h4 { color: var(--text-secondary); margin-top: 20px; margin-bottom: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 5px;}
#modal-dynamic-content .stats-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; color: var(--text-secondary); }
#modal-dynamic-content .tag-list { list-style: none; padding: 0; }
#modal-dynamic-content .tag-item { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; background-color: var(--item-bg); padding: 8px; border-radius: 4px; }
#modal-dynamic-content .tag-item img { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; filter: var(--label-icon-filter); }
#modal-dynamic-content .tag-item .tag-details p { margin: 0; font-size: 0.9em; color: var(--text-muted); }

/* Styles for Modal Search Buttons */
.modal-search-container {
    margin-top: 25px; padding-top: 15px; border-top: 1px solid var(--border-strong);
}
.modal-search-container h4 { margin-top: 0; margin-bottom: 15px; text-align: center; }
.modal-search-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.modal-search-buttons a {
    display: inline-block; padding: 8px 15px; border-radius: 4px;
    background-color: var(--button-bg); color: var(--button-text);
    border: 1px solid var(--button-border); text-decoration: none;
    font-size: 0.9em; transition: background-color 0.2s;
}
.modal-search-buttons a:hover { background-color: var(--button-hover-bg); }

/* --- NEW: Uppercase Modal Buttons --- */
#modal-dynamic-content .modal-search-buttons a,
#modal-dynamic-content a.button {
    text-transform: uppercase;
    font-weight: bold;
}

/* 10. RESPONSIVE MEDIA QUERIES */
@media (max-width: 768px) { 
    #modal-dynamic-content .modal-grid { grid-template-columns: 1fr; } 
}

/* Force visual grids to 2 columns on small screens */
@media (max-width: 768px) {
    .visual-container { --grid-template-columns: repeat(2, 1fr); }
}

/* Mini-games grid: desktop 4 columns (4x2 for 8 items), stacks on mobile */
.mini-games-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    align-items: start;
    margin-top: 18px;
}
.mini-games-grid > div {
    background: var(--item-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mini-games-grid img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
}
.mini-games-grid h4 { margin: 8px 0 4px; }
.mini-games-grid p { margin: 0; color: var(--text-secondary); }
.mini-games-grid a.button {
    margin-top: auto; /* push play button to the bottom */
    display: inline-block;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
}

@media (max-width: 900px) {
    /* tablet: 2 columns for better readability */
    .mini-games-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    /* mobile: stack single column */
    .mini-games-grid { grid-template-columns: 1fr; }
    .mini-games-grid img { height: auto; }
}

/* --- MODAL CONTENT FONT SIZE ADJUSTMENTS --- */

/* 1. Reduce font size for the artist profile text */
#modal-dynamic-content h4 + div:not(.stats-grid) {
    font-size: 0.9em;
    line-height: 1.5;
}

/* 2. Reduce font size for the stats grid */
#modal-dynamic-content .stats-grid {
    font-size: 0.9em;
}

/* 3. Reduce font size for the labels and genres lists */
#modal-dynamic-content .tag-item .tag-details strong {
    font-size: 0.95em; /* Targets the bold title */
}

#modal-dynamic-content .tag-item .tag-details p {
    font-size: 0.85em; /* Targets the description text */
}

/* --- NEW STYLES FOR WIKI MODAL --- */
.wiki-modal-content {
    text-align: center;
}
.wiki-modal-content .main-image {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.wiki-modal-main-content {
    text-align: left;
}
.modal-gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}
.modal-gallery-image {
    width: 100%;
    height: auto; /* Let aspect-ratio control the height */
    aspect-ratio: 1 / 1; /* Enforce a square shape */
    object-fit: cover; /* Fill the square without stretching */
    border-radius: 4px;
    border: 1px solid var(--border-color);
}
.modal-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    background-color: var(--item-bg);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin: 15px 0 0 0;
    text-align: left; /* Keep grid content left-aligned */
}
.modal-info-grid h4 {
    margin: 0 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.modal-info-grid p, .modal-info-grid ul {
    margin: 0;
    padding: 0;
    color: var(--text-muted);
}
.modal-info-list {
    list-style-type: none;
}

/* --- CUSTOM LIST VIEW STYLES (NEW) --- */

/* 1. A-Z Artist List: Description below image/title */
#az-artist-container.view-list .visual-item {
    flex-wrap: wrap;
    padding-bottom: 10px;
    justify-content: center; 
}
#az-artist-container.view-list .visual-item .description {
    flex-basis: 100%; /* Force to new line */
    text-align: center;
    margin-top: 10px;
    padding: 0 5px;
}

/* 2. Wiki List: Custom Layout */
#wh-wiki-container.view-list .visual-item {
    display: flex;
    flex-direction: column;
    padding: 10px;
}
#wh-wiki-container.view-list .wiki-list-banner {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 1;
    object-fit: cover;
    margin-bottom: 10px;
}
#wh-wiki-container.view-list .wiki-list-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
    margin-bottom: 10px;
}
#wh-wiki-container.view-list .item-title {
    text-align: left;
    margin: 0;
}
#wh-wiki-container.view-list .item-date {
    text-align: right;
    font-size: 0.9em;
    color: var(--text-muted);
    margin: 0;
}
#wh-wiki-container.view-list .description {
    text-align: center;
    width: 100%;
}

/* 3. Super Search List: Bigger, centered images */
#ss-artist-container.view-list .visual-item {
    display: block; /* Override default flex */
    text-align: center;
}
#ss-artist-container.view-list .visual-item img {
    width: 180px;
    height: 180px;
    object-fit: contain;
    margin: 0 auto;
    flex-shrink: 1;
}

/* --- NEW: SMOOTH FADE-IN ANIMATION --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- NEW STYLES FOR SUPER SEARCH SHAPE CONTROLS (NEW) --- */
.shape-selector {
    display: flex;
    align-items: center;
    gap: 5px;
}
.shape-selector button {
    background-color: white;
    color: black;
    border: 1px solid #ccc;
    padding: 5px 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8em;
    border-radius: 5px;
}
.shape-selector button.active {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
}

/* Target ONLY images within the super search container */
#ss-artist-container.shape-rounded .visual-item img {
    border-radius: 20px;
}
#ss-artist-container.shape-round .visual-item img {
    border-radius: 50%;
    /* The images are 3:2, so object-fit: cover is needed to fill the square shape */
    object-fit: cover; 
    aspect-ratio: 1 / 1; /* This will force the image's space to be square */
}

/* Ensure controls wrap nicely on smaller screens */
@media (max-width: 600px) {
    .view-controls-container {
        justify-content: center;
        gap: 15px;
    }
}

