:root {
    --paper-bg: #fdfaf5;
    --ink-color: #2c2f33;
    --accent-red: #d94b4b;
    --sketch-border: 2px solid #2c2f33;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    font-family: 'Patrick Hand', cursive;
    color: var(--ink-color);
    background-color: var(--paper-bg);
}

/* Search Bar */
.sketch-search {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    gap: 10px;
    background: rgba(253, 250, 245, 0.95);
    padding: 8px 15px;
    border: var(--sketch-border);
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    box-shadow: 4px 4px 10px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 350px;
}

.sketch-search input {
    margin-bottom: 0;
    border-bottom: 1px dashed var(--ink-color);
    flex-grow: 1;
    font-size: 18px;
    padding: 4px;
}

.search-btn {
    padding: 4px 12px;
    font-size: 18px;
}

/* Map Styling to look like a sketch */
#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.leaflet-control-attribution {
    display: none; /* Hidden for cleaner app-like UI */
}

/* Bottom Right Actions */
#bottom-right-actions {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.route-btn {
    font-size: 16px;
    padding: 8px 14px;
    background: var(--paper-bg);
    white-space: nowrap;
}

/* Floating Action Button */
.fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--accent-red);
    color: white;
    font-size: 36px;
    font-family: 'Caveat', cursive;
    border: 3px solid var(--ink-color);
    box-shadow: 4px 4px 0px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s;
}

.fab:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px rgba(0,0,0,0.2);
}

/* Modals & Overlays */
.hidden {
    display: none !important;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

/* Sketchbook Page Look */
.sketchbook-page {
    background: var(--paper-bg);
    width: 100%;
    max-width: 400px;
    border: var(--sketch-border);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 6px 6px 15px rgba(0,0,0,0.3);
    position: relative;
    /* Rough edge simulation via border radius */
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
}

.sketchbook-page h2 {
    font-family: 'Caveat', cursive;
    font-size: 32px;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 2px dashed #aaa;
    padding-bottom: 10px;
}

/* Forms */
input, textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--ink-color);
    font-family: 'Patrick Hand', cursive;
    font-size: 20px;
    padding: 8px 4px;
    margin-bottom: 15px;
    color: var(--ink-color);
}

input:focus, textarea:focus {
    outline: none;
    border-bottom-color: var(--accent-red);
}

textarea {
    resize: none;
    background: repeating-linear-gradient(
        transparent,
        transparent 28px,
        #ccc 29px,
        #ccc 30px
    );
    line-height: 30px;
    padding: 0 4px;
}

/* Buttons */
.sketch-button {
    background: white;
    border: var(--sketch-border);
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    padding: 10px 20px;
    font-family: 'Caveat', cursive;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

.sketch-button:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}

.secondary-button {
    background: #e0e0e0;
}

.danger-button {
    background: #ffcccc;
    width: 100%;
    margin-top: 15px;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

/* Location Selection UI */
#crosshair-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none; /* Let clicks pass through to map */
}

.crosshair-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
}

.crosshair-vertical, .crosshair-horizontal {
    position: absolute;
    background-color: var(--accent-red);
}

.crosshair-vertical {
    top: 0; left: 19px; width: 2px; height: 40px;
}

.crosshair-horizontal {
    top: 19px; left: 0; width: 40px; height: 2px;
}

.top-instruction {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(253, 250, 245, 0.9);
    padding: 10px 20px;
    border: var(--sketch-border);
    border-radius: 20px;
    font-size: 20px;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.bottom-action {
    position: absolute;
    bottom: 30px;
    right: 30px;
    pointer-events: auto;
    background-color: var(--accent-red);
    color: white;
}

.bottom-action-left {
    position: absolute;
    bottom: 30px;
    left: 30px;
    pointer-events: auto;
}

/* Frontage Image Selector */
.frontage-selector {
    margin-bottom: 15px;
}

.frontage-selector p {
    margin-bottom: 8px;
    font-size: 18px;
}

.image-options {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.frontage-option {
    width: 80px;
    min-width: 80px;
    height: 60px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.frontage-option.selected {
    border-color: var(--accent-red);
    transform: scale(1.05);
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}

.upload-option {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e0e0e0;
    font-family: 'Caveat', cursive;
    font-size: 32px;
    color: var(--ink-color);
    border: 2px dashed var(--ink-color) !important;
}

.upload-option.selected {
    border: 2px solid var(--accent-red) !important;
}

.upload-option:hover {
    background: #d0d0d0;
}

/* Polaroid Style View */
.polaroid {
    background: white;
    padding: 10px 10px 30px 10px;
    box-shadow: 3px 3px 10px rgba(0,0,0,0.2);
    margin-bottom: 20px;
    transform: rotate(-2deg);
}

.polaroid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border: 1px solid #ddd;
}

.polaroid-caption {
    font-family: 'Caveat', cursive;
    font-size: 28px;
    text-align: center;
    margin-top: 10px;
}

.event-date {
    font-weight: bold;
    color: #666;
    margin-bottom: 10px;
}

.event-notes {
    font-size: 20px;
    line-height: 1.4;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-family: 'Caveat', cursive;
    font-size: 24px;
    cursor: pointer;
    color: var(--ink-color);
}

/* Customizing Leaflet Zoom Controls to match sketchy theme */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: none !important;
    margin-bottom: 30px !important;
    margin-left: 20px !important;
}

.leaflet-control-zoom a {
    background-color: var(--paper-bg) !important;
    color: var(--ink-color) !important;
    border: var(--sketch-border) !important;
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px !important;
    font-family: 'Patrick Hand', cursive !important;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.2) !important;
    margin-top: 8px !important;
    font-size: 22px !important;
    font-weight: bold !important;
    line-height: 36px !important;
    width: 40px !important;
    height: 40px !important;
    text-decoration: none !important;
    transition: transform 0.1s !important;
}

.leaflet-control-zoom a:active {
    transform: translate(2px, 2px) !important;
    box-shadow: 1px 1px 0px rgba(0,0,0,0.2) !important;
}