/* --- Painting & Planning Controls --- */

/* 1. The Container: Positioned Top-Middle */
.paint-control-container {
    position: absolute;
    top: 15px; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    margin: 0 !important;    
    /* This makes the main button and the toolbar sit side-by-side */
    display: flex;
    align-items: center; 
    gap: 8px;
    
    /* Remove background from container itself so it's invisible until expanded */
    pointer-events: none; /* Let clicks pass through the empty space around buttons */
}

/* 2. The Main Toggle Button (The Wrench) */
#paint-main-btn {
    pointer-events: auto; /* Re-enable clicks */
    width: 40px;
    height: 40px;
    
    /* Flex Center for the icon */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Styling */
    background-color: #222;
    border: 1px solid #666;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    transition: background-color 0.2s;
}

#paint-main-btn:hover {
    background-color: #444;
}

#paint-main-btn.active {
    background-color: var(--pico-primary, #0056b3);
    border-color: white;
}

#paint-main-btn img {
    width: 24px;
    height: 24px;
    pointer-events: none;
}

/* 3. The Toolbar (Container for the other buttons) */
#paint-toolbar {
    pointer-events: auto; /* Re-enable clicks */
    
    /* Layout: Horizontal row of buttons */
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    
    /* Visuals for the "Bar" */
    background-color: rgba(40, 40, 40, 0.95);
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #555;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

/* 4. The Tool Buttons (Inside the toolbar) */
.paint-sub-btn {
    background-color: #333;
    border: 1px solid #666;
    color: #eee;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.paint-sub-btn:hover {
    background-color: #555;
    transform: translateY(-1px);
}

/* When a tool is active (handled by JS adding .active class later if you want) */
.paint-sub-btn.active {
    background-color: var(--pico-primary, #0056b3);
    color: white;
}

/* 5. The Checkbox Label */
#paint-toolbar label {
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid #666; /* Separator line */
    font-size: 0.8em;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* 6. Utility Class to Hide the Toolbar */
.hidden {
    display: none !important;
}

/* This targets the Leaflet wrapper for the sticky note */
.sticky-note-wrapper {
    background: transparent !important;
    border: none !important;
}

/* Ensure the inner content handles the styling */
.sticky-note-content {
    /* Cursor indicates it can be interacted with (deleted) */
    cursor: pointer; 
    /* Prevent user from selecting the text while dragging map */
    user-select: none;
}

/* Manager Window Styles */
#paint-list-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#paint-list-container li {
    padding: 8px;
    border-bottom: 1px solid #444;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}

#paint-list-container li:hover {
    background-color: #333;
}

#paint-list-container li.active {
    background-color: var(--pico-primary);
    color: white;
}

/* --- Paint Manager Window Layout --- */

/* 1. Backdrop */
#paint-manager-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7); /* Matched opacity */
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 2. The Window Box */
#paint-manager-window {
    width: 70%;
    max-width: 1000px;
    height: 70%;
    background-color: var(--pico-card-background-color);
    border: 1px solid var(--pico-contrast);
    border-radius: var(--pico-border-radius);
    box-shadow: var(--pico-box-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 3. Header */
#paint-manager-window .window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: var(--pico-card-sectioning-background-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
}

#paint-manager-window .window-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

/* 4. Main Content Area (GRID LAYOUT) */
#paint-manager-content {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Exact match to Player Markers */
    gap: 1rem;
    padding: 1rem;
    flex-grow: 1;
    min-height: 0;
    overflow: hidden;
}

/* 5. Columns */
#paint-list-column,
#paint-io-column {
    background-color: var(--pico-background-color);
    border-radius: var(--pico-border-radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Right Column Specifics */
#paint-io-column {
    font-size: 0.8em;
    gap: 1.5rem;
    overflow-y: auto;
}

#paint-io-column p { margin-bottom: 0.75rem; }
#paint-io-column input,
#paint-io-column select,
#paint-io-column button { font-size: 0.9em; }

/* 6. List Container */
#paint-list-container {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
    padding-right: 0.5rem;
    border: 1px solid var(--pico-muted-border-color); /* Added border to match look */
    border-radius: 4px;
    background-color: var(--pico-card-background-color);
}

#paint-list-container ul { list-style: none; margin: 0; padding: 0; }

#paint-list-container li {
    padding: 0.75rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}

#paint-list-container li:hover {
    background-color: var(--pico-primary-hover);
    color: var(--pico-primary-inverse);
}

#paint-list-container li.active {
    background-color: var(--pico-primary);
    color: white;
}

/* 7. Bottom Controls */
#paint-list-controls {
    flex-shrink: 0;
    padding-top: 1rem;
    display: flex;
    gap: 10px;
}

#paint-list-controls button {
    flex: 1;
}

/* 8. Logger Styling */
#paint-logger {
    background-color: #111;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    display: flex;
    flex-direction: column;
    height: 150px;
    flex-shrink: 0;
}

#paint-logger header {
    background-color: #222;
    padding: 5px 10px;
    font-size: 0.85em;
    border-bottom: 1px solid #333;
    color: #aaa;
}

#paint-log-content {
    padding: 5px 10px;
    overflow-y: auto;
    flex: 1;
    font-family: monospace;
    font-size: 0.85rem;
}

/* 9. Details/Summary Styling */
.pm-details {
    background-color: var(--pico-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    padding: 0.5rem;
}

.pm-details summary {
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.details-content {
    padding-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Utility */
.warning-text { color: #ffbd2e; font-size: 0.85em; margin: 0; }
.danger-button {
    background-color: #5c0505 !important;
    border-color: #8a0a0a !important;
    color: white;
    width: 100%;
}
.danger-button:hover { background-color: #8a0a0a !important; }