﻿body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #333;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

canvas {
    display: block;
}

#info-panel {
    position: absolute;
    top: 60px;
    left: 20px;
    background-color: #252E1C;
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    z-index: 10;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
}

#poly-panel {
    position: fixed;
    top: 138px;
    left: 20px;
    background-color: #252E1C;
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    z-index: 10;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
    max-height: 60vh;
    overflow-y: auto;
    max-width: calc(20% - 20px);
    min-width: 250px;
}

    #poly-panel h3 {
        margin-top: 0;
        margin-bottom: 16px; /* Increased spacing */
    }

    #poly-panel > div {
        margin-bottom: 16px; /* Increased spacing between sections */
        padding-bottom: 4px;
    }

        /* Add a subtle separator between property sections */
        #poly-panel > div:not(:last-child) {
            border-bottom: 1px dotted #555;
            padding-bottom: 16px;
        }

    #poly-panel label {
        display: inline-block;
        width: 60px;
    }

.controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: #252E1C;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
    padding-left: 15%;
    padding-right: 15%;
    justify-content: center;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
    transition: padding 0.3s ease; /* Smooth padding adjustment */
}

/* Media query for smaller screens */
@media (max-width: 768px) {
    .controls {
        padding-left: 5%;
        padding-right: 5%;
        height: auto; /* Allow height to adjust for wrapped buttons */
    }
}

/* Button styling */
.controls button {
    background-color: #252E1C;
    color: white;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    flex-shrink: 0;
    min-width: 36px;
    transition: all 0.2s ease; /* Smooth transition for hover effects */
}

    .controls button:hover {
        color: #BBCC66;
        border-color: #BBCC66;
        transform: translateY(-2px); /* Slight lift effect on hover */
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Shadow on hover */
    }

    .controls button:active {
        transform: translateY(1px); /* Press effect */
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }

    /* Tooltip on hover - styled to match other elements */
    .controls button:hover::after {
        content: attr(title);
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        background-color: #252E1C;
        color: white;
        padding: 5px 10px;
        border-radius: 5px;
        margin-top: 5px;
        z-index: 101;
        white-space: nowrap;
        font-size: 12px;
        font-family: monospace;
        box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2); /* Match other elements' shadow */
        border: 1px solid #555;
        opacity: 0;
        animation: tooltip-fade 0.2s ease forwards; /* Fade in animation */
    }

/* Tooltip fade-in animation */
@keyframes tooltip-fade {
    from {
        opacity: 0;
        transform: translate(-50%, -5px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}



#triangle-type, #triangle-color {
    background: #252E1C;
    color: #fff;
    border: 1px solid #555;
    padding: 4px;
    width: 100%;
}

    #triangle-type::-webkit-scrollbar,
    #info-panel::-webkit-scrollbar,
    #poly-panel::-webkit-scrollbar,
    .texture-grid::-webkit-scrollbar {
        width: 5px;
    }

    #triangle-type::-webkit-scrollbar-track,
    #info-panel::-webkit-scrollbar-track,
    #poly-panel::-webkit-scrollbar-track,
    .texture-grid::-webkit-scrollbar-track {
        background: transparent;
        border-radius: 5px;
    }

    #triangle-type::-webkit-scrollbar-thumb,
    #info-panel::-webkit-scrollbar-thumb,
    #poly-panel::-webkit-scrollbar-thumb,
    .texture-grid::-webkit-scrollbar-thumb {
        background: #555;
        border-radius: 5px;
    }

        #triangle-type::-webkit-scrollbar-thumb:hover,
        #info-panel::-webkit-scrollbar-thumb:hover,
        #poly-panel::-webkit-scrollbar-thumb:hover,
        .texture-grid::-webkit-scrollbar-thumb:hover {
            background: #BBCC66;
        }

#vertex-coordinates {
    font-size: 0.9em;
    color: #ddd;
    margin-top: 5px;
    padding-left: 65px;
}

/* Texture styles matching the theme */
.texture-grid {
    display: grid;
    grid-template-columns: repeat(4, 0.25fr);
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background-color: #252E1C;
    border-radius: 5px;
    margin-top: 10px;
    border: 1px solid #555;
}

.texture-item {
    position: relative;
    cursor: pointer;
    border: 2px solid #555;
    border-radius: 4px;
    transition: all 0.2s ease;
    aspect-ratio: 1/1;
    overflow: hidden;
}

    .texture-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .texture-item:hover {
        transform: scale(1.05);
        border-color: #BBCC66;
    }

    .texture-item.selected {
        border-color: #BBCC66;
        box-shadow: 0 0 5px #BBCC66;
    }

.texture-error, .no-textures {
    color: #ddd;
    padding: 10px;
    text-align: center;
}

.search-container {
    margin-bottom: 10px;
}

#texture-search {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #555;
    background-color: #252E1C;
    color: white;
}

#texture-controls {
    margin-top: 15px;
    padding: 10px;
    background-color: #252E1C;
    border-radius: 5px;
    border: 1px solid #555;
}

.control-group {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

    .control-group label {
        width: 100px;
        display: inline-block;
    }

    .control-group input[type="range"] {
        flex: 1;
        margin: 0 10px;
    }

    .control-group span {
        width: 50px;
        text-align: right;
    }

#reset-texture, #remove-texture {
    margin-top: 10px;
    margin-right: 10px;
    padding: 5px 10px;
    background-color: #252E1C;
    border: 1px solid #555;
    color: white;
    border-radius: 3px;
    cursor: pointer;
}

    #reset-texture:hover, #remove-texture:hover {
        color: #BBCC66;
        border-color: #BBCC66;
    }

#remove-texture {
    background-color: #6b2b2b;
}

    #remove-texture:hover {
        background-color: #8a3636;
        color: white;
    }

/* Settings Panel Styles */
#settings-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    background-color: #252E1C;
    color: white;
    padding: 15px;
    border-radius: 5px;
    font-family: monospace;
    z-index: 10;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    overflow-y: auto;
    width: 300px;
}

    #settings-panel h3 {
        margin-top: 0;
        margin-bottom: 16px;
    }

    #settings-panel > div {
        margin-bottom: 16px;
        padding-bottom: 4px;
    }

        #settings-panel > div:not(:last-child) {
            border-bottom: 1px dotted #555;
            padding-bottom: 16px;
        }

    #settings-panel label {
        display: inline-block;
        width: 100%;
    }

    #settings-panel input[type="text"],
    #settings-panel select {
        background: #252E1C;
        color: #fff;
        border: 1px solid #555;
        padding: 4px;
        width: 100%;
    }

.bg-color-controls {
    margin-top: 10px;
}

    .bg-color-controls .control-group {
        margin-bottom: 8px;
    }

input[type="color"] {
    width: 50px;
    height: 30px;
    padding: 0;
    border: 1px solid #555;
    border-radius: 4px;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rgba-inputs {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-left: 10px;
    width: 60%;
}

    .rgba-inputs span {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* Custom styling for RGBA number inputs */
    .rgba-inputs input[type="number"] {
        background-color: #252E1C;
        color: white;
        border: 1px solid #555;
        border-radius: 4px;
        text-align: center;
        transition: all 0.2s ease;
        height: 24px;
        width: 45px;
    }
        .rgba-inputs input[type="number"]:focus {
            background-color: #252E1C;
            color: white;
            outline: none;
            border-color: #BBCC66;
            box-shadow: 0 0 5px rgba(138, 54, 54, 0.5);
        }

        /* Hide default spinners first */
        .rgba-inputs input[type="number"]::-webkit-inner-spin-button,
        .rgba-inputs input[type="number"]::-webkit-outer-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #333;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

canvas {
    display: block;
}

#info-panel {
    position: absolute;
    top: 60px;
    left: 20px;
    background-color: #252E1C;
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    z-index: 10;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
}

#poly-panel {
    position: fixed;
    top: 138px;
    left: 20px;
    background-color: #252E1C;
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    z-index: 10;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
    max-height: 60vh;
    overflow-y: auto;
    max-width: calc(20% - 20px);
    min-width: 250px;
    display: none; /* Initially hidden */
}

    #poly-panel h3 {
        margin-top: 0;
        margin-bottom: 16px;
    }

    #poly-panel > div {
        margin-bottom: 16px;
        padding-bottom: 4px;
    }

        /* Add a subtle separator between property sections */
        #poly-panel > div:not(:last-child) {
            border-bottom: 1px dotted #555;
            padding-bottom: 16px;
        }

    #poly-panel label {
        display: inline-block;
        width: 60px;
    }

.controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: #252E1C;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
    padding-left: 15%;
    padding-right: 15%;
    justify-content: center;
    flex-wrap: wrap;
    transition: padding 0.3s ease;
}

/* Media query for smaller screens */
@media (max-width: 768px) {
    .controls {
        padding-left: 5%;
        padding-right: 5%;
        height: auto;
    }
}

/* Button styling */
.controls button {
    background-color: #252E1C;
    color: white;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    flex-shrink: 0;
    min-width: 36px;
    transition: all 0.2s ease;
}

    .controls button:hover {
        color: #BBCC66;
        border-color: #BBCC66;
        transform: translateY(-2px);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    }

    .controls button:active {
        transform: translateY(1px);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }

    /* Tooltip on hover */
    .controls button:hover::after {
        content: attr(title);
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        background-color: #252E1C;
        color: white;
        padding: 5px 10px;
        border-radius: 5px;
        margin-top: 5px;
        z-index: 101;
        white-space: nowrap;
        font-size: 12px;
        font-family: monospace;
        box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
        border: 1px solid #555;
        opacity: 0;
        animation: tooltip-fade 0.2s ease forwards;
    }

/* Flag buttons specific styling */
#blue-flag-btn .bi-flag-fill {
    color: #0d6efd;
}

#red-flag-btn .bi-flag-fill {
    color: #dc3545;
}

/* Tooltip fade-in animation */
@keyframes tooltip-fade {
    from {
        opacity: 0;
        transform: translate(-50%, -5px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

#triangle-type, #triangle-color {
    background: #252E1C;
    color: #fff;
    border: 1px solid #555;
    padding: 4px;
    width: 100%;
}

    #triangle-type::-webkit-scrollbar,
    #info-panel::-webkit-scrollbar,
    #poly-panel::-webkit-scrollbar,
    .texture-grid::-webkit-scrollbar {
        width: 5px;
    }

    #triangle-type::-webkit-scrollbar-track,
    #info-panel::-webkit-scrollbar-track,
    #poly-panel::-webkit-scrollbar-track,
    .texture-grid::-webkit-scrollbar-track {
        background: transparent;
        border-radius: 5px;
    }

    #triangle-type::-webkit-scrollbar-thumb,
    #info-panel::-webkit-scrollbar-thumb,
    #poly-panel::-webkit-scrollbar-thumb,
    .texture-grid::-webkit-scrollbar-thumb {
        background: #555;
        border-radius: 5px;
    }

        #triangle-type::-webkit-scrollbar-thumb:hover,
        #info-panel::-webkit-scrollbar-thumb:hover,
        #poly-panel::-webkit-scrollbar-thumb:hover,
        .texture-grid::-webkit-scrollbar-thumb:hover {
            background: #BBCC66;
        }

#vertex-coordinates {
    font-size: 0.9em;
    color: #ddd;
    margin-top: 5px;
    padding-left: 65px;
}

/* Texture container */
#texture-container {
    display: block;
}

/* Texture styles */
.texture-grid {
    display: grid;
    grid-template-columns: repeat(4, 0.25fr);
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background-color: #252E1C;
    border-radius: 5px;
    margin-top: 10px;
    border: 1px solid #555;
}

.texture-item {
    position: relative;
    cursor: pointer;
    border: 2px solid #555;
    border-radius: 4px;
    transition: all 0.2s ease;
    aspect-ratio: 1/1;
    overflow: hidden;
}

    .texture-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .texture-item:hover {
        transform: scale(1.05);
        border-color: #BBCC66;
    }

    .texture-item.selected {
        border-color: #BBCC66;
        box-shadow: 0 0 5px #BBCC66;
    }

.texture-error, .no-textures {
    color: #ddd;
    padding: 10px;
    text-align: center;
}

.search-container {
    margin-bottom: 10px;
}

#texture-search {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #555;
    background-color: #252E1C;
    color: white;
}

#texture-controls {
    margin-top: 15px;
    padding: 10px;
    background-color: #252E1C;
    border-radius: 5px;
    border: 1px solid #555;
    display: block;
}

.control-group {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

    .control-group label {
        width: 100px;
        display: inline-block;
    }

    .control-group input[type="range"] {
        flex: 1;
        margin: 0 10px;
    }

    .control-group span {
        width: 50px;
        text-align: right;
    }

#reset-texture, #remove-texture {
    margin-top: 10px;
    margin-right: 10px;
    padding: 5px 10px;
    background-color: #252E1C;
    border: 1px solid #555;
    color: white;
    border-radius: 3px;
    cursor: pointer;
}

    #reset-texture:hover, #remove-texture:hover {
        color: #BBCC66;
        border-color: #BBCC66;
    }

#remove-texture {
    background-color: #6b2b2b;
}

    #remove-texture:hover {
        background-color: #8a3636;
        color: white;
    }

/* Settings Panel Styles */
#settings-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    background-color: #252E1C;
    color: white;
    padding: 15px;
    border-radius: 5px;
    font-family: monospace;
    z-index: 10;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    overflow-y: auto;
    width: 300px;
    display: none; /* Initially hidden */
}

    #settings-panel h3 {
        margin-top: 0;
        margin-bottom: 16px;
    }

    #settings-panel > div {
        margin-bottom: 16px;
        padding-bottom: 4px;
    }

        #settings-panel > div:not(:last-child) {
            border-bottom: 1px dotted #555;
            padding-bottom: 16px;
        }

    #settings-panel label {
        display: inline-block;
        width: 100%;
    }

    #settings-panel input[type="text"],
    #settings-panel select {
        background: #252E1C;
        color: #fff;
        border: 1px solid #555;
        padding: 4px;
        width: 100%;
    }

.bg-color-controls {
    margin-top: 10px;
}

    .bg-color-controls .control-group {
        margin-bottom: 8px;
    }

input[type="color"] {
    width: 50px;
    height: 30px;
    padding: 0;
    border: 1px solid #555;
    border-radius: 4px;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rgba-inputs {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-left: 10px;
    width: 60%;
}

    .rgba-inputs span {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* Custom styling for RGBA number inputs */
    .rgba-inputs input[type="number"] {
        background-color: #252E1C;
        color: white;
        border: 1px solid #555;
        border-radius: 4px;
        text-align: center;
        transition: all 0.2s ease;
        height: 24px;
        width: 45px;
    }

        .rgba-inputs input[type="number"]:focus {
            background-color: #252E1C;
            color: white;
            outline: none;
            border-color: #BBCC66;
            box-shadow: 0 0 5px rgba(187, 204, 102, 0.5);
        }

        /* Hide default spinners */
        .rgba-inputs input[type="number"]::-webkit-inner-spin-button,
        .rgba-inputs input[type="number"]::-webkit-outer-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

/* Help panel styles */
#help-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    background-color: #252E1C;
    color: white;
    padding: 15px;
    border-radius: 5px;
    font-family: monospace;
    z-index: 10;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    overflow-y: auto;
    width: 400px;
    display: none; /* Initially hidden */
}

    #help-panel h3 {
        margin-top: 0;
        margin-bottom: 16px;
        border-bottom: 1px dotted #555;
        padding-bottom: 10px;
    }

    #help-panel h4 {
        color: #64c8ff;
        margin: 15px 0 5px 0;
    }

    #help-panel .help-section {
        margin-bottom: 16px;
        padding-bottom: 4px;
    }

        #help-panel .help-section:not(:last-child) {
            border-bottom: 1px dotted #555;
            padding-bottom: 16px;
        }

    #help-panel ul {
        padding-left: 20px;
    }

    #help-panel li {
        margin-bottom: 5px;
    }

    #help-panel p {
        margin: 5px 0;
        line-height: 1.4;
    }

    #help-panel .help-footer {
        font-size: 0.9em;
        color: #999;
    }

    #help-panel a {
        color: #64c8ff;
        text-decoration: none;
    }

        #help-panel a:hover {
            text-decoration: underline;
            color: #BBCC66;
        }

    /* scrollbar styles to help panel */
    #help-panel::-webkit-scrollbar {
        width: 5px;
    }

    #help-panel::-webkit-scrollbar-track {
        background: transparent;
        border-radius: 5px;
    }

    #help-panel::-webkit-scrollbar-thumb {
        background: #555;
        border-radius: 5px;
    }

        #help-panel::-webkit-scrollbar-thumb:hover {
            background: #BBCC66;
        }
