* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -webkit-system-ui, 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    color: #000000;
    overflow-x: hidden;
    overflow-y: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    display: flex;
    height: 100vh;
    position: relative;
}



.nav-buttons {
    position: fixed;
    top: 15px;
    left: 10px;
    display: flex;
    align-items: center;
    z-index: 10001;
    transition: all 0.3s ease;
}

.nav-buttons a {
    background: #000000;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.sidebar {
    width: 760px;
    height: 100vh;
    background: #ffffff;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    border-right: 1px solid #cccccc;
    position: absolute;
    left: 0;
    top: 0;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.toggle-btn {
    position: fixed;
    top: 15px;
    left: 20px;
    width: 30px;
    height: 30px;
    background: #000000;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 16px;
    z-index: 10001;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: #333333;
    transform: scale(1.1);
}

.sidebar.hidden {
    transform: translateX(-100%);
}

.sheet-handle {
    display: none;
}



.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(139, 0, 0, 0.03) 2px, transparent 2px),
        radial-gradient(circle at 80% 70%, rgba(139, 0, 0, 0.02) 1px, transparent 1px),
        linear-gradient(45deg, transparent 48%, rgba(139, 0, 0, 0.01) 49%, rgba(139, 0, 0, 0.01) 51%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, rgba(139, 0, 0, 0.01) 49%, rgba(139, 0, 0, 0.01) 51%, transparent 52%);
    background-size: 80px 80px, 120px 120px, 60px 60px, 60px 60px;
    animation: geometryFloat 60s linear infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes geometryFloat {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-2px, -3px) rotate(90deg); }
    50% { transform: translate(2px, -2px) rotate(180deg); }
    75% { transform: translate(-1px, 3px) rotate(270deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

#map {
    width: 100%;
    height: 100vh;
    position: relative;
    z-index: 1;
}

.map-controls-grid,
.map-controls-row {
    pointer-events: auto !important;
}

.custom-zoom-control {
    pointer-events: auto !important;
}

.expand-btn {
    margin-bottom: 5px !important;
}

.leaflet-top.leaflet-left {
    top: 10px !important;
}

.map-controls-grid,
.map-controls-row {
    position: relative !important;
    margin: 0 !important;
    z-index: 1000 !important;
}

.map-controls-grid button,
.map-controls-row button {
    width: 32px !important;
    height: 32px !important;
    font-size: 14px !important;
    border: 1px solid #000000 !important;
    background: #ffffff !important;
    color: #000000 !important;
    cursor: pointer !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.map-controls-grid button:hover,
.map-controls-row button:hover {
    background: #000000 !important;
    color: #ffffff !important;
    transform: scale(1.05) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

.map-controls-grid button.active,
.map-controls-row button.active {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #333333 !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5) !important;
}

.custom-zoom-control button:hover {
    background: #000000 !important;
    color: #ffffff !important;
    transform: scale(1.05) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

.leaflet-control-layers {
    top: 130px !important;
    right: 10px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #cccccc !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

.leaflet-control-layers-toggle {
    background: #ffffff !important;
    border: 1px solid #000000 !important;
    color: #000000 !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 4px !important;
}

.leaflet-control-layers-toggle:hover {
    background: #000000 !important;
    color: #ffffff !important;
}

.leaflet-control-layers-list {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #000000 !important;
    border-radius: 6px !important;
    padding: 10px !important;
}

.leaflet-control-layers label {
    color: #000000 !important;
    font-size: 12px !important;
    margin: 5px 0 !important;
}

.leaflet-control-layers input[type="radio"] {
    margin-right: 8px !important;
}

h1 {
    color: #000000;
    margin-bottom: 30px;
    text-align: center;
    font-size: 24px;
    text-shadow: none;
}

.site-name-group {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #000000;
    margin-bottom: 25px !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.site-name-group label {
    color: #000000 !important;
    font-weight: 700;
    font-size: 16px;
    text-shadow: none;
}

.site-name-group input {
    background: #ffffff !important;
    border: 2px solid #000000 !important;
    font-weight: 600;
    color: #000000 !important;
    font-size: 15px;
}

.site-name-group input:focus {
    border-color: #333333 !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2) !important;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #000000;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 6px;
    color: #000000;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group select option {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 8px !important;
}

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23fff" d="M6 9L1.5 4.5h9z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 35px !important;
}

select:focus {
    background-color: rgba(42, 42, 42, 0.95) !important;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #000000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.form-group button {
    margin-left: 10px;
    padding: 12px 20px;
    background: #000000;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.form-group button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.center-btn {
    text-align: center;
    margin-top: 10px;
}

.center-btn button {
    margin-left: 0;
}

.points-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #cccccc;
}

.points-table th,
.points-table td {
    padding: 14px 10px;
    text-align: center;
    border-bottom: 1px solid #cccccc;
    font-size: 12px;
}

.points-table td:last-child {
    width: 80px;
    min-width: 80px;
}

.points-table th {
    background: #000000;
    color: #ffffff;
    font-weight: 600;
    text-shadow: none;
}

.points-table input {
    width: 100%;
    padding: 6px;
    font-size: 12px;
    min-width: 80px;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 4px;
    color: #000000;
    text-align: center;
}

.points-table td {
    color: #000000;
}

.points-table .auto {
    color: #000000;
    background: #f0f0f0;
}

.points-table .auto {
    background: #f0f0f0;
    color: #000000;
    font-weight: 600;
    position: relative;
}

.points-table tr {
    position: relative;
}

.points-table tr:hover .copy-row-btn {
    opacity: 1;
}

.copy-row-btn {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.action-row {
    display: flex;
    gap: 10px;
}

.action-row button {
    flex: 1 !important;
    padding: 10px 12px !important;
    font-size: 12px !important;
    background: #000000 !important;
    border: none !important;
    border-radius: 6px !important;
    color: #ffffff !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.action-group {
    display: flex;
    gap: 10px;
}

.action-group button,
.action-group select {
    flex: 1;
}

.actions button,
.actions select {
    padding: 12px 16px !important;
    background: #000000 !important;
    border: none !important;
    border-radius: 6px !important;
    color: #ffffff !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    font-size: 13px !important;
    font-family: inherit !important;
    text-decoration: none !important;
    display: inline-block !important;
    text-align: center !important;
    vertical-align: middle !important;
    user-select: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.actions select {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #cccccc !important;
}

.actions select option {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 8px !important;
}

/* Forced styles for all selects */
select {
    background-color: #ffffff !important;
    color: #000000 !important;
}

select option {
    background-color: #ffffff !important;
    color: #000000 !important;
}

#exportFormat {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #cccccc !important;
}

#exportFormat option {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 8px !important;
}

/* Additional styles for all browsers */
select#exportFormat {
    background-color: #ffffff !important;
    color: #000000 !important;
}

select#exportFormat:focus {
    background-color: #ffffff !important;
    color: #000000 !important;
}

select#exportFormat option:checked {
    background-color: #000000 !important;
    color: #ffffff !important;
}

#results {
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid #cccccc;
}

#error {
    background: #000000;
    color: #ffffff;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
    display: none;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.author-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #cccccc;
    text-align: center;
    display: none;
}

.author {
    color: #000000;
    font-size: 12px;
    margin-bottom: 5px;
    font-weight: 600;
}

.idea {
    color: #666666;
    font-size: 11px;
    margin-bottom: 5px;
    font-style: italic;
}

.phone {
    color: #000000;
    font-size: 12px;
    margin-bottom: 10px;
    font-weight: 500;
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 15px;
    border: 1px solid #cccccc;
    display: inline-block;
}

.license-btn {
    background: transparent;
    border: 1px solid #000000;
    color: #000000;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s ease;
}

.license-btn:hover {
    background: #000000;
    color: #ffffff;
}

.leaflet-control-search {
    background: white;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
}

/* Old styles removed, using new grid styles */

@keyframes activeButton {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}



.table-actions {
    text-align: center;
    margin: 10px 0;
}

.table-actions button {
    padding: 8px 16px;
    background: #000000;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
}

.table-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.copy-row-btn {
    background: none;
    border: none;
    color: #000000;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 5px;
    margin-left: 5px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.copy-row-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #cccccc;
}

.results-table td {
    padding: 12px 8px;
    text-align: center;
    border-bottom: 1px solid #cccccc;
    font-size: 13px;
    color: #000000;
}

.results-table td:nth-child(3) {
    color: #000000;
    font-weight: 600;
}

.results-table td:first-child {
    text-align: left;
    font-weight: 500;
}

#areaUnit {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #cccccc !important;
    border-radius: 4px;
    font-size: 11px;
    padding: 4px 8px;
    width: 60px;
}

#areaUnit option {
    background: #ffffff !important;
    color: #000000 !important;
}

.copy-btn {
    background: none;
    border: none;
    color: #000000;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.info-tooltip {
    display: inline-block;
    cursor: pointer;
    margin-left: 8px;
    font-size: 16px;
    opacity: 0.8;
    transition: all 0.2s ease;
    user-select: none;
}

.info-tooltip:hover {
    opacity: 1;
    transform: scale(1.2);
}

.custom-tooltip {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.leaflet-control-cadastral {
    background: white;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    margin-top: 10px;
}



/* North arrow */
.leaflet-control-north {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 1002 !important;
    pointer-events: none;
}

.north-arrow {
    font-size: 24px;
    color: #dc2626;
    text-shadow: 0 0 4px rgba(220, 38, 38, 0.8), 0 2px 4px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
    filter: drop-shadow(0 0 6px rgba(220, 38, 38, 0.6));
}

.north-arrow span {
    font-size: 12px;
    font-weight: bold;
    margin-left: 2px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    text-shadow: none;
}

/* Map rotation */
.leaflet-container {
    transition: transform 0.3s ease;
}

/* UTM grid styles */
.utm-grid-line {
    pointer-events: none;
    opacity: 0.2;
}

/* Magnetic grid */
.magnetic-grid-line {
    pointer-events: none;
    opacity: 0.08;
}



/* Compass animation */
@keyframes compassSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.compass-spinning {
    animation: compassSpin 0.5s ease-in-out;
}

.leaflet-control-measure {
    background: white;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    margin-top: 10px;
}

.leaflet-control-measure button {
    width: 30px;
    height: 30px;
    background: white;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.leaflet-control-measure button:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.cadastral-overlay {
    filter: sepia(100%) hue-rotate(200deg) saturate(200%);
}

/* 4K export styles */
.marker-tooltip-4k {
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    border: 2px solid #000 !important;
    border-radius: 6px !important;
    font-size: 24px !important;
    font-weight: bold !important;
    padding: 8px 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}

.marker-tooltip-4k::before {
    border-top-color: #000 !important;
}

.custom-marker-enhanced {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Drag and Drop for table */
tr[draggable="true"] {
    cursor: move;
    transition: all 0.2s ease;
}

tr[draggable="true"]:hover {
    background: rgba(0, 0, 0, 0.05);
}

tr[draggable="true"].dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #000000;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #333333;
}

::-webkit-scrollbar-corner {
    background: #f0f0f0;
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #000000 #f0f0f0;
}

/* Bottom sheet layout for tablets and phones */
@media (max-width: 1024px) {
    :root {
        --sheet-open-height: min(72dvh, 720px);
        --sheet-peek-height: 56px;
        --sheet-drag-zone: 72px;
    }

    .container {
        height: 100dvh;
    }

    #map {
        height: 100dvh;
    }

    .sidebar {
        width: 100%;
        max-width: 100%;
        height: var(--sheet-open-height);
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        padding: calc(var(--sheet-drag-zone) + 8px) 18px 16px;
        border-top: 1px solid #cccccc;
        border-right: none;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
        transition: transform 0.3s ease;
    }

    .sidebar.dragging {
        transition: none;
    }

    .sheet-handle {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: var(--sheet-drag-zone);
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: none;
        cursor: grab;
        z-index: 3;
    }

    .sheet-handle::after {
        content: '';
        width: 52px;
        height: 6px;
        border-radius: 999px;
        background: rgba(0, 0, 0, 0.25);
    }

    .sheet-handle:active {
        cursor: grabbing;
    }

    .sheet-header {
        touch-action: none;
        cursor: grab;
    }

    .sheet-header:active {
        cursor: grabbing;
    }

    .sidebar.hidden {
        transform: translateY(calc(100% - var(--sheet-peek-height)));
    }

    .nav-buttons {
        top: 10px;
        left: 10px;
        gap: 8px;
    }

    .nav-buttons a {
        padding: 6px 10px;
        font-size: 11px;
    }

    #toggleBtn {
        width: 32px !important;
        height: 32px !important;
        font-size: 16px !important;
        margin-right: 6px !important;
    }

    h1 {
        font-size: 20px;
        margin-bottom: 18px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-group input,
    .form-group select {
        padding: 10px;
        font-size: 14px;
    }

    #pointsTable {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #pointsTable table {
        min-width: 560px;
    }

    .actions {
        gap: 8px;
    }

    .action-row,
    .action-group {
        flex-direction: column;
    }

    .action-row button,
    .action-group button,
    .action-group select {
        width: 100%;
    }

    .actions button,
    .actions select {
        font-size: 14px !important;
        padding: 12px 14px !important;
    }

    .points-table th,
    .points-table td {
        padding: 12px 8px;
    }

    .leaflet-top.leaflet-left {
        top: 60px !important;
    }

    .leaflet-control-layers {
        top: 170px !important;
        right: 10px !important;
    }
}

@media (max-width: 600px) {
    :root {
        --sheet-open-height: min(78dvh, 680px);
        --sheet-peek-height: 48px;
        --sheet-drag-zone: 64px;
    }

    .sidebar {
        padding: calc(var(--sheet-drag-zone) + 6px) 12px 12px;
        border-radius: 14px 14px 0 0;
    }

    .sheet-handle {
        height: var(--sheet-drag-zone);
    }

    .sheet-handle::after {
        width: 44px;
        height: 5px;
    }

    .nav-buttons {
        top: 8px;
        left: 8px;
    }

    #toggleBtn {
        width: 28px !important;
        height: 28px !important;
        font-size: 14px !important;
    }

    .nav-buttons a {
        padding: 5px 8px;
        font-size: 10px;
    }

    h1 {
        font-size: 18px;
    }

    .site-name-group {
        padding: 12px;
    }

    .points-table th,
    .points-table td {
        font-size: 11px;
    }

    .points-table input {
        font-size: 11px;
        min-width: 64px;
    }

    .results-table td {
        font-size: 12px;
        padding: 10px 6px;
    }

    #areaUnit {
        width: 52px;
    }
}
