body {
    font-family: sans-serif; /* Default sans-serif for UI */
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: #1e1e1e;
    color: #e0e0e0;
    font-size: 14px;
}

.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* --- Top Bar --- */
#top-bar {
    height: 50px;
    background-color: #2a2a2a;
    border-bottom: 1px solid #383838;
    padding: 0 15px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 12px;
}

#top-bar p { /* Webmapper title style */
    font-family: 'Comic Sans MS', cursive, sans-serif; /* Your specified font for logo */
    font-size: 26px;
    margin-bottom: 0;
    margin-top: 0;
    margin-right: 10px;
    color: #f5f5f5;
    display: flex;
    align-items: baseline;
}
#top-bar p b {
    font-weight: bold;
}
#top-bar p span { /* For v2 */
    font-weight: bold;
    font-size: 11px;
    margin-left: 4px;
    opacity: 0.7;
}

.top-bar-btn {
    background-color: #3c3c3c;
    color: #e0e0e0;
    padding: 7px 14px;
    font-size: 0.9em; /* Relative to body font-size */
    border: 1px solid #505050;
    border-radius: 3px;
    cursor: pointer;
    text-transform: lowercase;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.top-bar-btn:hover {
    background-color: #4a4a4a;
    border-color: #606060;
}

.file-menu, .tools-menu, .settings-menu {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #333333;
    min-width: 200px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.3);
    z-index: 100;
    border: 1px solid #454545;
    border-radius: 3px;
    margin-top: 2px;
}
.dropdown-content a, .menu-item-control {
    color: #e0e0e0;
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    font-size: 0.9em;
    text-transform: lowercase;
}
.dropdown-content a:hover {
    background-color: #4a4a4a;
}

.menu-item-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: default;
}
.menu-item-control label {
    margin-right: 8px;
    flex-grow: 1;
    text-transform: lowercase;
}
.menu-item-control input[type="checkbox"] {
    flex-shrink: 0;
    margin-left: 5px;
    accent-color: #58a6ff;
}

.file-menu:hover .dropdown-content,
.tools-menu:hover .dropdown-content {
    display: block;
}

#layer-options-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
#layer-options-bar label {
    font-weight: 500;
    font-size: 0.9em;
    text-transform: lowercase;
}
#selected-layer-name {
    padding: 6px 8px;
    border: 1px solid #505050;
    border-radius: 3px;
    min-width: 160px;
    background-color: #2c2c2c;
    color: #e0e0e0;
    font-size: 0.9em;
}
#layer-options-bar button {
    background-color: #3c3c3c;
    color: #e0e0e0;
    padding: 6px 12px;
    font-size: 0.85em;
    border: 1px solid #505050;
    border-radius: 3px;
    cursor: pointer;
    text-transform: lowercase;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
#layer-options-bar button:hover {
    background-color: #4a4a4a;
    border-color: #606060;
}
#layer-options-bar button.danger-btn,
button.danger-btn { /* Global danger button style */
    background-color: #7f1d1d;
    border-color: #991b1b;
    color: #fde8e8;
}
#layer-options-bar button.danger-btn:hover,
button.danger-btn:hover {
    background-color: #991b1b;
    border-color: #b91c1c;
}

/* --- Main Content --- */
.main-content-container {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

#layer-panel {
    width: 280px;
    background-color: #262626;
    padding: 15px;
    border-right: 1px solid #383838;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}
#layer-panel h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.25em;
    color: #f0f0f0;
    font-weight: 500;
    text-transform: lowercase;
}
#layer-panel p { /* For to-do list text */
    font-size:0.85em;
    line-height:1.5;
    color: #b0b0b0;
}
#layer-panel div[style*="opacity:0.9"] > div[style*="font-weight:bold"] { /* To-do title */
    font-family: cursive; /* Keep cursive for this specific "to-do" title if intended */
    font-size: 18px !important; /* Override inline style if needed, or change inline */
    margin-bottom: -2px !important;
    text-transform: lowercase;
}


.panel-action-btn {
    width: 100%;
    padding: 9px 12px;
    margin-bottom: 8px;
    box-sizing: border-box;
    background-color: #3c3c3c;
    color: #e0e0e0;
    border: 1px solid #505050;
    border-radius: 3px;
    cursor: pointer;
    text-align: center;
    font-size: 0.9em;
    text-transform: lowercase;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.panel-action-btn:hover {
    background-color: #4a4a4a;
    border-color: #606060;
}
#add-webcam-btn { margin-top: 0; }


#layer-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    flex-grow: 1;
}
#layer-list li {
    padding: 6px 10px;
    border: 1px solid #454545;
    background-color: #333333;
    margin-bottom: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    border-radius: 3px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
#layer-list li:hover {
    background-color: #3d3d3d;
    border-color: #555555;
}
#layer-list li.selected {
    background-color: #4a5a70;
    border-color: #58a6ff;
    font-weight: 500;
    color: #ffffff;
}
#layer-list li .layer-info { display: flex; align-items: center; flex-grow: 1; min-width: 0; }
#layer-list li .thumbnail-container {
    width: 32px; height: 32px;
    margin-right: 10px;
    border: 1px solid #505050;
    overflow: hidden;
    display: flex; justify-content: center; align-items: center;
    background-color: #2c2c2c;
    flex-shrink: 0;
    border-radius: 2px;
}
#layer-list li .thumbnail-container img,
#layer-list li .thumbnail-container video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
#layer-list li .layer-name-wrapper { flex-grow: 1; min-width: 0; display: flex; align-items: center; }
#layer-list li .layer-name-display { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 3px 0; line-height: 1.4; color: #e0e0e0; }
#layer-list li.selected .layer-name-display { color: #ffffff; }

#layer-list li .controls { display: flex; align-items: center; flex-shrink: 0; }
#layer-list li .controls button {
    margin-left: 5px;
    padding: 3px 6px;
    font-size: 0.85em;
    cursor: pointer;
    background-color: #404040;
    border: 1px solid #555555;
    border-radius: 2px;
    color: #cccccc;
    line-height: 1;
}
#layer-list li .controls button:hover {
    background-color: #505050;
    color: #e0e0e0;
}


#canvas-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #181818;
    height: 100%;
    box-sizing: border-box;
    padding: 10px;
    overflow: hidden;
}
#main-canvas {
    border: 1px solid #444;
    background-color: #000000; /* Default canvas drawing area to black */
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
}


/* --- Modal Styles (Shared & Specific) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%;
    overflow: auto;
    background-color: rgba(10,10,10,0.75);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.modal.visible { display: flex; }

.modal-content {
    background-color: #2c2c2c;
    color: #e0e0e0;
    padding: 25px 30px;
    border: 1px solid #404040;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    border-radius: 4px;
    position: relative;
    text-align: left;
}
#settings-modal .modal-content { max-width: 500px; }
#confirm-modal .modal-content { max-width: 380px; text-align: center; }


.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #444;
    padding-bottom: 15px;
    font-size: 1.3em;
    font-weight: 600;
    color: #f5f5f5;
    text-transform: lowercase;
}
#confirm-modal .modal-content h2 { border-bottom: none; margin-bottom: 15px; }

.modal-content p { margin-bottom: 22px; line-height: 1.5; font-size: 0.95em; }
#confirm-modal .modal-content p { font-size: 1em; margin-bottom: 28px; }

.close-button {
    color: #a0a0a0;
    position: absolute;
    top: 15px; right: 18px;
    font-size: 28px; font-weight: bold; line-height: 1;
    cursor: pointer; padding: 2px 6px;
    transition: color 0.15s ease;
}
.close-button:hover, .close-button:focus { color: #f0f0f0; }

.settings-option { margin-bottom: 20px; }
.settings-option label {
    display: block; margin-bottom: 8px;
    font-weight: 500; font-size: 0.9em;
    text-transform: lowercase; /* Settings labels lowercase */
}
.settings-option select,
.settings-option input[type="color"] {
    width: 100%;
    padding: 9px 12px;
    background-color: #383838;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 3px;
    box-sizing: border-box;
    font-size: 0.9em; /* Ensure select text uses body font */
    font-family: sans-serif; /* Explicitly use body font for select */
}
.settings-option input[type="color"] {
    height: 42px; padding: 4px;
    cursor: pointer;
}
.settings-note {
    font-size: 0.85em; color: #b0b0b0;
    margin-top: -10px; margin-bottom: 25px;
    text-transform: lowercase; /* Settings note lowercase */
}

.modal-actions {
    text-align: right; margin-top: 30px;
    display: flex; justify-content: flex-end; gap: 12px;
}
#confirm-modal .modal-actions { justify-content: center; }

.modal-btn {
    padding: 10px 20px;
    border: none;
    background-color: #4a4a4a;
    color: #f0f0f0;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.15s ease;
    text-transform: lowercase;
}
.modal-btn:hover { background-color: #5a5a5a; }

.modal-btn.primary-action {
    background-color: #007acc;
}
.modal-btn.primary-action:hover {
    background-color: #008ae6;
}

.modal-btn.cancel-btn { background-color: #555555; }
.modal-btn.cancel-btn:hover { background-color: #656565; }