/* ============================= GLOBAL 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 {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* ============================= SEARCH BAR ============================= */
#search-bar {
    display: flex;
    position: absolute;
    align-items: center;
    width: 300px;
    height: 40px;
    top: 20px;
    right: 10px;
    z-index: 1000;
    border: 0.5px solid #ccc;
    background-color: var(--shadow-bg);
    padding-right: 5px;
    border-radius: var(--border-radius-small);
    transition: all var(--transition-slow);
    overflow: hidden;
}

#search-bar.closed {
    width: 40px;
    padding-left: 5px;
    padding-right: 0;
}

#search-input {
    flex: 1;
    height: 20px;
    font-size: 16px;
    padding: 10px;
    border: none;
    border-radius: var(--border-radius-small);
    background: transparent;
    outline: none;
    transition: all var(--transition-slow);
    opacity: 1;
}

#search-input.closed {
    width: 0;
    padding: 0;
    opacity: 0;
    visibility: hidden;
}

#search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background-image: url('../images/icons/magnifier.png');
    background-size: 20px 20px;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    border-radius: var(--border-radius-small);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

#search-icon:hover {
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.1);
}

/* ============================= MAP ============================= */
#map {
    width: 100%;
    height: 100vh;
    position: relative;
}

/* ============================= SIDEBAR ============================= */
#sidebar {
    width: 280px;
    height: calc(100vh - 10px);
    position: fixed;
    top: 5px;
    bottom: 5px;
    left: -300px;
    overflow-y: auto;
    padding: 20px;
    z-index: 1000;
    text-shadow: 0 0 2px white;
    transition: left var(--transition-slow);
    border-radius: var(--border-radius);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

#sidebar.open {
    left: 0;
}

#sidebar::before {
    content: "";
    background-image: linear-gradient(rgba(142, 142, 142, 0.15), rgba(142, 142, 142, 0.15)),
                      url('../images/icons/spot-list-bg.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    opacity: 0.95;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    border-radius: var(--border-radius);
}

.sidebar-thumbnail {
    display: flex;
    width: calc(50% - 10px);
    margin: 5px;
    padding: 5px;
    border-radius: var(--border-radius-small);
    background-size: cover;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-thumbnail:hover {
    background-color: var(--hover-bg);
    transform: scale(1.05);
}

#location h2 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 10px;
}

.location-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: var(--border-radius);
}

.location-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #666;
}

.close-sidebar {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color var(--transition-fast);
    padding: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-sidebar:hover {
    color: #333;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
}

#fish-images {
    margin: 0;
    padding: 0;
}

#thumbnail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    overflow-y: auto;
    max-height: 50%;
    padding: 0;
    margin: 0;
}

.sidebar-thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: transform var(--transition-fast);
    border: 2px solid transparent;
}

.sidebar-thumbnail:hover {
    transform: scale(1.05);
    border-color: rgba(74, 144, 226, 0.5);
}

/* ============================= WEATHER & PLAY ============================= */
.weather-n-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

#temperature, 
#weather-condition {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    height: 30px;
    margin: 5px 0;
}

.weather-image, 
.temperature-image {
    height: 100%;
    margin: 3px;
}

.play-button {
    position: absolute;
    bottom: 50px;
    height: 50px;
    width: 100px;
    background-image: url('../images/icons/play-button-black.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-radius: var(--border-radius-small);
}

.play-button:hover {
    background-image: url('../images/icons/play-button-light-blue.png');
    transform: scale(1.1);
}

.play-button.cannot-play {
    background-image: url('../images/icons/play-button-grey.png');
    cursor: not-allowed;
}

/* ============================= FORBIDDEN MESSAGES ============================= */
.play-forbidden {
    position: fixed;
    display: flex;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: fit-content;
    flex-direction: row;
    padding: 15px 20px;
    align-items: center;
    background-color: var(--shadow-bg);
    justify-content: center;
    border-radius: var(--border-radius);
    z-index: 9999;
    visibility: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-medium);
}

.play-forbidden.show {
    visibility: visible;
    opacity: 1;
}

#bad-weather div,
#wrong-place div {
    background-size: contain;
    background-repeat: no-repeat;
    width: 50px;
    height: 50px;
    margin-right: 15px;
}

#bad-weather div {
    background-image: url('../images/icons/play-forbidden.png');
}

#wrong-place div {
    background-image: url('../images/icons/wrong-place.png');
}

.play-forbidden p {
    font-size: 18px;
    margin: 0;
    white-space: nowrap;
    text-align: center;
    font-weight: 500;
}

/* ============================= FISHDEX BUTTON ============================= */
#fishdex {
    position: fixed;
    right: 30px;
    bottom: 30px;
    cursor: pointer;
    width: 90px;
    height: 90px;
    z-index: 1000;
    border-radius: var(--border-radius);
    transition: transform var(--transition-fast);
}

#fishdex:hover {
    transform: scale(1.1);
}

#fishdex a {
    display: block;
    width: 80px;
    height: 80px;
    margin: 5px;
    background-image: url('../images/icons/fishdex.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

#fishdex:hover a {
    width: 90px;
    height: 90px;
    margin: 0;
}

/* ============================= RESPONSIVE DESIGN ============================= */
@media screen and (max-width: 1024px) {
    #sidebar {
        width: 320px;
    }
}

@media screen and (max-width: 768px) {
    #search-bar {
        top: 10px;
        right: 5px;
        width: calc(100vw - 80px);
        max-width: 280px;
    }

    #search-bar.closed {
        width: calc(100vw - 80px);  /* Keep full width on mobile */
        max-width: 280px;
        height: 40px;
    }

    #search-input {
        font-size: 14px;
    }
    
    #search-input.closed {
        width: calc(100% - 40px);  /* Always visible on mobile */
        padding: 10px;
        opacity: 1;
        visibility: visible;
    }

    #sidebar {
        width: 100%;
        height: auto;
        max-height: 70vh;
        left: -100%;
        top: auto;
        bottom: 0;
        border-radius: var(--border-radius) var(--border-radius) 0 0;
        padding: 15px;
    }

    #sidebar.open {
        left: 0;
    }
    
    .close-sidebar {
        top: 5px;
        right: 10px;
    }
    
    #location h2 {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .location-info {
        padding: 10px;
    }

    #fish-images {
        max-height: 40vh;
    }
    
    #thumbnail-container {
        display: flex;
        flex-direction: row;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        max-height: none;
        padding: 0;
        margin: 0;
    }
    
    .sidebar-thumbnail {
        flex-shrink: 0;
        width: 80px;
        height: 80px;
        aspect-ratio: 1;
    }

    #fishdex {
        right: 15px;
        bottom: 15px;
        width: 70px;
        height: 70px;
    }

    #fishdex a {
        width: 60px;
        height: 60px;
        margin: 5px;
    }

    #fishdex:hover a {
        width: 70px;
        height: 70px;
        margin: 0;
    }

    .play-forbidden p {
        font-size: 16px;
    }

    .weather-n-play {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 0;
        margin: 0;
    }

    .weather-n-play > div:first-child {
        display: flex;
        justify-content: space-around;
        align-items: center;
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: var(--border-radius);
        padding: 15px 10px;
        gap: 20px;
    }

    #temperature, 
    #weather-condition {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        font-size: 16px;
        margin: 0;
        flex: 1;
        justify-content: center;
    }

    .temperature-image, 
    .weather-image {
        height: 24px;
        width: 24px;
        margin: 0;
        flex-shrink: 0;
    }
    
    .play-button {
        position: static;
        margin: 0 auto;
        width: 100px;
        height: 50px;
        align-self: center;
    }
}

@media screen and (max-width: 480px) {
    #search-bar {
        width: calc(100vw - 20px);
        right: 10px;
    }

    #search-input {
        font-size: 13px;
    }
    
    #sidebar {
        padding: 10px;
        max-height: 75vh;
    }
    
    #location h2 {
        font-size: 18px;
    }
    
    .location-info {
        padding: 8px;
        font-size: 12px;
    }

    #fish-images {
        max-height: 35vh;
    }
    
    #thumbnail-container {
        gap: 8px;
        padding: 0;
        margin: 0;
    }
    
    .sidebar-thumbnail {
        width: 70px;
        height: 70px;
    }

    .play-forbidden {
        padding: 10px 15px;
        max-width: 90vw;
    }

    .play-forbidden p {
        font-size: 14px;
        white-space: normal;
        text-align: left;
    }
    
    .weather-n-play {
        gap: 15px;
        padding: 0;
        margin: 0;
    }

    .weather-n-play > div:first-child {
        padding: 12px 8px;
        gap: 15px;
    }
    
    #temperature, 
    #weather-condition {
        font-size: 14px;
        gap: 6px;
    }
    
    .weather-image, 
    .temperature-image {
        height: 20px;
        width: 20px;
    }
    
    .play-button {
        width: 90px;
        height: 45px;
    }
}