/**
 * University Map Styles
 *
 * Styles for the university map shortcode functionality
 * @package FoerderprojekteManager
 */

/* Alpine.js cloak - hide elements until Alpine initializes */
[x-cloak] {
    display: none !important;
}

/* Map Container */
.fpm-university-map-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
}

.fpm-university-map {
    width: 100%;
    overflow: hidden;
}

/* Loading States */
.fpm-map-loading,
.fpm-projects-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.fpm-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.fpm-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States */
.fpm-map-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff3cd;
    color: #856404;
    padding: 15px 20px;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    font-weight: 500;
    z-index: 1000;
}

/* University Overlay */
.fpm-university-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.fpm-overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.fpm-overlay-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    max-height: 80vh;
    width: 100%;
    overflow: hidden;
    z-index: 1;
}

.fpm-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e5;
    background: #f8f9fa;
}

.fpm-overlay-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.fpm-overlay-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    color: #666;
    transition: all 0.2s ease;
}

.fpm-overlay-close:hover {
    background: #e9ecef;
    color: #333;
}

.fpm-overlay-body {
    padding: 24px;
    max-height: calc(80vh - 100px);
    overflow-y: auto;
}

/* University Information */
.fpm-university-info {
    margin-bottom: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.fpm-university-institute,
.fpm-university-location {
    margin-bottom: 8px;
    color: #555;
}

.fpm-university-institute:last-child,
.fpm-university-location:last-child {
    margin-bottom: 0;
}

.fpm-university-info strong {
    color: #333;
    font-weight: 600;
}

/* Projects Section */
.fpm-projects-section h4 {
    margin: 0 0 16px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e5e5e5;
    padding-bottom: 8px;
}

.fpm-projects-loading {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin: 20px 0;
}

.fpm-no-projects {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px 0;
}

/* Projects List */
.fpm-projects-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fpm-project-item {
    padding: 16px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: white;
    transition: box-shadow 0.2s ease;
}

.fpm-project-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.fpm-project-item h5 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.fpm-project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.fpm-project-year,
.fpm-project-funding {
    color: #666;
}

.fpm-project-meta strong {
    color: #333;
    font-weight: 600;
}

.fpm-project-institute {
    color: #666;
    font-size: 0.9rem;
    margin-top: 8px;
}

.fpm-project-institute strong {
    color: #333;
    font-weight: 600;
}

.fpm-project-summary {
    color: #555;
    line-height: 1.5;
    font-size: 0.95rem;
}

.fpm-projects-summary {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid #e5e5e5;
    text-align: center;
    color: #666;
    font-size: 1rem;
}

.fpm-projects-summary strong {
    color: #333;
    font-weight: 700;
}

/* Overlay Transitions */
.fpm-overlay-enter {
    transition: opacity 0.3s ease;
}

.fpm-overlay-enter-start {
    opacity: 0;
}

.fpm-overlay-enter-end {
    opacity: 1;
}

.fpm-overlay-leave {
    transition: opacity 0.2s ease;
}

.fpm-overlay-leave-start {
    opacity: 1;
}

.fpm-overlay-leave-end {
    opacity: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .fpm-university-overlay {
        padding: 10px;
    }

    .fpm-overlay-content {
        max-height: 90vh;
        margin: 0;
    }

    .fpm-overlay-header {
        padding: 16px 20px;
    }

    .fpm-overlay-header h3 {
        font-size: 1.25rem;
    }

    .fpm-overlay-body {
        padding: 20px;
        max-height: calc(90vh - 80px);
    }

    .fpm-project-meta {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .fpm-university-overlay {
        padding: 5px;
    }

    .fpm-overlay-content {
        max-height: 95vh;
        border-radius: 8px;
    }

    .fpm-overlay-header {
        padding: 12px 16px;
    }

    .fpm-overlay-body {
        padding: 16px;
    }

    .fpm-university-info {
        padding: 12px;
    }

    .fpm-project-item {
        padding: 12px;
    }
}

/* Mapbox Control Overrides for Minimal Style */
.mapboxgl-ctrl-attrib {
    font-size: 11px !important;
    background: rgba(255, 255, 255, 0.8) !important;
}

.mapboxgl-ctrl-attrib a {
    color: #666 !important;
}

/* Custom marker styles for clusters */
.mapboxgl-marker {
    cursor: pointer;
}

/* Focus states for accessibility */
.fpm-overlay-close:focus,
.fpm-project-item:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .fpm-university-overlay {
        display: none;
    }

    .fpm-university-map {
        height: 400px !important;
        break-inside: avoid;
    }
}
