
/*
 * Map layout
 */
#map-container {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    height: calc(100vh - 100px);
    margin: 0 auto;  
}

#map_wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    user-select: none;
    flex: 1;
}

#map {
    position: relative;
    max-width: calc(min(100vw - 350px,100vh - 100px));
    max-height: calc(min(100vw - 350px,100vh - 100px));
    aspect-ratio: 1 / 1;
    margin: 0 auto;  
    height: auto;
    width: auto;
}

#map_url_box {
    height: 30px;
    width: 200px;
    background-color: white;
    border: 3px solid var(--button-normal-bg);
    border-radius: 6px;
    padding: 10px;
    margin: 10px auto;
}

/*
#tile_tray {
    display: none;
    width: 100%;
    height: 0px;
    background: #888;
}

.tile_tray_open {
    display: block !important;
    height: 200px !important;
    transition: height 0.5s ease;
}

.tile_tray_close {
    display: block !important;
    height: 0px !important;
    transition: height 0.5s ease;
}

.tile_tray_close::after {
    display: none;
}
*/

.tray-toggle-button {
    position: absolute;
    right: 5px;
    bottom: 0px;
    transform: translate(0%,100%);
    font-size: 12px;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    padding: 3px;
    cursor: pointer;
    user-select: none;
    background-color: var(--button-normal-bg); 
    z-index: 200;
}

.tray-toggle-button:hover {
    background-color: var(--button-hover-bg);
}

.tile_tray {
    position: relative;
    width: 100%;
    height: 0px;
    background: #888;
    transition: height 0.5s ease;
    z-index: 20;
}

.tile_tray::after {
    display: block;
}

.tile_tray.open {
    display: block;
    height: 130px;
    transition: height 0.5s ease;
}

.tile_tray_content {
    display: flex;
    flex-direction: row;
    width: calc(100vw - 350px);
    height: 100%;
    gap: 10px;
    align-items: center;
    overflow-x: scroll;
    overflow-y: hidden;
}

#ajaxBar {
    position: absolute;
    top: 40%; /* Center vertically */
    left: 50%; /* Center horizontally */
    transform: translate(-50%, -50%); /* Precise center */
    display: none; /* Hidden until loading */
    background: rgba(255, 255, 255, 0.8); /* Optional nice semi-transparent background */
    padding: 10px;
    border-radius: 8px;
    z-index: 100;
}

#mapMessage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    display: none;
    background: rgba(255, 255, 255, 0.8); /* Optional nice semi-transparent background */
    padding: 10px;
    border-radius: 3px;
    font-size: 28px;
    font-family: Orbitron;
    z-index: 500;
}

#mapSelectHolder {
    color: black;
    margin: 0px;
    z-index: 10;
}

#mapSelector {
    color: var(--sidebar-text-color);
    font-size: 14px;
}

.hex-tile {
    position: absolute;
    display: grid;
    place-items: center;

    font-family: Arial !important;
    font-size: 18px !important;
    color: white;
    text-shadow: 
    2px 2px 4px rgba(0, 0, 0, 0.9),
    2px -2px 4px rgba(0, 0, 0, 0.9),
    -2px 2px 4px rgba(0, 0, 0, 0.9),
    -2px -2px 4px rgba(0, 0, 0, 0.9)
    ;

    width: 16%;
    height: 13.856%;

    background-size: cover;
    background-repeat: no-repeat;
    transform: translate(-50%, -50%); /* Precise center */

    /*box-shadow: 0 20px 10px rgba(243, 239, 2, 0.8);*/

    clip-path: polygon(
        25% 0%, 75% 0%,
        100% 50%, 75% 100%,
        25% 100%, 0% 50%
    );
    background-color: #555555;
}

.hex-tile.spare {
    position: static;
    width: 110px;
    height: 100px;
    aspect-ratio: 1.1;
    transform: translate(0%, 0%); /* Precise center */
}

.hex-tile.small {
    width: 12.5%;
    height: 10.825%;
}


.hex-tile.selected::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 1;
    z-index: 100;
    background-color: rgba(243, 239, 2, 0.4);
    background-image: none;
}

.hex-tile.swap {
    transition: top 0.5s ease, left 0.5s ease;
}

.hex-tile::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 100;
    background: radial-gradient(circle at center,transparent 40%, rgba(255, 255, 0, 0.5) 60%) no-repeat center/cover;
}

.hex-tile:hover::after {
    opacity: 1;
}

.button_bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
}

.left-buttons, .right-buttons {
    display: flex;
    align-items: center;
    gap: 10px; /* space between buttons */
}


.genbutton {
    display: flex;

    padding: 8px 16px;
    align-items: center;   /* vertical alignment */
    justify-content: center; /* horizontal alignment */
    font-size: 14px;
    text-align: center;
    text-decoration: none;
    color: black;
    background-color: var(--button-normal-bg); 
    border: none;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    vertical-align: middle;
    transition: background-color 0.2s;
    z-index: 100;
}

.genbutton_inactive {
    background-color: var(--button-inactive-bg) !important;
}

.genbutton_active:hover {
    background-color: var(--button-hover-bg); /* darker blue on hover */
}
  
.genbutton_active:active {
    transform: scale(0.98);
    background-color: var(--button-pressed-bg); /* even darker when clicked */
}


#map_string_box {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 8px;
    padding: 8px 12px;
    width: 90%;
    max-width: 800px;
    margin: 20px auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    gap: 10px; /* spacing between items */
    z-index: 10;
}

#map_string_box .label {
    font-weight: bold;
    font-size: 16px;
    white-space: nowrap;
}

#map_string {
    flex-grow: 1;
    font-family: monospace;
    font-size: 14px;
    background: #f5f5f5;
    padding: 6px 10px;
    border: 1px solid #dddddd;
    border-radius: 4px;
    overflow-x: auto;
    word-break: break-word;
    text-align: center;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: all; /* easy to select */
}

.copy_button {
    background-color: var(--primary-color, #4CAF50);
    color: white;
    padding: 3px 8px;
    margin-top: 3px;
    margin-bottom: 3px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    user-select: none;
    transition: background 0.3s;
}

@media (max-width: 767px) {
    .copy_button {
        padding-top: 10px;
        padding-bottom: 10px;
    }
}

.copy_button:hover {
    background-color: var(--primary-color-hover, #45a049);
}

.copy_button:active {
    transform: scale(0.98);
    background-color: var(--primary-color-active, #37793b); /* even darker when clicked */
}

/*
 * Popup for game options.
 */
.popup {
    position: absolute;
    top: 45px;  /* adjust based on button placement */
    left: 110px;
    background: #fff;
    color: black;
    border: 1px solid black;
    border-radius: 6px;
    padding: 10px;
    box-shadow: 0 0 10px #000;
    z-index: 300;
    font-size: 14px;
  }
  
  .popup.hidden {
    display: none;
  }

#game_locked_notice {
    position: absolute;
    display: none;
    left:200px;
    top:25px;
    background: #1d971d;
    color: #ffffff;
    padding: 3px;
    border-radius: 6px;
    font-family: sans-serif;
    font-size: 12px;
    z-index: 200;
    cursor: pointer;
    user-select: none;

}