/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #de302b 0%, #f5a4a4 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header-content i {
    font-size: 3rem;
    color: #de302b;
    margin-bottom: 1rem;
}

.header-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 700;
}

.header-content p {
    font-size: 1.1rem;
    color: #7f8c8d;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Country Selection */
.country-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.country-tabs {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.country-btn {
    padding: 12px 20px;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

.country-btn.active {
    background: #de302b;
    color: white;
    border-color: #de302b;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.country-btn:hover:not(.active) {
    border-color: #de302b;
    transform: translateY(-2px);
}

/* Search Section */
.search-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.search-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn.active {
    background: #de302b;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.tab-btn:hover:not(.active) {
    background: #e9ecef;
}

.tab-content {
    display: none;
}

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

.search-form {
    margin-bottom: 1rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.input-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #de302b;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Autocomplete Styles */
.autocomplete-container {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 160px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background-color: #f8f9fa;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.coordinates-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.search-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #de302b 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Loading Spinner */
.loading {
    display: none;
    text-align: center;
    padding: 3rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #de302b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Error Message */
.error-message {
    display: none;
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 10px;
    border-left: 4px solid #dc3545;
    margin: 1rem 0;
}

.error-message i {
    margin-right: 8px;
}

/* Results Section */
.results-section {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-header h2 {
    color: #2c3e50;
    font-size: 1.8rem;
}

.search-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-info span {
    background: #e9ecef;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #6c757d;
}

.export-btn {
    padding: 8px 16px;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.export-btn:hover {
    background: #138496;
}

/* Results Layout */
.results-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Results List */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 10px;
    padding-top: 20px;
}

.results-list::-webkit-scrollbar {
    width: 6px;
}

.results-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.results-list::-webkit-scrollbar-thumb {
    background: #de302b;
    border-radius: 3px;
}

.result-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 15px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.result-card:hover,
.result-card.selected {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #de302b;
}

.result-card.selected {
    background: rgba(102, 126, 234, 0.1);
}

.result-number {
    position: absolute;
    top: -10px;
    left: 20px;
    background: #de302b;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.result-address {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    padding-left: 1rem;
}

.result-coordinates {
    color: #6c757d;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    padding-left: 1rem;
}

.btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-view {
    background: #007bff;
    color: white;
}

.btn-view:hover {
    background: #0056b3;
}

.btn-copy {
    background: #6c757d;
    color: white;
}

.btn-copy:hover {
    background: #545b62;
}

/* Map Section */
.map-section {
    display: flex;
    flex-direction: column;
}

.map-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.map-container {
    height: 600px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* Success message */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: 10px;
    border-left: 4px solid #28a745;
    margin: 1rem 0;
    display: none;
}

.success-message i {
    margin-right: 8px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .results-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .map-container {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header-content h1 {
        font-size: 2rem;
    }

    .coordinates-inputs {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-info {
        width: 100%;
        justify-content: space-between;
    }

    .tab-btn {
        font-size: 0.9rem;
        padding: 10px 15px;
    }

    .result-card {
        padding: 1rem;
    }

    .result-address {
        font-size: 1rem;
    }

    .country-tabs {
        gap: 0.5rem;
    }

    .country-btn {
        min-width: 90px;
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .search-tabs {
        flex-direction: column;
    }

    .tab-btn {
        margin-bottom: 2px;
    }

    .search-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-content {
        padding: 1.5rem;
    }

    .search-section, .results-section {
        padding: 1.5rem;
    }

    .country-tabs {
        flex-direction: column;
    }

    .country-btn {
        width: 100%;
    }
}

/* Animation for results appearing */
.result-card {
    animation: slideInUp 0.5s ease-out;
}

/* ✅ ENHANCED EXPORT BUTTON STYLES */
.export-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.export-btn {
    padding: 8px 16px;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.export-btn:first-child {
    background: #17a2b8; /* JSON - Teal */
}

.export-btn.export-csv {
    background: #28a745; /* CSV - Green */
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.export-btn:first-child:hover {
    background: #138496;
}

.export-btn.export-csv:hover {
    background: #218838;
}

/* ✅ RESPONSIVE EXPORT BUTTONS */
@media (max-width: 768px) {
    .export-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .export-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ✅ ENHANCED SEARCH INFO STYLING */
#search-coordinates {
    background: #e9ecef;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #495057;
    max-width: 300px;
}

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