/* VP Sandbox Game Styles */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevent page scrolling completely */
}

#vp-sandbox-container {
    position: fixed; /* Keep it always covering the full viewport */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #0f0f1a; /* Dark theme base */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    z-index: 2147483647 !important; /* Max z-index to cover all share icons / widgets */
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7 2l12 11.2-5.8.5 3.3 7.3-2.2 1-3.2-7.4-4.4 4.8z" fill="black" stroke="white" stroke-width="1"/></svg>') 0 0, auto;
}

#vp-sandbox-canvas {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    z-index: 1;
}

#vp-sandbox-canvas:active {
    cursor: grabbing;
}

/* UI Layer */
#vp-ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Crucial: Let clicks through to canvas */
    z-index: 2;
}

#vp-ui-layer > * {
    pointer-events: auto; /* Re-enable for actual UI elements */
}

/* Language Switcher */
#vp-lang-switcher {
    display: none;
}

/* Top Menu Bar */
#vp-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 48px;
    background: rgba(15, 15, 26, 0.9);
    border-bottom: 1px solid #8a2be2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    box-sizing: border-box;
    color: white;
    pointer-events: auto;
    z-index: 1000;
    flex-wrap: wrap; /* allow wrapping on extremely small screens */
}

#vp-top-bar > div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-height: 48px;
}

#vp-top-bar > div:first-child {
    gap: 2px;
}

#vp-top-bar > div:last-child {
    gap: 10px;
    padding-left: 20px;
}

.vp-menu-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: #fff;
    cursor: pointer;
    height: 32px;
    padding: 0 12px;
    border: 1px solid transparent;
    transition: all 0.2s;
    white-space: nowrap !important;
    font-size: 14px;
}

.vp-menu-item:hover {
    border-color: #8a2be2;
    background: rgba(138, 43, 226, 0.2);
}

.vp-submenu {
    position: absolute;
    top: calc(100% - 1px);
    left: 20px;
    background: rgba(15, 15, 26, 0.95);
    border: 1px solid #8a2be2;
    border-top: none;
    min-width: 150px;
    z-index: 1001;
}

.vp-submenu-item {
    color: #fff;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    transition: background 0.2s;
}

.vp-submenu-item:last-child {
    border-bottom: none;
}

.vp-submenu-item:hover {
    background: rgba(138, 43, 226, 0.4);
}

#vp-history-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

#vp-top-stats,
#vp-game-time,
#vp-btn-lang-options,
#vp-btn-info-push {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex: 0 0 auto;
}

@media (max-width: 1500px) {
    /* Adjustments for smaller screens */
}

@media (max-width: 1100px) {
    /* Adjustments for smaller screens */
}
.vp-history-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 0;
}
.vp-history-date {
    color: #a0aec0;
    font-size: 12px;
    margin-bottom: 4px;
}
.vp-history-event {
    color: #fff;
    font-size: 14px;
}
/* Panels */
.vp-panel {
    position: absolute;
    top: 50px;
    left: 20px;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid #8a2be2;
    color: #fff;
    padding: 15px;
    min-width: 250px;
    pointer-events: auto;
    z-index: 99;
}

.vp-panel h3 {
    margin-top: 0;
    color: #8a2be2;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
    font-size: 16px;
}

.vp-panel-actions {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #555;
}

.vp-btn-full {
    width: 100%;
    background: #8a2be2;
    color: #fff;
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 14px;
}

.vp-btn-full:hover {
    background: #9b4dca;
}

.vp-city-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #333;
}

.vp-btn-small {
    background: #8a2be2;
    color: #fff;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
}

.vp-btn-small:hover {
    background: #9b4dca;
}

/* Floating Bar (Edit Mode) */
.vp-floating-bar {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #8a2be2;
    padding: 10px 20px;
    color: #fff;
    display: flex;
    gap: 15px;
    align-items: center;
    pointer-events: auto;
    z-index: 101;
}

#vp-edit-area-display {
    color: #ff9900;
    font-weight: bold;
}

.vp-floating-bar button {
    background: #8a2be2;
    color: #fff;
    border: none;
    padding: 6px 15px;
    cursor: pointer;
}
.vp-floating-bar button:hover { background: #9b4dca; }
.vp-floating-bar #vp-btn-cancel-border { background: #555; }
.vp-floating-bar #vp-btn-cancel-border:hover { background: #777; }

/* Modals */
.vp-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 9999;
}

.vp-modal-content {
    background: #1a1a2e;
    border: 2px solid #8a2be2;
    padding: 30px;
    text-align: center;
    color: #fff;
    min-width: 300px;
    cursor: default; /* Reset cursor inside modals */
}

.vp-modal-content h2 {
    margin-top: 0;
    color: #8a2be2;
}

.vp-modal-content input {
    width: 90%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #8a2be2;
    background: #fff !important; /* Force white background */
    color: #000 !important; /* Force black text */
    outline: none;
    font-size: 14px;
}

.vp-modal-content input:focus {
    border-color: #8a2be2;
}

.vp-modal-content button {
    background: #8a2be2;
    color: #fff;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.vp-modal-content button:hover {
    background: #9b4dca;
}

/* Toast Messages */
#vp-toast-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.vp-toast {
    background: rgba(138, 43, 226, 0.9); /* Purple */
    color: #fff;
    padding: 10px 20px;
    margin-top: 10px;
    border-radius: 4px;
    animation: fadeinout 3s forwards;
}

@keyframes fadeinout {
    0% { opacity: 0; transform: translateY(20px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* Diplomacy Tabs */
.vp-diplo-tab {
    background: transparent !important;
    border: none !important;
    color: #aaa !important;
    font-size: 15px !important;
    font-weight: bold;
    cursor: pointer;
    padding: 5px 10px !important;
}
.vp-diplo-tab.vp-active {
    color: #8a2be2 !important;
    border-bottom: 2px solid #8a2be2 !important;
}
.vp-diplo-act {
    padding: 6px 12px !important;
    font-size: 13px !important;
    border-radius: 4px;
}
.vp-diplo-nation {
    padding: 8px 10px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}
.vp-diplo-nation:hover { background: rgba(138,43,226,0.25); }
.vp-diplo-nation.vp-selected { background: rgba(138,43,226,0.4); }
.vp-diplo-nation .vp-rel-tag {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    background: #444;
    color: #ddd;
}
.vp-rel-war { background: #8b0000 !important; }
.vp-rel-allied { background: #2b6cb0 !important; }
.vp-rel-nap { background: #2f855a !important; }

.vp-modal-content select {
    width: 100%;
    padding: 8px;
    margin: 6px 0;
    border: 1px solid #8a2be2;
    background: #fff;
    color: #000;
    outline: none;
    font-size: 14px;
}

/* Chat bubbles */
.vp-chat-msg { margin-bottom: 6px; }
.vp-chat-msg .vp-chat-who { color: #8a2be2; font-weight: bold; }
.vp-chat-msg.vp-chat-mine { text-align: right; }
.vp-chat-msg.vp-chat-mine .vp-chat-who { color: #4b9fff; }

.vp-req-item {
    background: rgba(0,0,0,0.3);
    border-left: 3px solid #8a2be2;
    padding: 8px 10px;
    margin-bottom: 8px;
    font-size: 13px;
    border-radius: 4px;
}
.vp-req-item .vp-req-actions { margin-top: 6px; }
.vp-req-item .vp-req-actions button {
    padding: 4px 12px !important;
    font-size: 12px !important;
    margin-right: 6px;
}
.vp-req-status { font-size: 12px; padding: 2px 6px; border-radius: 3px; background: #444; }
.vp-status-pending { background: #b7791f; }
.vp-status-accepted { background: #2f855a; }
.vp-status-rejected { background: #8b0000; }
.vp-status-expired { background: #555; }
