/* Modal Overlay */
.sl-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
}

/* Modal Content */
.sl-modal-content {
    background-color: #fefefe;
    margin: 2% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 1000px;
    border-radius: 8px;
    position: relative;
}

/* Close Button (Updated for Accessibility) */
.sl-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.sl-close:hover,
.sl-close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
    outline: 2px solid #0073aa;
    /* Focus visibility */
}

/* Headings */
.sl-modal-content h2 {
    margin-bottom: 5px;
}

.sl-subheading {
    font-size: 16px;
    color: #666;
    margin-top: 0;
    margin-bottom: 15px;
}

/* New Search Bar in Modal */
.sl-search-container {
    background: #f9f9f9;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sl-search-container label {
    font-weight: bold;
    margin-bottom: 0;
}

.sl-search-container input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 120px;
}

.sl-search-btn {
    background-color: #555;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.sl-search-btn:hover {
    background-color: #333;
}

.sl-search-btn:focus,
.sl-search-container input:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Layout Grid */
.sl-layout {
    display: flex;
    gap: 20px;
    height: 300px;
    margin-top: 20px;
}

/* List Side */
.sl-list-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 10px;
}

/* Map Side */
.sl-map-container {
    flex: 1;
    height: 100%;
    background: #eee;
    border-radius: 4px;
}

/* Footer */
.sl-footer {
    margin-top: 20px;
    text-align: right;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

/* Buttons */
.sl-btn-primary {
    background-color: #0073aa;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.sl-btn-primary:hover {
    background-color: #005177;
}

.sl-btn-primary:focus {
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* School Item Card */
.sl-school-item {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.sl-school-item h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

/* Specific Address Styles */
.sl-school-item p.sl-address {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
}

/* Specific Distance Styles */
.sl-school-item p.sl-distance {
    margin: 0 0 10px 0;
    color: #888;
    font-size: 13px;
    font-style: italic;
}

.sl-select-btn {
    background: #fff;
    border: 1px solid #0073aa;
    color: #0073aa;
    padding: 5px 15px;
    cursor: pointer;
    border-radius: 3px;
}

.sl-select-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 1px;
}

/* Selected State */
.sl-school-item.selected {
    background-color: #e3f2fd;
    border-color: #0073aa;
}

.sl-school-item.selected .sl-select-btn {
    background-color: #0073aa;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .sl-layout {
        flex-direction: column-reverse;
        /* Map on top on mobile */
        height: auto;
    }

    .sl-map-container {
        height: 300px;
    }

    .sl-list-container {
        max-height: 300px;
    }
}

/* Hide the original checkboxes in the form */
.hidden-school-checkboxes {
    display: none !important;
}

/* =========================================
   NEW STYLES FOR BUTTONS
   ========================================= */

/* Hide Real Gravity Forms Submit Button */
#gform_submit_button_26 {
    position: absolute;
    visibility: hidden;
    opacity: 0;
    height: 0;
    width: 0;
    padding: 0;
    border: 0;
    margin: 0;
}

/* Style "Fake" Trigger Button to match theme */
#trigger-school-search {
    text-transform: uppercase;
    font-size: 18px;
    background: var(--color-secondary, #0073aa);
    /* Added fallback just in case */
    color: var(--color-white, #ffffff);
    font-weight: 700;
    border: none;
    padding: 12px 24px;
    /* Standard button padding */
    cursor: pointer;
    width: 100%;
    /* Ensure it fills the container like a standard submit */
    display: inline-block;
    text-align: center;
}

#trigger-school-search:hover {
    opacity: 0.9;
}

#trigger-school-search:focus {
    outline: 3px solid #000;
    outline-offset: 2px;
}

/* ==========================================
   SHORTCODE MAP STYLES (New)
   ========================================== */
.sms-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
    background-color: #eee;
    overflow: hidden;
}

.sms-map-canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.sms-card-overlay {
    position: absolute;
    right: 5%;
    bottom: 10%;
    /* Adjusted to look like floating card */
    width: 90%;
    max-width: 450px;
    background: #fff;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 2px;
    z-index: 10;
}

.sms-card-overlay h2 {
    font-size: 32px;
    color: #0073aa;
    margin-bottom: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.sms-highlight {
    color: #dfc668;
    /* Gold Highlight */
}

.sms-card-overlay p {
    color: #555;
    font-size: 16px;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Search Form in Overlay */
.sms-input-wrapper {
    position: relative;
    display: flex;
    background: #f2f4f8;
    /* Light grey background for input */
    border-radius: 4px;
    padding: 5px;
}

.sms-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 15px;
    font-size: 16px;
    color: #333;
    outline: none;
}

.sms-input-wrapper button {
    background: transparent;
    border: none;
    color: #0073aa;
    cursor: pointer;
    padding: 0 15px;
    display: flex;
    align-items: center;
}

.sms-input-wrapper button:hover {
    color: #005177;
}

/* Mobile Responsive for Shortcode */
@media (max-width: 768px) {
    .sms-wrapper {
        height: auto;
        display: flex;
        flex-direction: column-reverse;
        /* Card below map on mobile */
    }

    .sms-map-canvas {
        position: relative;
        height: 300px;
    }

    .sms-card-overlay {
        position: relative;
        right: auto;
        bottom: auto;
        width: 100%;
        max-width: 100%;
        padding: 30px 20px;
        box-shadow: none;
    }
}

/* =========================================
   VALIDATION STYLES
   ========================================= */

/* Error state for text inputs */
.sl-input-error {
    border: 2px solid #d32f2f !important;
    /* Red Border */
    background-color: #ffebee !important;
    /* Light Red Background */
}

/* Error state for Checkbox Containers */
.sl-checkbox-error .gfield_checkbox {
    outline: 2px solid #d32f2f;
    padding: 5px;
    border-radius: 4px;
    background-color: #ffebee;
}

/* Shake animation for visual feedback */
@keyframes sl-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-3px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(3px);
    }
}

.sl-shake {
    animation: sl-shake 0.8s;
}

.sl-error-message {
    color: #d32f2f;
    font-weight: 700;
    margin-right: 15px;
    /* Space between text and button */
    display: inline-block;
    vertical-align: middle;
}