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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* App Container - Main Grid Layout */
.app-container {
    display: grid;
    grid-template-areas: 
        "header header"
        "filters map"
        "info info"
        "footer footer";
    grid-template-columns: 300px 1fr;
    grid-template-rows: auto 1fr auto auto;
    min-height: 100vh;
    gap: 1rem;
    padding: 1rem;
}

/* Header */
.app-header {
    grid-area: header;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
}

.app-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.app-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    display: contents;
}

/* Filter Panel */
.filter-panel {
    grid-area: filters;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: fit-content;
    max-height: 70vh;
    overflow-y: auto;
}

.filter-panel h2 {
    color: #333;
    font-size: 1.4rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
    margin: 0;
    flex: 1;
}

.filter-panel .section-header {
    margin-bottom: 1.5rem;
}

/* Section Header with Reset Icon */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-header h2,
.section-header h3 {
    margin: 0;
    flex: 1;
}

.reset-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    color: #666;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
}

.reset-icon:hover {
    background: #f0f0f0;
    color: #667eea;
    transform: rotate(-45deg);
}

.reset-icon:active {
    transform: rotate(-45deg) scale(0.95);
}

.reset-icon svg {
    width: 18px;
    height: 18px;
}

.filter-section h3 {
    color: #555;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.filter-item:hover {
    background-color: #f8f9fa;
}

.filter-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.filter-item label {
    cursor: pointer;
    font-weight: 500;
    flex: 1;
}

.provider-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.provider-icon {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    display: inline-block;
}

/* Provider Colors */
.provider-aws { background-color: #ff9900; }
.provider-azure { background-color: #0078d4; }
.provider-gcp { background-color: #34a853; }
.provider-ibm-cloud { background-color: #000000; }
.provider-oracle-cloud { background-color: #f80000; }
.provider-alibaba-cloud { background-color: #ff6a00; }

.reset-filters-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.reset-filters-btn:hover {
    background-color: #5a6268;
}

/* Hierarchical Filter Styles */
.hierarchical-filters {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.provider-group {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.provider-header {
    background: #f8f9fa;
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background-color 0.2s ease;
}

.provider-header:hover {
    background: #e9ecef;
}

.provider-header.collapsed .expand-icon {
    transform: rotate(-90deg);
}

.expand-icon {
    font-size: 0.8rem;
    color: #666;
    transition: transform 0.2s ease;
}

.provider-checkbox {
    margin: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.provider-label {
    cursor: pointer;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.provider-types {
    background: white;
    padding: 0.5rem 0;
    border-top: 1px solid #f1f3f4;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.provider-types.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
    border-top: none;
}

.type-item {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background-color 0.2s ease;
    margin-left: 1rem;
    border-left: 2px solid #f1f3f4;
}

.type-item:hover {
    background-color: #f8f9fa;
}

.type-checkbox {
    margin: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #667eea;
}

.type-label {
    cursor: pointer;
    font-weight: 400;
    color: #555;
    font-size: 0.9rem;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.type-info {
    color: #999;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    cursor: help;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.type-info:hover {
    opacity: 1;
    color: #667eea;
}

/* Map Section */
.map-section {
    grid-area: map;
    position: relative;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.map-container {
    width: 100%;
    height: 70vh;
    min-height: 500px;
}

/* Loading and Error States */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

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

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

.error-message {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    z-index: 1000;
}

/* Info Panel */
.info-panel {
    grid-area: info;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.info-panel h2 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.4rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.info-placeholder {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

.info-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #667eea;
}

.info-item h4 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item p {
    color: #555;
    font-weight: 500;
}

.type-definition {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #666;
    font-style: italic;
}

.services-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.2s ease;
}

.services-link:hover {
    color: #5a67d8;
    text-decoration: underline;
}

/* Overview Section Styles */
.overview-section {
    display: block;
}

.stat-number {
    font-size: 2rem !important;
    font-weight: bold !important;
    color: #667eea !important;
    margin: 0 !important;
}

.provider-stats, .type-stats, .geo-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.provider-stat, .type-stat, .geo-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.provider-stat {
    gap: 0.5rem;
}

.provider-name, .type-name, .country-name {
    flex: 1;
    font-weight: 500;
}

.provider-count, .type-count, .country-count {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    min-width: 24px;
    text-align: center;
}

.overview-note {
    text-align: center !important;
    color: #666 !important;
    font-style: italic !important;
    margin: 0 !important;
    padding: 1rem 0 !important;
}

/* Footer */
.app-footer {
    grid-area: footer;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-top: 1px solid #e9ecef;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 3rem;
}


.footer-link,
.kiro-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #555;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.footer-link:hover,
.kiro-link:hover {
    color: #333;
    background-color: #f8f9fa;
    transform: translateY(-1px);
}

.linkedin-link:hover {
    color: #0077b5;
    background-color: #f0f8ff;
    border-color: #0077b5;
}

.coffee-link:hover {
    color: #8B4513;
    background-color: #fff8e1;
    border-color: #ffdd44;
}

.coffee-link:hover .coffee-icon {
    color: #D2691E;
    animation: coffee-steam 1s ease-in-out infinite alternate;
}

@keyframes coffee-steam {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-2px); }
}

.feedback-link:hover {
    color: #667eea;
    background-color: #f0f4ff;
    border-color: #667eea;
}

.feedback-link:hover .feedback-icon {
    color: #667eea;
    animation: feedback-pulse 0.5s ease-in-out;
}

@keyframes feedback-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.disclaimer-link:hover {
    color: #f59e0b;
    background-color: #fffbeb;
    border-color: #f59e0b;
}

.disclaimer-link:hover .disclaimer-icon {
    color: #f59e0b;
}

.feedback-icon,
.disclaimer-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}



.kiro-link {
    color: #667eea;
    font-weight: 600;
}

.kiro-link:hover {
    color: #5a67d8;
    background-color: #f7fafc;
    border-color: #e2e8f0;
    transform: translateY(-1px);
}

.linkedin-icon,
.coffee-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.kiro-logo {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    object-fit: contain;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.kiro-fallback {
    font-size: 20px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.kiro-link:hover .kiro-logo {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.kiro-link:hover .kiro-fallback {
    transform: scale(1.1);
}

.footer-link:hover .linkedin-icon,
.footer-link:hover .coffee-icon,
.kiro-link:hover .kiro-logo {
    transform: scale(1.1);
}

/* Footer responsive adjustments */
@media (max-width: 480px) {
    .footer-content {
        gap: 1.5rem;
    }
    
    .footer-content {
        gap: 1.5rem;
    }
    
    .footer-link,
    .kiro-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Leaflet Map Customizations */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 1rem;
    line-height: 1.6;
}

.popup-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.popup-details {
    color: #666;
    font-size: 0.9rem;
}

/* Custom Marker Styles */
.custom-marker {
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.pin-marker {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.pin-container {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.pin-container:hover {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transform: scale(1.05);
    transition: all 0.2s ease;
}

.marker-region {
    width: 16px;
    height: 16px;
}

.marker-edge-location {
    width: 12px;
    height: 12px;
}

.marker-local-zone {
    width: 10px;
    height: 10px;
}

.marker-availability-zone {
    width: 8px;
    height: 8px;
}

/* Responsive Design */

/* Tablet Layout */
@media (max-width: 1024px) {
    .app-container {
        grid-template-areas: 
            "header"
            "filters"
            "map"
            "info"
            "footer";
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto auto;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .filter-panel {
        max-height: none;
        overflow-y: visible;
    }

    .filter-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .filter-item {
        flex: 0 0 auto;
        min-width: 150px;
    }

    .map-container {
        height: 60vh;
        min-height: 400px;
    }
}

/* Mobile Layout */
@media (max-width: 768px) {
    .app-container {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .app-header {
        padding: 1.5rem;
    }

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

    .app-header p {
        font-size: 1rem;
    }

    .filter-panel,
    .info-panel,
    .app-footer {
        padding: 1rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
    }

    .filter-group {
        flex-direction: column;
    }

    .filter-item {
        min-width: auto;
    }

    .map-container {
        height: 50vh;
        min-height: 300px;
    }

    .info-details {
        grid-template-columns: 1fr;
    }
}

/* Small Mobile Layout */
@media (max-width: 480px) {
    .app-container {
        padding: 0.25rem;
    }

    .app-header {
        padding: 1rem;
    }

    .app-header h1 {
        font-size: 1.5rem;
    }

    .filter-panel,
    .info-panel {
        padding: 0.75rem;
    }

    .map-container {
        height: 40vh;
        min-height: 250px;
    }
}

/* Print Styles */
@media print {
    .filter-panel,
    .app-footer {
        display: none;
    }
    
    .app-container {
        grid-template-areas: 
            "header"
            "map"
            "info";
        grid-template-columns: 1fr;
    }
    
    .map-container {
        height: 60vh;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .app-header {
        background: #000;
        color: #fff;
    }
    
    .filter-panel,
    .map-section,
    .info-panel {
        border: 2px solid #000;
    }
    
    .filter-item:hover {
        background-color: #000;
        color: #fff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation: none;
    }
    
    .filter-item {
        transition: none;
    }
    
    .reset-filters-btn {
        transition: none;
    }
}

/* Marker Cluster Customization */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    border-radius: 50%;
}

.marker-cluster-small div {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
    color: white;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.marker-cluster-medium div {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    font-weight: bold;
    color: white;
    border: 3px solid white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.marker-cluster-large div {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    text-align: center;
    line-height: 50px;
    font-weight: bold;
    color: white;
    border: 4px solid white;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.marker-cluster div span {
    display: block;
}

/* Spiderfy line customization */
.leaflet-cluster-spider-leg {
    stroke: #667eea;
    stroke-width: 2;
    stroke-opacity: 0.6;
}

/* Hover effects for clusters */
.marker-cluster:hover div {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}
