:root {
    --primary-color: #7045a5;
}

/* Reset and base styles */
html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #181a1b;
    color: #edeef0;
}

/* Full viewport map */
#map {
    width: 100vw;
    height: 100vh;
    background: #222326;
}

/* Fixed map selector */
#map-selector {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    width: 10vw;
    background: #232428;
    color: #edeef0;
    border-right: 1px solid #292a2d;
}

/* Navbar dropdown */
.navbar-list li:hover .dropdown {
    display: block;
    color: #edeef0;
    text-decoration: none;
}

/* Custom context menu */
.context-menu {
    padding: 1vh 0;
    position: absolute;
    text-align: left;
    background: #232428;
    border-radius: 4px;
    display: inline-block;
    box-shadow: 0 3px 10px rgba(0,0,0,0.5);
    z-index: 1000;
    color: #edeef0;
}

.context-menu ul {
    padding: 0;
    margin: 0;
    min-width: 150px;
    list-style: none;
}

.context-menu ul li {
    padding: 7px 1em;
    transition: background 0.2s;
}

.context-menu ul li a {
    text-decoration: none;
    color: #edeef0;
}

.context-menu ul li:hover {
    background-color: #353639;
}

/* Custom color input */
input[type="color"] {
    cursor: pointer;
    opacity: 0;
    display: block;
    width: 30px;
    height: 30px;
    border: none;
}

#colorpicker-wrapper {
    cursor: pointer;
    width: 30px;
    height: 30px;
    background: #353639;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaflet-control {
    background: #232428 !important;
    color: #edeef0 !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5) !important;
    font-size: 1em;
    font-family: monospace, monospace;
}

.leaflet-control input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    background: #232428;
    border: 2px solid #4b5563;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-right: 0.5rem;
    outline: none;
    box-shadow: 0 0 0 0 transparent;
}

.leaflet-control input[type="radio"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px #7045a580;
}

.leaflet-control input[type="radio"]:checked {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.leaflet-control input[type="radio"]:hover,
.leaflet-control input[type="radio"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px #7045a580;
}

.leaflet-control-zoom {
    background: #232428 !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5) !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background: transparent !important;
    color: #edeef0 !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: 1.5em;
    transition: background 0.2s, color 0.2s;
}

.leaflet-control-zoom a:hover,
.leaflet-control-zoom a:focus {
    background: var(--primary-color) !important;
    color: #fff !important;
}

.leaflet-control-attribution {
    display: none !important;
}

.leaflet-tooltip {
    position: relative;
    background: #232428 !important;
    color: #edeef0 !important;
    border: none !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.7) !important;
    font-family: monospace, monospace;
    font-size: 1em;
    padding: 6px 12px !important;
    opacity: 0.95;
}
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
    border: none !important;
}

.leaflet-tooltip {
    transition: opacity 0.25s cubic-bezier(0.4,0,0.2,1);
    opacity: 0.95;
}

.leaflet-fade-anim .leaflet-tooltip {
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.4,0,0.2,1);
}

.leaflet-fade-anim .leaflet-tooltip.leaflet-tooltip-open {
    opacity: 0.95;
}

.leaflet-marker-icon {
    transition: opacity 0.3s cubic-bezier(0.4,0,0.2,1), transform 0.3s cubic-bezier(0.4,0,0.2,1);
    opacity: 1;
    transform: scale(1);
}

.leaflet-marker-icon {
    transition: opacity 0.3s cubic-bezier(0.4,0,0.2,1), transform 0.3s cubic-bezier(0.4,0,0.2,1);
    opacity: 1;
    transform: scale(1);
}

/* Marker icon box */
.marker-icon-box {
    padding: 2px;
    position: relative;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px #0003;
}
.marker-icon {
    font-size: 12px;
}
.marker-icon-arrow {
    position: absolute;
    left: 50%;
    bottom: -4px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
}
.marker-circle {
    border-radius: 50%;
}

/* Toolbox button */
.toolbox-btn {
    margin: 2px;
    background: #353639;
    color: #edeef0;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-family: monospace, monospace;
}
.toolbox-btn.selected {
    background: #7045a5;
}

/* Modal overlay and fade transitions */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 2000;
    font-family: monospace, monospace;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(24, 26, 27, 0.85);
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.4,0,0.2,1);
    pointer-events: none;
}

.modal.show {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Modal content box */
.modal-content {
    background: #232428;
    color: #edeef0;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
    max-width: 420px;
    margin: 8vh auto 0 auto;
    padding: 0;
    position: relative;
    animation: modal-pop-in 0.35s cubic-bezier(0.4,0,0.2,1);
}

@keyframes modal-pop-in {
    0% { transform: translateY(40px) scale(0.97); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes modal-pop-out {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(40px) scale(0.97); opacity: 0; }
}

.modal.hide .modal-content {
    animation: modal-pop-out 0.35s cubic-bezier(0.4,0,0.2,1);
}

/* Modal header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 10px 24px;
}

.modal-title {
    display: flex;
    align-items: center;
    font-size: 1.25em;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: #edeef0;
    font-size: 1.5em;
    cursor: pointer;
    transition: color 0.2s;
    border-radius: 4px;
    padding: 2px 8px;
}
.modal-close:hover {
    color: #fc2323;
    background: #353639;
}

/* Modal body */
.modal-body {
    padding: 20px 24px 24px 24px;
}

@media (max-width: 600px) {
    .modal-content {
        max-width: 95vw;
        margin: 10vh 2vw 0 2vw;
    }
}

.craft-item {
    margin-bottom: 1rem;
}

.craft-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 5px;
}

.title {
    font-size: 18px;
    font-weight: 600;
    color: #c0c0c0;
}

.info {
    display: flex;
    gap: 15px;
    font-size: 14px;
}

.price {
    color: #ffd700;
    font-weight: 500;
}

.weight {
    color: #888;
}

.items-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.item {
    background-color: #2c2f32;
    border: 1px solid #404040;
    border-radius: 8px;
    padding: 15px 12px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.item:hover {
    background-color: #353639;
    border-color: #4b5563;
}

.item.wide {
    grid-column: span 2;
}

@media (max-width: 480px) {
    .items-grid {
        gap: 8px;
    }

    .item {
        padding: 12px 10px;
        font-size: 12px;
    }
}