/**
 * School Centers Map - Main Styles
 */

/* Map Container */
.scm-map-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
}

#scm-map {
    width: 100%;
    border: 2px solid #2E86AB;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

/* Loading Spinner */
.scm-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.scm-loading.hidden {
    display: none;
}

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

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

/* Legend */
.scm-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 2;
    max-width: 200px;
}

.scm-legend h4 {
    margin: 0 0 10px 0;
    color: #2E86AB;
    font-size: 14px;
    font-weight: bold;
}

.scm-legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

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

.scm-legend-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Custom Marker Styles */
.scm-custom-marker {
    background: white;
    border: 3px solid;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.scm-custom-marker:hover {
    transform: scale(1.1);
}

.scm-custom-marker.fondamentale {
    border-color: #28a745;
    color: #28a745;
}

.scm-custom-marker.secondaire {
    border-color: #dc3545;
    color: #dc3545;
}

.scm-custom-marker.secondairespecial {
    border-color: #F7CB15;
    color: #F7CB15;
}

.scm-custom-marker.fondamentalspecial {
    border-color: #ffc107;
    color: #ffc107;
}


/* Info Window Card */
.scm-info-window {
    min-width: 280px;
    max-width: 350px;
}

.scm-info-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.scm-info-image {
    width: 80px !important;
    height: 80px !important;
    border-radius: 8px !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
}

.scm-info-image-placeholder {
    width: 80px;
    height: 80px;
    background: #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #6c757d;
    flex-shrink: 0;
}

.scm-info-title-wrapper {
    flex: 1 !important;
}

.scm-info-title {
    font-size: 16px !important;
    font-weight: bold !important;
    color: #2E86AB !important;
    margin: 0 0 5px 0 !important;
    line-height: 1.2 !important;
}

.scm-info-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    margin-left: 8px;
}

.scm-info-type.fondamentale {
    background: #28a745;
}

.scm-info-type.secondaire {
    background: #dc3545;
}

.scm-info-type.fondamentalspecial {
    background: #2c3e50;
}

.scm-info-type.secondairespecial {
    background: #F7CB15;
    color: #212529;
}

.scm-info-address {
    font-size: 13px;
    color: #6c757d;
    line-height: 1.4;
    margin-bottom: 10px;
}

.scm-info-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 15px;
}

.scm-info-teacher-count {
    font-size: 13px;
    color: #1976d2;
    font-weight: bold;
}

.scm-info-pms {
    font-size: 12px;
    color: #28a745;
    font-weight: bold;
}

.scm-info-button {
    width: 100%;
    padding: 10px;
    background: #1A365D;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 14px;
}

.scm-info-button:hover {
    background: #A23B72;
}

/* Popup Styles */
.scm-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100000;
    overflow-y: auto;
}

.scm-popup-overlay.active {
    display: block;
}

.scm-popup-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    margin: 50px auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: scmPopupAppear 0.3s ease-out;
}

@keyframes scmPopupAppear {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scm-popup-header {
    background: #1A365D !important;
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.scm-popup-title {
    color: white !important;

}

.scm-popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    padding: 0;
    line-height: 1;
}

.scm-popup-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.scm-popup-body {
    padding: 30px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.scm-popup-school-image {
    text-align: center;
    margin-bottom: 30px;
}

.scm-popup-image {
    max-width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
    display: none;
}

.scm-popup-image.has-image {
    display: block;
}

.scm-popup-school-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.scm-popup-address,
.scm-popup-website {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #2E86AB;
}

.scm-popup-address h4,
.scm-popup-website h4 {
    color: #2E86AB;
    margin: 0 0 10px 0;
    font-size: 16px;
}

.scm-popup-address-text {
    margin: 0;
    color: #495057;
    line-height: 1.5;
}

.scm-popup-website-link {
    color: #2E86AB;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.scm-popup-website-link:hover {
    color: #A23B72;
    text-decoration: underline;
}

.scm-popup-pms-info {
    margin-bottom: 30px;
    padding: 20px;
    background: #e8f5e8;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.scm-popup-pms-header {
    color: #28a745;
    margin: 0 0 10px 0;
    font-size: 16px;
}

.scm-popup-pms-link {
    color: #28a745;
    text-decoration: none;
    font-weight: bold;
    font-size: 15px;
    transition: color 0.3s ease;
}

.scm-popup-pms-link:hover {
    color: #218838;
    text-decoration: underline;
}

.scm-popup-pms-phone {
    margin: 5px 0 0 0;
    font-size: 14px;
}

.scm-popup-pms-phone a {
    color: #28a745;
    text-decoration: none;
    font-weight: bold;
}

.scm-popup-pms-phone a:hover {
    text-decoration: underline;
}

.scm-popup-teachers {
    border-top: 2px solid #e9ecef;
    padding-top: 30px;
}

.scm-popup-teachers h3 {
    color: #2E86AB;
    margin: 0 0 25px 0;
    font-size: 20px;
}

.scm-popup-teachers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.scm-popup-teacher-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.scm-popup-teacher-card:hover {
    transform: translateY(-5px);
    border-color: #2E86AB;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.scm-popup-teacher-photo {
    margin-bottom: 15px;
}

.scm-popup-teacher-image {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 3px solid #2E86AB !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1) !important;
}

.scm-popup-teacher-placeholder {
    width: 80px;
    height: 80px;
    background: #dee2e6;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #dee2e6;
    font-size: 30px;
}

.scm-popup-teacher-name {
    font-weight: bold;
    color: #2E86AB !important;
    margin-bottom: 10px;
    font-size: 16px;
}

.scm-popup-teacher-specialties {
    margin-bottom: 10px;
}

.scm-popup-specialty {
    display: inline-block !important;
    background: #e9ecef !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    margin: 2px !important;
    font-weight: bold !important;
}

.scm-popup-specialty-psychologique {
    background: #d4edda !important;
    color: #155724 !important;
}
.scm-popup-specialty-sociale {
    background: #d1ecf1 !important;
    color: #0c5460 !important;
}
.scm-popup-specialty-logopedique {
    background: #fce4ec !important;
    color: #880e4f !important;
}
.scm-popup-specialty-sante {
    background: #fff3cd !important;
    color: #856404 !important;
}
.scm-popup-specialty-maternelles {
    background: #e2e3e5 !important;
    color: #383d41 !important;
}

.scm-popup-teacher-email {
    font-size: 13px;
    color: #6c757d;
    word-break: break-word;
}

.scm-popup-no-teachers {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .scm-legend {
        bottom: 10px;
        right: 10px;
        padding: 10px;
        max-width: 150px;
    }
    
    .scm-legend h4 {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .scm-legend-item {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .scm-legend-marker {
        width: 16px;
        height: 16px;
        margin-right: 6px;
    }
    
    .scm-popup-content {
        width: 95%;
        margin: 20px auto;
    }
    
    .scm-popup-school-info {
        grid-template-columns: 1fr;
    }
    
    .scm-popup-teachers-grid {
        grid-template-columns: 1fr;
    }
    
    .scm-info-window {
        min-width: 250px;
    }
}

/* Print Styles */
@media print {
    .scm-legend,
    .scm-popup-overlay {
        display: none !important;
    }
}



/* Enhanced Mobile Responsive Fixes for Map Popups */

/* Improved Info Window for Mobile */
@media (max-width: 768px) {
    .scm-info-window {
        min-width: 250px !important;
        max-width: 280px !important;
        width: auto !important;
    }
    
    .scm-info-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        margin-bottom: 12px !important;
    }
    
    .scm-info-image,
    .scm-info-image-placeholder {
        width: 60px !important;
        height: 60px !important;
        align-self: center !important;
    }
    
    .scm-info-title-wrapper {
        width: 100% !important;
        text-align: center !important;
    }
    
    .scm-info-title {
        font-size: 14px !important;
        line-height: 1.3 !important;
        margin-bottom: 8px !important;
    }
    
    .scm-info-type {
        font-size: 10px !important;
        padding: 2px 6px !important;
        margin-left: 4px !important;
    }
    
    .scm-info-address {
        font-size: 12px !important;
        margin-bottom: 8px !important;
    }
    
    .scm-info-stats {
        flex-direction: column !important;
        gap: 5px !important;
        padding: 8px 0 !important;
        margin-bottom: 10px !important;
        text-align: center !important;
    }
    
    .scm-info-teacher-count,
    .scm-info-pms {
        font-size: 11px !important;
    }
    
    .scm-info-button {
        padding: 8px !important;
        font-size: 12px !important;
    }
}

/* Extra Mobile Fixes for Very Small Screens */
@media (max-width: 480px) {
    .scm-info-window {
        min-width: 220px !important;
        max-width: 250px !important;
    }
    
    .scm-info-image,
    .scm-info-image-placeholder {
        width: 50px !important;
        height: 50px !important;
    }
    
    .scm-info-title {
        font-size: 13px !important;
    }
    
    .scm-info-address {
        font-size: 11px !important;
    }
}

/* Enhanced Popup Overlay for Mobile */
@media (max-width: 768px) {
    .scm-popup-overlay {
        padding: 10px !important;
        box-sizing: border-box !important;
    }
    
    .scm-popup-content {
        width: calc(100% - 20px) !important;
        max-width: none !important;
        margin: 20px auto !important;
        max-height: calc(100vh - 40px) !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .scm-popup-header {
        padding: 15px 20px !important;
        flex-shrink: 0 !important;
    }
    
    .scm-popup-title {
        font-size: 16px !important;
        line-height: 1.3 !important;
        margin-right: 10px !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    .scm-popup-close {
        font-size: 24px !important;
        width: 35px !important;
        height: 35px !important;
        flex-shrink: 0 !important;
    }
    
    .scm-popup-body {
        padding: 20px !important;
        overflow-y: auto !important;
        flex: 1 !important;
        max-height: none !important;
    }
    
    .scm-popup-school-image {
        margin-bottom: 20px !important;
    }
    
    .scm-popup-image {
        height: 200px !important;
        width: 100% !important;
        object-fit: cover !important;
    }
    
    .scm-popup-school-info {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        margin-bottom: 20px !important;
    }
    
    .scm-popup-address,
    .scm-popup-website {
        padding: 15px !important;
    }
    
    .scm-popup-address h4,
    .scm-popup-website h4 {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }
    
    .scm-popup-address-text {
        font-size: 13px !important;
    }
    
    .scm-popup-pms-info {
        padding: 15px !important;
        margin-bottom: 20px !important;
    }
    
    .scm-popup-pms-header {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }
    
    .scm-popup-pms-link {
        font-size: 13px !important;
    }
    
    .scm-popup-pms-phone {
        font-size: 12px !important;
    }
    
    .scm-popup-teachers {
        padding-top: 20px !important;
    }
    
    .scm-popup-teachers h3 {
        font-size: 18px !important;
        margin-bottom: 15px !important;
        text-align: center !important;
    }
    
    .scm-popup-teachers-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .scm-popup-teacher-card {
        padding: 15px !important;
    }
    
    .scm-popup-teacher-image {
        width: 60px !important;
        height: 60px !important;
    }
    
    .scm-popup-teacher-placeholder {
        width: 60px !important;
        height: 60px !important;
        font-size: 24px !important;
    }
    
    .scm-popup-teacher-name {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }
    
    .scm-popup-teacher-email {
        font-size: 11px !important;
    }
    
    .scm-popup-specialty {
        font-size: 10px !important;
        padding: 3px 6px !important;
    }
}

/* Extra Small Screens (phones in portrait) */
@media (max-width: 480px) {
    .scm-popup-overlay {
        padding: 5px !important;
    }
    
    .scm-popup-content {
        width: calc(100% - 10px) !important;
        margin: 10px auto !important;
        max-height: calc(100vh - 20px) !important;
    }
    
    .scm-popup-header {
        padding: 12px 15px !important;
    }
    
    .scm-popup-title {
        font-size: 14px !important;
    }
    
    .scm-popup-close {
        font-size: 20px !important;
        width: 30px !important;
        height: 30px !important;
    }
    
    .scm-popup-body {
        padding: 15px !important;
    }
    
    .scm-popup-image {
        height: 150px !important;
    }
    
    .scm-popup-address,
    .scm-popup-website,
    .scm-popup-pms-info {
        padding: 12px !important;
    }
    
    .scm-popup-teacher-card {
        padding: 12px !important;
    }
}

/* Ensure proper z-index and overlay behavior */
.scm-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 100000 !important;
    background: rgba(0, 0, 0, 0.8) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

.scm-popup-overlay.active {
    display: block !important;
}

/* Prevent body scroll when popup is open */
body.scm-popup-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Better animation for mobile */
@media (max-width: 768px) {
    @keyframes scmPopupAppear {
        from {
            opacity: 0;
            transform: translateY(20px) scale(0.95);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
}

/* Improved legend positioning for mobile */
@media (max-width: 768px) {
    .scm-legend {
        position: absolute !important;
        bottom: 10px !important;
        left: 10px !important;
        right: auto !important;
        max-width: 140px !important;
        padding: 8px !important;
        font-size: 11px !important;
    }
    
    .scm-legend h4 {
        font-size: 11px !important;
        margin-bottom: 6px !important;
    }
    
    .scm-legend-item {
        font-size: 10px !important;
        margin-bottom: 4px !important;
    }
    
    .scm-legend-marker {
        width: 14px !important;
        height: 14px !important;
        margin-right: 5px !important;
    }
}

/* Map container mobile adjustments */
@media (max-width: 768px) {
    .scm-map-container {
        margin: 10px 0 !important;
        position: relative !important;
        overflow: hidden !important;
    }
    
    #scm-map {
        border-radius: 5px !important;
        border-width: 1px !important;
    }
}

/* Custom marker adjustments for mobile */
@media (max-width: 768px) {
    .scm-custom-marker {
        width: 35px !important;
        height: 35px !important;
        font-size: 14px !important;
        border-width: 2px !important;
    }
    
    .scm-custom-marker:hover {
        transform: scale(1.05) !important;
    }
}

/* Loading spinner mobile adjustment */
@media (max-width: 768px) {
    .scm-loading {
        padding: 15px !important;
        border-radius: 8px !important;
    }
    
    .scm-spinner {
        width: 30px !important;
        height: 30px !important;
        border-width: 3px !important;
    }
}


/* Absence Management Styles */
.scm-absence-pill {
    background: #dc3545;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    margin: 10px 0 5px 0;
    text-align: center;
    line-height: 1.3;
}

.scm-replacement-email-info {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 5px;
    word-break: break-word;
    line-height: 1.3;
}

.scm-replacement-email-info a {
    color: #6c757d !important;
    text-decoration: none !important;
}

.scm-replacement-email-info a:hover {
    text-decoration: underline !important;
}
