/* Enhanced Course Encoder Styles - Dark Theme with BCC Red */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;850&display=swap');

:root {
  /* BCC red brand colors */
  --brand-h: 354; --brand-s: 86%; --brand-l: 54%;          /* BCC red */
  --brand: hsl(var(--brand-h) var(--brand-s) var(--brand-l));
  --brand-600: hsl(var(--brand-h) var(--brand-s) calc(var(--brand-l) - 8%));
  --brand-700: hsl(var(--brand-h) var(--brand-s) calc(var(--brand-l) - 14%));

  /* dark neutrals */
  --bg:    hsl(222 18% 8%);     /* page */
  --surface:hsl(222 18% 12%);    /* cards/sections */
  --text:  hsl(0 0% 98%);
  --muted: hsl(220 10% 66%);
  --line:  hsl(220 12% 20%);

  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.35);
  --shadow-2: 0 10px 40px rgba(0,0,0,.45);
}

/* Light theme variant */
[data-theme="light"] {
  --bg: hsl(0 0% 100%);
  --surface: hsl(0 0% 100%);
  --text: hsl(222 24% 12%);
  --muted: hsl(222 10% 40%);
  --line: hsl(220 10% 88%);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    /* Procedural dots background */
    background:
        radial-gradient(hsl(0 0% 100% / .06) 1px, transparent 1px) 0 0 / 22px 22px,
        radial-gradient(hsl(0 0% 100% / .03) 1px, transparent 1px) 11px 11px / 22px 22px,
        var(--bg);
}

#app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
#app-header {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(1200px 600px at 80% -10%, hsl(var(--brand-h) var(--brand-s) / .18), transparent 60%),
        var(--surface);
    color: var(--text);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-2);
    z-index: 1000;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
}

#app-header h1 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    line-height: .95;
    letter-spacing: -.01em;
}

#header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Mode Toggle Styles */
#app-mode-toggle-container {
    display: flex;
    align-items: center;
}

.mode-toggle {
    display: flex;
    background-color: hsl(220 12% 20%);
    border-radius: 20px;
    padding: 3px;
    position: relative;
    overflow: hidden;
}

.mode-toggle input[type="radio"] {
    display: none;
}

.mode-toggle label {
    padding: 6px 16px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    border-radius: 20px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    margin: 0;
    width: auto;
    color: var(--muted);
}

.mode-toggle input[type="radio"]:checked + label {
    color: white;
    background-color: var(--brand);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.mode-toggle label a {
    color: inherit;
    text-decoration: none;
}

/* Settings Menu Dropdown */
.settings-menu {
    position: relative;
    display: inline-block;
}

.settings-menu .btn {
    padding: 0.6rem; /* Make it more circular */
    line-height: 1;
}

.dropdown-content {
    display: none; /* Hidden by default */
    position: absolute;
    right: 0;
    background-color: var(--surface);
    min-width: 160px;
    box-shadow: var(--shadow-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    z-index: 1001;
    padding: 0.5rem 0;
    margin-top: 8px;
}

/* Use a class to show the dropdown */
.dropdown-content.show {
    display: block;
}

.dropdown-content #logout-button {
    /* Reset default button styles from auth-styles.css */
    color: var(--text);
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 0;
}

.mode-toggle label a:hover {
    text-decoration: none;
}

/* Main Content */
#main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Form Panel */
#form-panel {
    width: 400px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-1);
}

#course-encoder-form {
    flex: 1;
    padding: 1rem;
}

/* Form Sections */
.form-section {
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-1);
    position: relative;
}

.form-section.collapsed .section-content {
    display: none;
}

.section-header {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(800px 400px at 50% -20%, hsl(var(--brand-h) var(--brand-s) / .08), transparent 50%),
        hsl(222 18% 14%);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
    transition: all 0.2s ease;
}

.section-header:hover {
    background:
        radial-gradient(800px 400px at 50% -20%, hsl(var(--brand-h) var(--brand-s) / .12), transparent 50%),
        hsl(222 18% 16%);
}

.section-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.collapse-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--muted);
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.collapse-btn:hover {
    background: hsl(220 12% 25%);
    color: var(--text);
}

.section-content {
    padding: 1rem;
}

/* Form Groups */
.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.875rem;
    background: hsl(222 18% 10%);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px hsl(var(--brand-h) var(--brand-s) / .1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--muted);
}

/* Checkbox Groups */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkbox-group label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

/* Slider Groups */
.slider-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.slider-group input[type="range"] {
    flex: 1;
}

.slider-group input[type="number"] {
    width: 80px;
    flex-shrink: 0;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--line);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--brand);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--brand-600);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--brand);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Buttons */
.btn {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.1rem;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid hsl(0 0% 100% / .08);
    background: hsl(222 18% 14%);
    color: var(--text);
    box-shadow: var(--shadow-1);
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
    cursor: pointer;
    font-size: 0.875rem;
}

/* Process KML button - White hollow */
.btn-primary {
    background: transparent;
    color: var(--text);
    border: 1px solid hsl(0 0% 100% / .3);
}

.btn-primary:hover {
    background: hsl(0 0% 100% / .1);
    border-color: hsl(0 0% 100% / .5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Preview buttons - Red glow emanating from behind */
.btn-secondary {
    background: var(--bg);  /* Same as page background */
    color: var(--text);
    border: 1px solid hsl(var(--brand-h) var(--brand-s) / .2);
    position: relative;
    z-index: 1;
}

.btn-secondary::before {
    content: "";
    position: absolute;
    inset: -40% -25%;
    background: radial-gradient(closest-side, var(--brand) 0%, transparent 70%);
    filter: blur(18px);
    opacity: .55;
    z-index: -1;
    transition: opacity .2s, transform .2s;
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 40px hsl(var(--brand-h) var(--brand-s) / .15);
    border-color: hsl(var(--brand-h) var(--brand-s) / .4);
}

.btn-secondary:hover::before {
    opacity: .8;
    transform: scale(1.04);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Reset button - White hollow */
.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid hsl(0 0% 100% / .3);
}

.btn-outline:hover {
    background: hsl(0 0% 100% / .1);
    border-color: hsl(0 0% 100% / .5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.btn-outline:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--line);
    background: hsl(222 18% 14%);
    margin: 0 -1rem -1rem -1rem;
}

.form-actions .btn {
    flex: 1;
}

/* Status Section */
#status-section {
    padding: 1rem;
    border-top: 1px solid var(--line);
    background: hsl(222 18% 14%);
}

#status-message {
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    display: none;
}

#status-message.info {
    background: hsl(220 60% 20%);
    color: hsl(220 60% 80%);
    border: 1px solid hsl(220 60% 30%);
    display: block;
}

#status-message.success {
    background: hsl(142 60% 20%);
    color: hsl(142 60% 80%);
    border: 1px solid hsl(142 60% 30%);
    display: block;
}

#status-message.error {
    background: hsl(0 60% 20%);
    color: hsl(0 60% 80%);
    border: 1px solid hsl(0 60% 30%);
    display: block;
}

#processing-stats {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

#output-kmls h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

#kml-download-list {
    list-style: none;
}

#kml-download-list li {
    margin-bottom: 0.25rem;
}

#kml-download-list a {
    color: var(--brand);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: block;
    transition: background-color 0.2s;
}

#kml-download-list a:hover {
    background: hsl(220 12% 20%);
    text-decoration: underline;
}

/* KML file container styles */
.kml-file-container {
    display: flex;
    flex-wrap: wrap; /* Allow items to wrap to the next line */
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background: hsl(222 18% 14%);
}

.kml-filename {
    font-weight: 500;
    color: var(--text);
    flex: 1 1 60%; /* Allow filename to take up more space, but wrap if needed */
    min-width: 150px; /* Ensure filename has a minimum width */
    word-break: break-all; /* Break long words */
}

.kml-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap; /* Allow buttons to wrap if needed */
    margin-top: 0.5rem; /* Add some space if wrapped */
}

/* Adjust button size for smaller screens if necessary */
@media (max-width: 480px) {
    .kml-download-btn, .kml-generate-btn {
        flex: 1 1 auto; /* Allow buttons to take full width if wrapped */
        text-align: center;
    }
}


/* Generated link display styles */
.kml-link-display {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: hsl(222 18% 10%);
    border-radius: 6px;
    border: 1px solid var(--line);
}

.generated-link strong {
    color: var(--text);
    display: block;
    margin-bottom: 0.5rem;
}

.link-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.link-input {
    flex: 1;
    padding: 0.375rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: hsl(222 18% 8%);
    color: var(--text);
    font-size: 0.8rem;
    font-family: monospace;
}

.copy-link-btn {
    padding: 0.375rem 0.75rem;
    background: hsl(142 60% 50%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
}

.copy-link-btn:hover {
    background: hsl(142 60% 45%);
}

.expiration-info {
    color: var(--muted);
    font-size: 0.75rem;
}

/* Expiration modal styles */
.expiration-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-2);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: var(--text);
}

.modal-content p {
    margin-bottom: 1rem;
    color: var(--muted);
}

.expiration-options {
    margin-bottom: 1.5rem;
}

.expiration-options label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.expiration-options label:hover {
    background: hsl(220 12% 20%);
}

.expiration-options input[type="radio"] {
    margin-right: 0.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Map Panel */
#map-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface);
}

#map-controls {
    padding: 1rem;
    background: hsl(222 18% 14%);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.control-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text);
}

.control-group input[type="checkbox"] {
    margin: 0;
}

#map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(34, 40, 49, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--line);
    border-top: 4px solid var(--brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Bottom section container for legend and history */
#map-bottom-section {
    display: flex;
    background: hsl(222 18% 14%);
    border-top: 1px solid var(--line);
}

#map-legend {
    flex: 1;
    padding: 1rem;
    border-right: 1px solid var(--line);
}

#map-legend h4 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    #main-content {
        flex-direction: column;
    }
    
    #form-panel {
        width: 100%;
        max-height: 50vh;
    }
    
    #map-panel {
        min-height: 50vh;
    }
}

.dropdown-content #logout-button:hover {
    background-color: hsl(var(--brand-h) var(--brand-s) / .1);
}


@media (max-width: 768px) {
    #app-header {
        padding: 0.75rem 1rem;
    }
    
    #app-header h1 {
        font-size: 1.25rem;
    }
    
    #header-controls {
        gap: 0.25rem;
    }
    
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    #form-panel {
        max-height: 60vh;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .control-group {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .control-group label {
        font-size: 0.8rem;
    }
}

/* Custom Scrollbar */
#form-panel::-webkit-scrollbar {
    width: 6px;
}

#form-panel::-webkit-scrollbar-track {
    background: var(--surface);
}

#form-panel::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 3px;
}

#form-panel::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* Validation States */
.form-group.valid input,
.form-group.valid select {
    border-color: #10b981;
}

.form-group.invalid input,
.form-group.invalid select {
    border-color: #ef4343;
}

/* New styles for datetime and timezone inputs */
.form-group input[type="datetime-local"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.875rem;
    background: hsl(222 18% 10%);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px hsl(var(--brand-h) var(--brand-s) / .1);
}

.timezone-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.timezone-group .timezone-select {
    flex: 2; /* Give more space to timezone select */
}

.timezone-group .unix-time-display {
    flex: 1; /* Give less space to unix time display */
    background: hsl(222 18% 10%);
    color: var(--muted);
    cursor: default;
}

/* Animation for smooth transitions */
.section-content {
    transition: all 0.3s ease;
}

.form-group .validation-message.valid {
    color: #10b981;
}

.form-group .validation-message.invalid {
    color: #ef4444;
}

/* Animation for smooth transitions */
.section-content {
    transition: all 0.3s ease;
}

.form-section {
    transition: all 0.2s ease;
}

/* Focus states for accessibility */
.collapse-btn:focus,
.btn:focus,
input:focus,
select:focus {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* Link Drop Zone styles */
#link-drop-zone {
    padding: 1rem;
    border-top: 1px solid var(--line);
    background: hsl(222 18% 14%);
    margin-top: 1rem;
}

#link-drop-zone h4 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.link-drop-item {
    background: hsl(222 18% 10%);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.link-drop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.link-drop-header strong {
    color: var(--text);
    font-size: 0.875rem;
}

.link-timestamp {
    color: var(--muted);
    font-size: 0.75rem;
}

/* KML Link History styles */
#kml-link-history {
    flex: 1;
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

#kml-link-history h4 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

#kml-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

#kml-history-list li {
    background: hsl(222 18% 10%);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

#kml-history-list li a {
    color: var(--brand);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    word-break: break-all;
}

#kml-history-list li a:hover {
    text-decoration: underline;
}

#kml-history-list li span {
    font-size: 0.75rem;
    color: var(--muted);
}

#kml-history-list li .expiration-status {
    font-weight: 500;
}

.expired {
    color: #ff6b6b;
}

.expires-soon {
    color: #ffd166;
}

.active {
    color: #66ff66;
}

/* History item layout */
.history-item-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.history-item-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.history-item-main a {
    flex: 1;
    min-width: 0; /* Allow text to truncate */
    word-break: break-all;
}

/* Eye button styling */
.eye-btn {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-600) 100%);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.3);
    padding: 6px;
}

.eye-btn:hover {
    background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-700) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.4);
}

.eye-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.3);
}

.eye-btn:focus {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* Eye icon image styling */
.eye-icon {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1); /* Make the image white */
    transition: all 0.2s ease;
}

.eye-btn:hover .eye-icon {
    transform: scale(1.1);
}

/* Custom scrollbar for KML history */
#kml-link-history::-webkit-scrollbar {
    width: 6px;
}

#kml-link-history::-webkit-scrollbar-track {
    background: hsl(222 18% 14%);
}

#kml-link-history::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 3px;
}

#kml-link-history::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* InfoWindow styles - Override Google Maps default styling */
.gm-style .gm-style-iw-c {
    padding: 0 !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

.gm-style .gm-style-iw-d {
    overflow: hidden !important;
    border-radius: 8px !important;
}

.gm-style .gm-style-iw-t::after {
    background: linear-gradient(135deg, #e91e63 0%, #ad1457 100%) !important;
    border-radius: 0 0 0 8px !important;
}

/* Hide ALL white sections and default elements */
.gm-style .gm-style-iw-tc,
.gm-style .gm-style-iw-t,
.gm-style .gm-ui-hover-effect {
    display: none !important;
}

/* Hide the default close button container */
.gm-style .gm-style-iw button[title="Close"] {
    display: none !important;
}

/* Hide any remaining white background elements */
.gm-style .gm-style-iw::before,
.gm-style .gm-style-iw::after {
    display: none !important;
}

/* Ensure our custom close button in the content area is visible */
.gm-style .gm-style-iw-d button {
    display: flex !important;
}

/* Remove any white backgrounds from the InfoWindow container */
.gm-style .gm-style-iw {
    background: transparent !important;
}

/* Remove white background from the main container */
.gm-style .gm-style-iw-c {
    background: transparent !important;
}

/* KML Splitting Tool Styles */
.split-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.split-header label {
    margin-bottom: 0;
}

.unit-toggle {
    display: flex;
    background-color: hsl(220 12% 20%);
    border-radius: 12px;
    padding: 2px;
    gap: 2px;
}

.unit-toggle input[type="radio"] {
    display: none;
}

.unit-toggle label {
    padding: 4px 12px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.2s ease;
    margin: 0;
    color: var(--muted);
}

.unit-toggle input[type="radio"]:checked + label {
    color: white;
    background-color: var(--brand);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Dual Slider Container */
.dual-slider-container {
    padding: 2rem 0.5rem 1rem 0.5rem;
    position: relative;
}

.dual-slider-track {
    position: relative;
    height: 8px;
    background: var(--line);
    border-radius: 4px;
    cursor: pointer;
}

.dual-slider-range {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand-600) 100%);
    border-radius: 4px;
    pointer-events: none;
}

.dual-slider-handle {
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    border: 3px solid var(--brand);
    border-radius: 50%;
    cursor: grab;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dual-slider-handle:hover {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.4);
}

.dual-slider-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(233, 30, 99, 0.5);
}

.handle-label {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    color: var(--text);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--line);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.handle-label::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--line);
}

/* Precise Inputs */
.precise-inputs {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.precise-input-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.precise-input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.stepper-input {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: hsl(222 18% 10%);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    height: 40px;
}

.stepper-buttons {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--line);
    flex-shrink: 0;
}

.stepper-btn {
    background: hsl(220 12% 20%);
    border: none;
    color: var(--text);
    width: 24px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.stepper-btn-up {
    border-bottom: 0.5px solid var(--line);
}

.stepper-btn-down {
    border-top: 0.5px solid var(--line);
}

.stepper-btn:hover {
    background: var(--brand);
    color: white;
}

.stepper-btn:active {
    transform: scale(0.95);
}

.stepper-input input[type="number"] {
    flex: 1;
    border: none;
    background: hsl(222 18% 10%);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: left;
    min-width: 70px;
    height: 100%;
}

.stepper-input input[type="number"]:focus {
    outline: none;
    background: hsl(222 18% 12%);
}

/* Hide spinner buttons for number input */
.stepper-input input[type="number"]::-webkit-inner-spin-button,
.stepper-input input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.stepper-input input[type="number"] {
    -moz-appearance: textfield;
}

.stepper-unit {
    background: hsl(220 12% 20%);
    color: var(--muted);
    padding: 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    flex-shrink: 0;
    border-left: 1px solid var(--line);
}

/* Split Info Stats */
.split-info {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: hsl(222 18% 10%);
    border-radius: 8px;
    border: 1px solid var(--line);
}

.split-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.split-stat-label {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 500;
}

.split-stat-value {
    font-size: 1.1rem;
    color: var(--brand);
    font-weight: 700;
}

.btn-block {
    width: 100%;
    margin-bottom: 0.5rem;
}

.btn-block:last-child {
    margin-bottom: 0;
}

/* Print styles */
@media print {
    #app-header,
    #form-panel {
        display: none;
    }

    #map-panel {
        width: 100%;
        height: 100vh;
    }
}
