/**
 * EU Legislation Compare - Styles
 */

.eu-legislation-wrapper {
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    box-sizing: border-box;
}

.eu-legislation-header {
    text-align: center;
    margin-bottom: 20px;
}

.eu-legislation-header h2 {
    margin: 0 0 10px 0;
    color: #003399;
    font-size: 28px;
}

.eu-legislation-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.eu-legislation-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 6px;
    flex-wrap: wrap;
    gap: 10px;
}

.selected-countries {
    flex: 1;
    min-width: 200px;
}

.selected-countries strong {
    color: #003399;
    margin-right: 8px;
}

.compare-button,
.reset-button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.compare-button {
    background: #003399;
    color: #fff;
}

.compare-button:hover:not(:disabled) {
    background: #0052cc;
}

.compare-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.reset-button {
    background: #dc3545;
    color: #fff;
}

.reset-button:hover {
    background: #c82333;
}

/* Main Layout - Vertical Stack (Map on Top, Results Below) */
.eu-legislation-main-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.eu-legislation-map-section {
    width: 100%;
}

.eu-legislation-results-section {
    width: 100%;
}

.eu-legislation-map-container {
    position: relative;
    overflow: hidden;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #f9f9f9;
    width: 100%;
    /* Aspect ratio based on SVG original dimensions: width=454, height=450 */
    aspect-ratio: 454 / 450;
    margin: 0 auto;
}

.eu-map {
    width: 100%;
    height: 100%;
    position: relative;
}

.eu-map svg {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

.eu-map svg path {
    transition: all 0.3s ease;
}

/* Country styles */
/* Non-EU countries (default style - keep their original SVG styles) */
#eu-map svg path:not(.eu-country),
#eu-map svg polygon:not(.eu-country) {
    cursor: default;
    opacity: 0.3;
    fill: #e0e0e0 !important;
}

/* EU countries (clickable) - override inline styles with blue color */
#eu-map svg path.eu-country,
#eu-map svg polygon.eu-country {
    fill: #a8c5e6 !important;
    stroke: #ffffff !important;
    stroke-width: 1 !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    opacity: 1 !important;
}

/* Hover state */
#eu-map svg path.eu-country:hover,
#eu-map svg polygon.eu-country:hover {
    fill: #ffcc00 !important;
    stroke: #003399 !important;
    stroke-width: 1.5 !important;
    filter: drop-shadow(0 0 10px rgba(255, 204, 0, 0.9)) brightness(1.2) !important;
    transform: scale(1.02) !important;
    transform-origin: center !important;
}

/* Țări selectate - HIGHLIGHT puternic */
#eu-map svg path.eu-country.selected,
#eu-map svg polygon.eu-country.selected {
    fill: #003399 !important;
    stroke: #ffcc00 !important;
    stroke-width: 2 !important;
    filter: drop-shadow(0 0 8px rgba(0, 51, 153, 0.8)) brightness(1.2) !important;
    animation: pulse-selected 2s ease-in-out infinite !important;
}

/* Selected hover state */
#eu-map svg path.eu-country.selected:hover,
#eu-map svg polygon.eu-country.selected:hover {
    fill: #0052cc !important;
    stroke: #ffd700 !important;
    stroke-width: 2.5 !important;
}

/* Animație subtilă pentru țările selectate */
@keyframes pulse-selected {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(0, 51, 153, 0.8)) brightness(1.2);
    }
    50% {
        filter: drop-shadow(0 0 12px rgba(255, 204, 0, 0.9)) brightness(1.3);
    }
}

/* Results Placeholder */
.results-placeholder {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 6px;
}

.placeholder-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.results-placeholder h3 {
    color: #666;
    margin: 0 0 10px 0;
    font-size: 20px;
}

.results-placeholder p {
    color: #999;
    margin: 0;
    font-size: 14px;
}

/* Comparison results */
.comparison-results {
    padding: 20px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 6px;
    min-height: 400px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #003399;
}

.results-header h3 {
    margin: 0;
    color: #003399;
}

.close-button {
    background: #dc3545;
    color: #fff;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-button:hover {
    background: #c82333;
}

.results-content {
    max-height: 800px;
    overflow-y: auto;
}

.legislation-section {
    margin-bottom: 40px;
}

.legislation-section h4 {
    background: linear-gradient(135deg, #003399 0%, #0052cc 100%);
    color: #fff;
    padding: 12px 20px;
    margin: 0 0 20px 0;
    border-radius: 6px;
    font-size: 18px;
    box-shadow: 0 2px 4px rgba(0, 51, 153, 0.2);
}

/* Country Cards Grid - Side by Side */
.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.country-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.country-card:hover {
    border-color: #003399;
    box-shadow: 0 4px 12px rgba(0, 51, 153, 0.15);
    transform: translateY(-2px);
}

.country-card-header {
    background: #f5f5f5;
    padding: 15px 20px;
    font-weight: 700;
    font-size: 16px;
    color: #003399;
    border-bottom: 2px solid #e0e0e0;
}

.country-card-content {
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.country-card-content p {
    margin: 0 0 10px 0;
}

.country-card-content ul,
.country-card-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.country-card-content h2,
.country-card-content h3,
.country-card-content h4 {
    margin-top: 15px;
    margin-bottom: 10px;
    color: #003399;
}

.country-card-footer {
    background: #f9f9f9;
    padding: 10px 20px;
    font-size: 12px;
    color: #666;
    border-top: 1px solid #e0e0e0;
}

/* Legacy table support (if needed) */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-bottom: 20px;
}

.comparison-table th,
.comparison-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}

.comparison-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.comparison-table tr:nth-child(even) {
    background: #f9f9f9;
}

.comparison-table tr:hover {
    background: #f0f0f0;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #003399;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: #fff;
    margin-top: 20px;
    font-size: 16px;
}

/* Responsive */
@media (max-width: 1024px) {
    /* Map container uses aspect-ratio, no fixed height needed */
}

@media (max-width: 768px) {
    .eu-legislation-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .selected-countries {
        margin-bottom: 10px;
    }

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

    .country-card-content {
        max-height: 300px;
        font-size: 13px;
    }

    .results-placeholder {
        padding: 40px 15px;
    }

    .placeholder-icon {
        font-size: 48px;
    }

    .comparison-table {
        font-size: 12px;
        display: block;
        overflow-x: auto;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 8px;
        min-width: 120px;
    }

    .results-content {
        max-height: 500px;
    }
}
