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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    background: linear-gradient(135deg, #1a1f2e 0%, #151920 100%);
    min-height: 100vh;
    padding: 2rem;
    color: #e5e7eb;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: #2B3544;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: #252D3A;
    color: white;
    padding: 2.5rem 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: #ffffff;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.7;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
}

main {
    padding: 2rem;
}

section {
    margin-bottom: 2rem;
    background: #252D3A;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.progress-section,
.result-section {
    transition: opacity 0.5s ease-out;
}

.fade-out {
    opacity: 0;
}

h2 {
    color: #5DD3A7;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.help-text {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.help-text-small {
    color: #9ca3af;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.example {
    background: #1f2937;
    border: 1px solid rgba(93, 211, 167, 0.3);
    border-left: 1px solid #5DD3A7;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 8px;
}

.example strong {
    color: #5DD3A7;
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.example pre {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    margin: 0;
    color: #d1d5db;
}

.api-key-group {
    margin-bottom: 1.5rem;
}

.api-key-group label {
    display: block;
    color: #9ca3af;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Custom checkbox styling - updated */
.checkbox-group {
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(93, 211, 167, 0.3);
    border-radius: 4px;
    background: #1f2937;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-group input[type="checkbox"]:hover {
    border-color: rgba(93, 211, 167, 0.5);
    background: #2B3544;
}

.checkbox-group input[type="checkbox"]:checked {
    background: #5DD3A7;
    border-color: #5DD3A7;
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #1f2937;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-group label {
    color: #e5e7eb;
    font-size: 0.95rem;
    cursor: pointer;
    user-select: none;
}

#apiKeyInput {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid rgba(93, 211, 167, 0.2);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    transition: border-color 0.3s, background-color 0.3s;
    background: #1f2937;
    color: #e5e7eb;
}

#apiKeyInput:focus {
    outline: none;
    border-color: #5DD3A7;
    background: #2B3544;
}

#apiKeyInput::placeholder {
    color: #6b7280;
}

#kmlApiKeyInput {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid rgba(93, 211, 167, 0.2);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    transition: border-color 0.3s, background-color 0.3s;
    background: #1f2937;
    color: #e5e7eb;
}

#kmlApiKeyInput:focus {
    outline: none;
    border-color: #5DD3A7;
    background: #2B3544;
}

#kmlApiKeyInput::placeholder {
    color: #6b7280;
}

#addressInput {
    width: 100%;
    padding: 1rem;
    border: 1px solid rgba(93, 211, 167, 0.2);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 1rem;
    transition: border-color 0.3s, background-color 0.3s;
    background: #1f2937;
    color: #e5e7eb;
}

#addressInput:focus {
    outline: none;
    border-color: #5DD3A7;
    background: #2B3544;
}

#addressInput::placeholder {
    color: #6b7280;
}

.btn-primary {
    background: #5DD3A7;
    color: #1f2937;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(93, 211, 167, 0.3);
    background: #6fe0b8;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.progress-bar-container {
    width: 100%;
    height: 30px;
    background: #3f4b5c;
    border-radius: 15px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #5DD3A7 0%, #6fe0b8 100%);
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1f2937;
    font-weight: 700;
}

.progress-text {
    text-align: center;
    font-size: 1.1rem;
    color: #d1d5db;
    margin: 0.5rem 0;
    font-weight: 500;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}

.stat {
    font-size: 1rem;
    color: #9ca3af;
}

.stat.successful {
    color: #5DD3A7;
}

.stat.failed {
    color: #ef4444;
}

.stat strong {
    font-size: 1.5rem;
    display: block;
    margin-top: 0.25rem;
}

.success-message {
    background: #1f3a2e;
    border: 1px solid rgba(93, 211, 167, 0.3);
    border-left: 1px solid #5DD3A7;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
}

.success-message h3 {
    color: #5DD3A7;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.success-message p {
    color: #9ca3af;
    margin-bottom: 1rem;
}

.error-message {
    background: #3a1f1f;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 1px solid #ef4444;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
}

.error-message h3 {
    color: #ef4444;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.error-message p {
    color: #9ca3af;
}

.btn-download {
    display: inline-block;
    background: #5DD3A7;
    color: #1f2937;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(93, 211, 167, 0.3);
    background: #6fe0b8;
}

#failedList {
    list-style: none;
    padding: 0;
}

#failedList li {
    background: #3a1f1f;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 1px solid #ef4444;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    color: #fca5a5;
}

/* Input section specific styling */
.input-section {
    background: #252D3A;
}

/* Scrollbar styling for dark theme */
#addressInput::-webkit-scrollbar {
    width: 8px;
}

#addressInput::-webkit-scrollbar-track {
    background: #1f2937;
    border-radius: 4px;
}

#addressInput::-webkit-scrollbar-thumb {
    background: #5DD3A7;
    border-radius: 4px;
}

#addressInput::-webkit-scrollbar-thumb:hover {
    background: #6fe0b8;
}

/* Tab Navigation */
.tabs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 2rem 0 2rem;
    background: #2B3544;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    background: transparent;
    color: #9ca3af;
    border: none;
    padding: 0.875rem 1.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #5DD3A7;
}

.tab-btn.active {
    color: #5DD3A7;
    border-bottom-color: #5DD3A7;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* File Upload Area */
.file-upload-area {
    margin-bottom: 1.5rem;
}

.optional-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.optional-section h3 {
    color: #9ca3af;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#kmlFileInput,
#routeFilesInput {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.file-upload-label {
    display: block;
    width: 100%;
    padding: 2rem;
    border: 2px dashed rgba(93, 211, 167, 0.3);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #1f2937;
}

.file-upload-label:hover {
    border-color: #5DD3A7;
    background: #252D3A;
}

.file-upload-label span {
    color: #9ca3af;
    font-size: 1rem;
}

.file-upload-label:hover span {
    color: #5DD3A7;
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 1rem;
    }

    section {
        padding: 1rem;
    }

    .stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tabs {
        padding: 0.5rem 1rem 0 1rem;
        gap: 0.25rem;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
}
