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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 32px 0;
    box-shadow: var(--shadow-lg);
}

.header-content {
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 8px;
}

.logo i {
    font-size: 40px;
}

.logo h1 {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.tagline {
    font-size: 16px;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px 0;
}

/* Search Section */
.search-section {
    margin-bottom: 40px;
}

.search-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0 20px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-icon {
    color: var(--text-secondary);
    font-size: 20px;
    margin-right: 12px;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 18px 0;
    background: transparent;
    color: var(--text-primary);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.clear-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

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

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

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

.search-result-item:hover {
    background: var(--background);
}

.result-main {
    flex: 1;
}

.result-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-style: italic;
}

.result-taxonomy {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.taxonomy-badge {
    font-size: 12px;
    padding: 2px 8px;
    background: var(--background);
    color: var(--text-secondary);
    border-radius: 12px;
    font-weight: 500;
}

.result-arrow {
    color: var(--text-secondary);
    font-size: 14px;
}

.no-results, .error-message {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
}

.error-message {
    color: #ef4444;
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    padding: 80px 0;
}

.welcome-content {
    max-width: 600px;
    margin: 0 auto;
}

.welcome-icon {
    font-size: 80px;
    color: var(--secondary-color);
    margin-bottom: 24px;
}

.welcome-content h2 {
    font-size: 32px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.welcome-content p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.features {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.feature i {
    font-size: 32px;
    color: var(--primary-color);
}

.feature span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Details Section */
.details-section {
    animation: fadeIn 0.5s ease;
}

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

.details-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 24px;
}

/* Card Styles */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(to right, var(--background), var(--surface));
}

.card-header i {
    font-size: 24px;
    color: var(--primary-color);
}

.card-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

/* Image Gallery */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.image-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--background);
    aspect-ratio: 16/9;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.image-item:hover img {
    transform: scale(1.05);
}

.image-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 14px;
    flex-direction: column;
    gap: 8px;
}

/* Taxonomy */
.taxonomy-tree {
    position: relative;
}

.taxonomy-level {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding-left: calc(var(--level) * 30px);
    animation: slideIn 0.3s ease calc(var(--level) * 0.05s);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.taxonomy-node {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--background);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-color);
    flex: 1;
}

.taxonomy-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    min-width: 120px;
}

.taxonomy-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    font-style: italic;
}

/* Codes Grid */
.codes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.code-item {
    padding: 16px;
    background: var(--background);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.code-item:hover {
    border-color: var(--primary-color);
    background: var(--surface);
}

.code-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.code-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

/* Region Selector */
.region-selector-container {
    margin-bottom: 24px;
}

.region-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.region-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.region-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Status Grid */
.status-grid {
    display: grid;
    gap: 12px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--background);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--secondary-color);
}

.status-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.status-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* France Status Special Display */
.france-status {
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
}

.france-status .status-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.france-status .status-header i {
    font-size: 24px;
    color: #1e40af;
}

.france-status .status-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.status-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.status-badge.status-P {
    border-left: 5px solid #10b981;
}

.status-badge.status-R {
    border-left: 5px solid #f59e0b;
}

.status-badge.status-PR {
    border-left: 5px solid #8b5cf6;
}

.status-badge.status-N {
    border-left: 5px solid #6b7280;
}

.status-badge.status-E {
    border-left: 5px solid #ef4444;
}

.status-code {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

.status-desc {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

.status-legend {
    background: white;
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.status-legend h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-legend h4 i {
    color: var(--primary-color);
}

.legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--background);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-item.active {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 2px solid var(--primary-color);
    transform: scale(1.02);
}

.legend-code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    min-width: 30px;
}

.legend-desc {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
    text-align: right;
}

/* Info Grid */
.info-grid {
    display: grid;
    gap: 16px;
}

/* Map container adjustments */
.map-card .card-body {
    padding: 12px 20px;
}

#map {
    width: 100%;
    height: 420px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

#map {
    background-color: #ffffff;
}

.info-item {
    padding: 16px;
    background: var(--background);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.info-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-label i {
    color: var(--primary-color);
}

.info-value {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

/* No Data */
.no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.no-data i {
    display: block;
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Footer */
.footer {
    background: var(--surface);
    padding: 24px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
}

.footer p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .details-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .logo h1 {
        font-size: 28px;
    }

    .logo i {
        font-size: 32px;
    }

    .tagline {
        font-size: 14px;
    }

    .search-box {
        padding: 0 16px;
    }

    .search-input {
        font-size: 14px;
        padding: 14px 0;
    }

    .card-header {
        padding: 16px 20px;
    }

    .card-header h2 {
        font-size: 18px;
    }

    .card-body {
        padding: 20px;
    }

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

    .features {
        gap: 24px;
    }

    .welcome-content h2 {
        font-size: 24px;
    }

    .welcome-content p {
        font-size: 16px;
    }

    .details-container {
        gap: 20px;
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .main-content {
        padding: 24px 0;
    }

    .taxonomy-level {
        padding-left: calc(var(--level) * 15px);
    }

    .taxonomy-label {
        min-width: 90px;
        font-size: 11px;
    }

    .taxonomy-value {
        font-size: 14px;
    }

    .image-gallery {
        grid-template-columns: 1fr;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
