/* ============================= FISHDEX PAGE STYLES ============================= */
:root {
    --primary-bg: rgba(255, 255, 255, 0.4);
    --hover-bg: rgba(255, 255, 255, 0.7);
    --shadow-bg: rgba(255, 255, 255, 0.8);
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
    --border-radius: 8px;
    --border-radius-small: 4px;
    --font-family: 'Montserrat', sans-serif;
}

* {
    box-sizing: border-box;
}

body.fishdex {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
    background-image: url('../images/icons/fishdex-bg.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-attachment: fixed;
    height: 100vh;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    overflow: hidden;
}

/* ============================= NAVIGATION BUTTONS ============================= */
.return-n-home {
    display: flex;
    flex-direction: row;
    position: relative;
    z-index: 1000;
    margin: 15px 0 10px 0;
    gap: 5px;
}

.rnh-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius);
    padding: 2px;
    transition: all var(--transition-fast);
}

.rnh-button-container:hover {
    background-color: var(--primary-bg);
    transform: scale(1.05);
}

.rnh-button {
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-small);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

.rnh-button-container:hover .rnh-button {
    opacity: 1;
}

#return-button {
    background-image: url(../images/icons/back.png);
}

#home-button {
    background-image: url(../images/icons/home.png);
}

/* ============================= MAIN CONTENT LAYOUT ============================= */
.fishdex-main-content {
    display: flex;
    width: 100%;
    height: calc(100vh - 70px);
    gap: 20px;
    padding: 0 20px;
    min-height: 0;
}

/* ============================= THUMBNAIL GRID ============================= */
#thumbnail-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    grid-gap: 6px;
    width: 45vw;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    backdrop-filter: blur(5px);
    align-content: start;
}

.fishdex-thumbnail {
    aspect-ratio: 1;
    background-color: var(--primary-bg);
    background-size: cover;
    background-position: center;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
    overflow: hidden;
}

.fishdex-thumbnail:hover {
    background-color: var(--hover-bg);
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.fishdex-thumbnail.selected {
    border-color: #4a90e2;
    box-shadow: 0 0 15px rgba(74, 144, 226, 0.5);
}

/* ============================= FISH GALLERY ============================= */
.gallery-container {
    display: flex;
    flex-direction: column;
    width: 50vw;
    background-color: var(--primary-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    backdrop-filter: blur(5px);
    transition: opacity var(--transition-medium);
    min-height: 0;
    overflow: hidden;
}

.gallery-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: auto;
    max-height: 60%;
}

.image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    position: relative;
    height: 250px;
    overflow: hidden;
}

#mainImg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--border-radius);
    transition: transform var(--transition-medium);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#mainImg:hover {
    transform: scale(1.05);
}

/* ============================= FISH INFO ============================= */
.fish-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.fish-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 20px;
    flex-wrap: nowrap;
}

#count-the-fish {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    background-color: rgba(255, 255, 255, 0.6);
    padding: 8px 16px;
    border-radius: var(--border-radius-small);
    flex: 1;
    text-align: center;
}

.all-spots-btn {
    position: relative;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.all-spots-btn:hover {
    transform: scale(1.05);
}

#show-fishing-spots {
    background-image: url(../images/icons/find-fish.png);
    background-size: cover;
    background-repeat: no-repeat;
    width: 50px;
    height: 50px;
    transition: filter var(--transition-fast);
}

#show-fishing-spots:hover {
    filter: brightness(1.1);
}

.tooltip {
    visibility: hidden;
    position: absolute;
    bottom: 60px;
    left: auto;
    right: 0;
    transform: none;
    width: max-content;
    max-width: 200px;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: var(--border-radius-small);
    font-size: 12px;
    text-align: center;
    opacity: 0;
    transition: all var(--transition-fast);
    pointer-events: none;
    z-index: 1000;
}

/* Responsive tooltip adjustments */
@media screen and (max-width: 768px) {
    .tooltip {
        max-width: 150px;
        bottom: 50px;
    }
}

@media screen and (max-width: 480px) {
    .tooltip {
        max-width: 120px;
        font-size: 11px;
        padding: 6px 8px;
        bottom: 45px;
    }
}

.all-spots-btn:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* ============================= DESCRIPTION ============================= */
.description-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 15px;
    flex: 1;
    min-height: 200px;
    max-height: 35%;
    overflow: hidden;
}

.description-title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.description {
    text-align: justify;
    line-height: 1.6;
    overflow-y: auto;
    height: 100%;
    padding-right: 10px;
    color: #444;
}

.description::-webkit-scrollbar {
    width: 6px;
}

.description::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.description::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.description::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* ============================= FISHING SPOTS POPUP ============================= */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    transition: opacity var(--transition-medium);
    backdrop-filter: blur(3px);
}

.popup.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.popup.fade-out {
    opacity: 0;
}

@keyframes fadeIn {
    from { 
        opacity: 0;
        transform: scale(0.9);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOut {
    from { 
        opacity: 1;
        transform: scale(1);
    }
    to { 
        opacity: 0;
        transform: scale(0.9);
    }
}

.popup-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background-image: url('../images/icons/spot-list-bg.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    overflow: hidden;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.popup-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color var(--transition-fast);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
}

.spots-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 20px;
}

.spot {
    cursor: pointer;
    padding: 12px 16px;
    margin: 5px 0;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: var(--border-radius-small);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.spot:hover {
    background-color: rgba(199, 246, 251, 0.9);
    border-color: #4a90e2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================= MOBILE RESPONSIVE DESIGN ============================= */
@media screen and (max-width: 1024px) {
    .fishdex-main-content {
        gap: 15px;
        padding: 0 15px;
    }
    
    #thumbnail-container {
        width: 40vw;
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    
    .gallery-container {
        width: 55vw;
    }
}

@media screen and (max-width: 768px) {
    body.fishdex {
        height: 100vh;
        overflow-y: auto;
    }

    .fishdex-main-content {
        flex-direction: row;
        height: calc(100vh - 70px);
        padding: 0 10px;
        gap: 10px;
    }

    /* Mobile: Thumbnails on the left as requested */
    #thumbnail-container {
        display: flex;
        flex-direction: column;
        width: 120px;
        height: 100%;
        max-height: none;
        background-color: rgba(255, 255, 255, 0.15);
        padding: 10px 5px;
        overflow-y: auto;
        overflow-x: hidden;
        flex-shrink: 0;
    }

    .fishdex-thumbnail {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 70px;
        background-size: 60px 60px;
        background-position: center;
        background-repeat: no-repeat;
        border-radius: var(--border-radius-small);
        margin-bottom: 8px;
        min-height: 70px;
        flex-shrink: 0;
    }

    .gallery-container {
        width: calc(100vw - 140px);
        padding: 15px 10px;
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    
    .gallery {
        flex: 0 0 auto;
        max-height: 50%;
    }
    
    .description-container {
        flex: 1;
        min-height: 120px;
        max-height: none;
        margin-top: 10px;
    }

    .image-container {
        height: 180px;
        margin-bottom: 10px;
    }

    .fish-stats {
        flex-direction: row;
        gap: 10px;
        align-items: center;
        justify-content: space-between;
    }

    #count-the-fish {
        font-size: 14px;
        padding: 6px 12px;
        width: 100%;
    }

    .description-container {
        min-height: 100px;
        padding: 10px;
        margin-top: 10px;
    }

    .description-title {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .popup-content {
        width: 95%;
        max-height: 90vh;
    }

    .return-n-home {
        margin: 10px 0 5px 0;
    }

    .rnh-button-container {
        width: 40px;
        height: 40px;
    }

    .rnh-button {
        width: 28px;
        height: 28px;
    }
}

@media screen and (max-width: 480px) {
    .fishdex-main-content {
        gap: 8px;
        padding: 0 5px;
    }
    
    #thumbnail-container {
        width: 100px;
        padding: 8px 3px;
    }
    
    .fishdex-thumbnail {
        height: 60px;
        background-size: 50px 50px;
        margin-bottom: 5px;
    }

    .gallery-container {
        width: calc(100vw - 120px);
        padding: 10px 8px;
    }

    .image-container {
        height: 150px;
    }

    .description-title {
        font-size: 16px;
    }

    .description {
        font-size: 12px;
    }

    .popup-header h2 {
        font-size: 16px;
    }

    #count-the-fish {
        font-size: 12px;
        padding: 4px 8px;
    }

    #show-fishing-spots {
        width: 40px;
        height: 40px;
    }
}