/* Base Styles & Variables */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #1abc9c;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-color: #f8f9fa;
    --dark-color: #2c3e50;
    --gray-color: #7f8c8d;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.2s ease;
    --sidebar-width: 320px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.5;
    color: var(--dark-color);
    background: #f5f7fa;
    min-height: 100vh;
    font-size: 14px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 15px;
    padding: 15px 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border-bottom: 3px solid var(--secondary-color);
}

header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 600;
}

.subtitle {
    color: var(--gray-color);
    font-size: 0.9rem;
    font-weight: 400;
}

/* App Layout */
.app-layout {
    display: flex;
    flex: 1;
    gap: 20px;
    min-height: 0;
}

.sidebar {
    flex: 0 0 var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    max-height: calc(100vh - 150px);
}

.map-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    padding: 18px;
    box-shadow: var(--box-shadow);
    border: 1px solid #eaeaea;
}

.card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.card h2 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

/* Status indicators */
.file-count, .mode-indicator, .export-count, .color-indicator {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 12px;
    background: #f0f7ff;
    color: var(--secondary-color);
}

.color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Upload Area */
.file-upload-area {
    border: 2px dashed #dce4f7;
    border-radius: var(--border-radius);
    padding: 25px 15px;
    text-align: center;
    background-color: #fafcff;
    transition: var(--transition);
    cursor: pointer;
    margin-bottom: 12px;
}

.file-upload-area:hover {
    border-color: var(--secondary-color);
    background-color: #f0f7ff;
}

.upload-icon {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.file-types {
    color: var(--gray-color);
    font-size: 0.8rem;
    margin: 8px 0;
}

.file-limit {
    color: var(--warning-color);
    font-size: 0.8rem;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.upload-status {
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 0.85rem;
    min-height: 20px;
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: white;
    font-weight: 600;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #ecf0f1;
    color: var(--dark-color);
    border: 1px solid #d5dbdb;
}

.btn-secondary:hover {
    background-color: #e0e7e8;
}

.btn-export {
    background-color: var(--accent-color);
    color: white;
    flex: 1;
    font-weight: 600;
}

.btn-export:hover {
    background-color: #16a085;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn.compact {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    background-color: #ecf0f1;
    border-radius: 6px;
    padding: 4px;
    margin-bottom: 15px;
}

.toggle-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.9rem;
}

.toggle-btn.active {
    background-color: white;
    color: var(--secondary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.method-content {
    padding: 12px 0;
}

/* Form Controls */
.form-group.compact {
    margin-bottom: 15px;
}

.form-group.compact label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--dark-color);
}

.form-control.compact {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dce4f7;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    background: #fafcff;
    transition: var(--transition);
}

.form-control.compact:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: white;
}

/* API Key Input */
.input-with-help.compact {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.input-with-help.compact input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #dce4f7;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    background: #fafcff;
}

.help-link {
    color: var(--secondary-color);
    font-size: 1rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f0f7ff;
    border-radius: 6px;
}

/* Color Picker */
.color-picker-group {
    margin-top: 15px;
}

.color-picker {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--dark-color);
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

/* Export Section */
.export-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Geocoding Progress */
.geocoding-progress {
    margin-top: 15px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #eaeaea;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: var(--dark-color);
}

#progressPercent {
    font-weight: 600;
    color: var(--secondary-color);
}

.progress-bar {
    height: 6px;
    background: #e0e6ed;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

/* Map Container */
.map-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 12px 15px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.map-header h2 {
    color: var(--primary-color);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.map-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stats {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--gray-color);
}

.stats span {
    padding: 4px 8px;
    background: #f8fafc;
    border-radius: 4px;
    font-weight: 500;
}

.map-buttons {
    display: flex;
    gap: 8px;
}

#map {
    flex: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    min-height: 400px;
    border: 1px solid #eaeaea;
}

/* Status Messages */
.upload-status {
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 0.85rem;
    min-height: 20px;
}

.success {
    background-color: rgba(26, 188, 156, 0.1);
    color: #16a085;
    border-left: 3px solid var(--accent-color);
    padding: 8px 12px;
}

.error {
    background-color: rgba(231, 76, 60, 0.1);
    color: #c0392b;
    border-left: 3px solid var(--danger-color);
    padding: 8px 12px;
}

.warning {
    background-color: rgba(243, 156, 18, 0.1);
    color: #d35400;
    border-left: 3px solid var(--warning-color);
    padding: 8px 12px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 15px;
    padding: 15px;
    color: var(--gray-color);
    font-size: 0.85rem;
    border-top: 1px solid #eaeaea;
}

footer a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

.footer-note {
    font-size: 0.8rem;
    color: #95a5a6;
    margin-top: 5px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .app-layout {
        flex-direction: column;
    }
    
    .sidebar {
        flex: 0 0 auto;
        max-height: none;
    }
    
    :root {
        --sidebar-width: 100%;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 12px 15px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .map-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .map-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .export-buttons {
        flex-direction: column;
    }
    
    .toggle-switch {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}