/* CSS Variables - Professional Dark Theme */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-secondary: #cbd5e1;
    --border: #334155;
    --success: #22c55e;
    --error: #ef4444;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.5;
    font-size: 15px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
    color: white;
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
}

.nav-links a:hover {
    color: var(--text);
}

/* Hero Section */
.hero {
    padding: 7rem 0 3rem;
    border-bottom: 1px solid var(--border);
}

.hero-content {
    max-width: 600px;
}

.hero-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text);
}

.gradient-text {
    color: var(--primary);
}

.hero-description {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.hero-stats {
    display: flex;
    gap: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.stat {
    text-align: left;
}

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    transition: background 0.15s, border-color 0.15s;
}

.btn-lg {
    padding: 0.625rem 1.25rem;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-accent {
    background: var(--success);
    color: white;
}

.btn-accent:hover {
    background: #16a34a;
}

/* Section Styles */
.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-bottom: 2rem;
}

/* Features Section */
.features {
    padding: 3rem 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.feature-card {
    padding: 1.25rem;
}

.feature-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-input);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.feature-icon svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.feature-card h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* How It Works Section */
.how-it-works {
    padding: 3rem 0;
    border-bottom: 1px solid var(--border);
}

.steps {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.step {
    flex: 1;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--bg-input);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.step-content h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text);
}

.step-content p {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.step-connector {
    flex: 0 0 40px;
    height: 1px;
    background: var(--border);
    margin-top: 16px;
}

/* Files Section */
.files-section {
    padding: 3rem 0;
}

.search-box {
    position: relative;
    max-width: 400px;
    margin-bottom: 1.5rem;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

#searchInput {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    font-size: 0.875rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    transition: border-color 0.15s;
}

#searchInput::placeholder {
    color: var(--text-muted);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary);
}

.kml-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kml-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.kml-card:hover {
    border-color: var(--text-muted);
}

.kml-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.kml-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-input);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kml-icon svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.kml-info {
    flex: 1;
    min-width: 0;
}

.kml-info h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.125rem;
    word-break: break-word;
}

.kml-meta {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.kml-description {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin: 0.25rem 0;
}

.kml-attribution {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.375rem;
}

.kml-attribution a {
    color: var(--primary);
    text-decoration: none;
}

.kml-attribution a:hover {
    text-decoration: underline;
}

.kml-actions {
    display: flex;
    gap: 0.5rem;
}

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

/* Loading State */
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 0.75rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* Last Update */
.last-update {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.last-update svg {
    width: 14px;
    height: 14px;
}

/* Footer */
.footer {
    padding: 2rem 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.footer-brand p {
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-size: 0.875rem;
    max-width: 280px;
}

.footer-links h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.footer-links a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
    transition: color 0.15s;
}

.footer-links a:hover {
    color: var(--text);
}

.footer-disclaimer {
    grid-column: 1 / -1;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.footer-disclaimer h4 {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.footer-disclaimer p {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.footer-disclaimer a {
    color: var(--primary);
    text-decoration: none;
}

.footer-disclaimer a:hover {
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.75);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 100%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    width: 28px;
    height: 28px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.modal-close:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

.modal-body {
    position: relative;
    flex: 1;
    min-height: 450px;
}

.map-container {
    width: 100%;
    height: 100%;
    min-height: 450px;
    background: var(--bg-input);
}

.map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-input);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.2s ease;
    max-width: 320px;
    font-size: 0.875rem;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--error);
}

.toast-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--error);
}

.toast-message {
    flex: 1;
    color: var(--text);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.hiding {
    animation: slideOut 0.2s ease forwards;
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-content {
        grid-template-columns: 1fr 1fr;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .hero {
        padding: 5rem 0 2rem;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-stats {
        gap: 1.5rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .steps {
        flex-direction: column;
        gap: 1.5rem;
    }

    .step-connector {
        display: none;
    }

    .kml-grid {
        grid-template-columns: 1fr;
    }

    .kml-actions {
        flex-direction: column;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
    }

    .toast {
        max-width: none;
    }
}

/* Leaflet Customization */
.leaflet-container {
    font-family: inherit;
}

.leaflet-popup-content-wrapper {
    background: var(--bg-card);
    color: var(--text);
    border-radius: 6px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.leaflet-popup-content {
    margin: 0.75rem;
    font-size: 0.875rem;
}

.leaflet-popup-tip {
    background: var(--bg-card);
}
