/**
 * Student Directory Plugin Styles
 * Theme-agnostic styles with proper specificity
 */

/* Main Container - use all available width */
.student-directory {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 40px 0 !important;
    display: block !important;
    clear: both !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    color: #333 !important;
    background: #fff !important;
}

/* Reset box-sizing for all plugin elements */
.student-directory *,
.student-directory *::before,
.student-directory *::after {
    box-sizing: border-box !important;
}

/* Inner content wrapper */
.student-directory .directory-top-section,
.student-directory .directory-results-info,
.student-directory .directory-grid-container {
    max-width: 1400px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 2.5% !important;
    padding-right: 2.5% !important;
}

/* Top Section: Filters + Map */
.directory-top-section {
    display: grid !important;
    grid-template-columns: 1fr 4fr !important;
    gap: 20px !important;
    margin-bottom: 30px !important;
    width: 100% !important;
}

@media (max-width: 1024px) {
    .directory-top-section {
        grid-template-columns: 1fr 3fr;
    }
}

@media (max-width: 768px) {
    .directory-top-section {
        grid-template-columns: 1fr;
    }
}

/* Filters Sidebar */
.directory-filters {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.filters-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.filter-group > label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.filter-group input[type="text"],
.filter-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-group input[type="text"]:focus,
.filter-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 5px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
    margin: 0;
}

.checkbox-group input[type="checkbox"] {
    cursor: pointer;
    width: auto;
}

.filter-reset-btn {
    padding: 12px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
    width: 100%;
    margin-top: 10px;
}

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

/* Map Section */
.directory-map-container {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 500px;
}

@media (max-width: 768px) {
    .directory-map-container {
        margin-top: 20px;
    }
}

#directory-map {
    z-index: 1;
}

.map-popup h4 {
    margin: 5px 0;
    font-size: 16px;
}

.map-popup p {
    margin: 5px 0;
    font-size: 14px;
}

.map-popup img {
    margin-bottom: 10px;
}

/* Results Info */
.directory-results-info {
    margin-bottom: 20px;
    text-align: center;
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

/* Grid Layout */
.student-directory-grid .directory-grid-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    gap: 30px !important;
    margin: 30px 0 !important;
    width: 100% !important;
}

.directory-item {
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    display: block !important;
    transition: box-shadow 0.3s ease;
}

.directory-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.directory-item-inner {
    padding: 20px;
}

.directory-image {
    text-align: center;
    margin-bottom: 10px;
}

.directory-image img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 10%;
    object-fit: cover;
}

.directory-name {
    font-size: 1.3em;
    margin: 0 0 5px 0;
    color: #333;
}

.directory-company {
    color: #666;
    font-style: italic;
    margin: 0 0 10px 0;
}

.directory-location {
    color: #888;
    font-size: 0.9em;
    margin: 5px 0;
}

.directory-bio {
    margin: 15px 0;
    line-height: 1.6;
    color: #555;
}

/* Certification Badges */
.certification-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 10px 0 15px 0;
    justify-content: center;
}

.cert-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

.cert-clp {
    background: #4CAF50;
    color: white;
}

.cert-ctp {
    background: #2196F3;
    color: white;
}

.cert-gtp {
    background: #FF9800;
    color: white;
}

/* Actions */
.directory-actions {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.directory-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #2196F3;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    transition: background 0.3s ease;
}

.directory-btn:hover {
    background: #1976D2;
    color: white;
}

.directory-btn-secondary {
    background: #666;
}

.directory-btn-secondary:hover {
    background: #555;
}

/* Social Links */
.directory-social {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f0f0f0;
    color: #555;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 18px;
}

.social-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.social-link i {
    line-height: 1;
}

.social-facebook {
    background: #3b5998;
    color: white;
}

.social-facebook:hover {
    background: #2d4373;
    color: white;
}

.social-instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
}

.social-instagram:hover {
    opacity: 0.9;
    color: white;
}

.social-linkedin {
    background: #0077B5;
    color: white;
}

.social-linkedin:hover {
    background: #005885;
    color: white;
}

/* List Layout */
.student-directory-list .directory-list-container {
    margin: 30px 0;
}

.directory-list-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.directory-list-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.directory-list-item-inner {
    display: flex;
    gap: 20px;
    padding: 20px;
}

.directory-list-image {
    flex-shrink: 0;
}

.directory-list-image img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.directory-list-content {
    flex: 1;
}

.directory-list-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.directory-list-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.directory-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.directory-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Dashboard */
.student-directory-dashboard {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.dashboard-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 40px;
}

.directory-form .form-section {
    margin-bottom: 30px;
}

.directory-form .form-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.directory-form .form-section h3 {
    margin: 20px 0 15px 0;
    color: #555;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

.directory-form .form-description {
    color: #666;
    margin-bottom: 20px;
}

.directory-form .form-row {
    margin-bottom: 20px;
}

.directory-form .form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.directory-form .form-row input[type="text"],
.directory-form .form-row input[type="email"],
.directory-form .form-row input[type="url"],
.directory-form .form-row input[type="tel"],
.directory-form .form-row select,
.directory-form .form-row textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.directory-form .form-row input[readonly] {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
    border-color: #ccc;
}

.directory-form .field-description {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
}

.directory-form .form-row-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.directory-form .form-checkbox {
    margin-bottom: 10px;
}

.directory-form .form-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
}

.directory-form .cert-status {
    font-size: 12px;
    margin-left: 10px;
}

.directory-form .cert-valid {
    color: #4CAF50;
}

.directory-form .cert-invalid {
    color: #999;
}

.directory-form .form-actions {
    margin-top: 30px;
}

.directory-form .btn {
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.directory-form .btn-primary {
    background: #2196F3;
    color: white;
}

.directory-form .btn-primary:hover {
    background: #1976D2;
}

/* Notices */
.notice {
    padding: 15px;
    margin: 20px 0;
    border-left: 4px solid #ddd;
    border-radius: 4px;
}

.notice-success {
    background: #d4edda;
    border-color: #4CAF50;
    color: #155724;
}

.notice-error {
    background: #f8d7da;
    border-color: #f44336;
    color: #721c24;
}

.notice-info {
    background: #d1ecf1;
    border-color: #2196F3;
    color: #0c5460;
}

/* Responsive */
@media (max-width: 768px) {
    .student-directory-grid .directory-grid-container {
        grid-template-columns: 1fr;
    }
    
    .directory-list-item-inner {
        flex-direction: column;
    }
    
    .directory-list-footer {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}

/* Empty state */
.student-directory-error,
.student-directory-empty,
.directory-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 1.1em;
}

/* Map styling */
#location-map,
#directory-location-map {
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}

/* Leaflet map overrides */
.leaflet-container {
    font-family: inherit;
}

.leaflet-popup-content {
    margin: 10px;
}

/* Ensure map displays correctly */
.leaflet-map-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
    position: absolute;
    left: 0;
    top: 0;
}

/* Marker icon styling */
.leaflet-marker-icon {
    cursor: pointer;
}

/* Map controls */
.leaflet-control-zoom {
    border: 2px solid #ddd;
    border-radius: 4px;
}

.leaflet-control-zoom a {
    background-color: white;
    border-bottom: 1px solid #ddd;
    color: #333;
}

.leaflet-control-zoom a:hover {
    background-color: #f5f5f5;
}

.leaflet-control-zoom a:last-child {
    border-bottom: none;
}

/* File Upload Styles */
.directory-form input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    cursor: pointer;
    font-size: 0.9em;
}

.directory-form input[type="file"]:hover {
    border-color: #007bff;
    background-color: #f0f8ff;
}

.directory-form input[type="file"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Learn More Button */
.directory-btn-learn-more {
    flex: 1;
    padding: 10px 20px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.directory-btn-learn-more:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

/* Modal Styles */
.listing-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2147483647 !important; /* Maximum z-index value */
    display: none !important;
}

.listing-modal[style*="display: block"],
.listing-modal[style*="display:block"] {
    display: block !important;
}

.listing-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.85) !important;
    cursor: pointer !important;
    z-index: 2147483646 !important; /* Just below max */
}

.listing-modal-content {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: white !important;
    border-radius: 12px !important;
    max-width: 700px !important;
    width: 90% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
    z-index: 2147483647 !important; /* Maximum - on top of overlay */
}

.listing-modal-close {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    background: #f0f0f0 !important;
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    font-size: 24px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    color: #666 !important;
    transition: all 0.3s ease !important;
    z-index: 2147483647 !important; /* Maximum - always on top */
}

.listing-modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.modal-listing-details {
    padding: 20px;
}

/* Reset paragraph spacing in modal */
.modal-listing-details p {
    margin: 5px 0 !important;
}

.modal-header-image {
    text-align: center;
    margin-bottom: 12px !important;
}

.modal-header-image img {
    max-width: 180px;
    max-height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #f0f0f0;
}

.modal-main-content h2 {
    margin: 0 0 8px 0 !important;
    color: #333;
    font-size: 2em;
    text-align: center;
}

.modal-company {
    text-align: center;
    font-style: italic;
    color: #666;
    font-size: 1.1em;
    margin: 5px 0 !important;
}

.modal-location {
    text-align: center;
    color: #888;
    margin: 5px 0 15px 0 !important;
}

.modal-location i {
    margin-right: 5px;
    color: #2196F3;
}

.modal-certifications {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0 !important;
    padding: 10px 0 !important;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.modal-bio {
    margin: 15px 0 !important;
}

.modal-bio h3 {
    margin: 0 0 8px 0 !important;
    color: #333;
    font-size: 1.3em;
}

.modal-bio p,
.modal-bio .bio-text {
    line-height: 1.6 !important;
    color: #555;
    margin: 0 !important;
}

.modal-contact {
    margin: 15px 0 !important;
}

.modal-contact h3 {
    margin: 0 0 8px 0 !important;
    color: #333;
    font-size: 1.3em;
}

.modal-contact p,
.modal-contact .contact-item {
    margin: 3px 0 !important;
    display: flex;
    align-items: center;
}

.modal-contact i {
    width: 24px;
    margin-right: 10px;
    color: #2196F3;
    flex-shrink: 0;
}

.modal-contact a {
    color: #2196F3;
    text-decoration: none;
}

.modal-contact a:hover {
    text-decoration: underline;
}

.modal-social {
    margin: 15px 0 !important;
}

.modal-social h3 {
    margin: 0 0 8px 0 !important;
    color: #333;
    font-size: 1.3em;
}

.modal-social-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.modal-social-links .social-link {
    width: auto;
    height: auto;
    padding: 10px 20px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.modal-social-links .social-link i {
    font-size: 20px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .checkbox-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .directory-map-container {
        margin-bottom: 20px;
    }
    
    #directory-map {
        height: 300px !important;
    }
    
    .listing-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-listing-details {
        padding: 15px;
    }
    
    .modal-main-content h2 {
        font-size: 1.5em;
    }
}

/* Ensure modal is properly displayed when open */
body.directory-modal-open .listing-modal {
    display: block !important;
}
