/**
 * TJCM Data Management - Registration Modal Styles
 *
 * Styles for the frontend multi-step registration modal
 * triggered by the [TJCRegistration25] shortcode.
 *
 * @version 1.5.3
 */

/* ============================================= */
/* === Modal Overlay and Container === */
/* ============================================= */

.tjcm-modal-overlay {
    display: none; 
    position: fixed;
    inset: 0; 
    background-color: rgba(0, 0, 0, 0.65); 
    z-index: 999999; 
    overflow-y: auto; 
    padding: 124px 20px 40px 20px; 
}

.tjcm-modal-content {
    background-color: #fefefe; 
    max-width: 650px;
    margin: 0 auto; 
    padding: 25px 35px 35px 35px; 
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    position: relative; 
    text-align: left;
}

/* Close Button ('X') */
.tjcm-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 5px;
}
.tjcm-modal-close:hover,
.tjcm-modal-close:focus {
    color: #333;
    text-decoration: none;
}

/* Modal Title */
#tjcm-modal-title {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    font-size: 1.4em;
    line-height: 1.3;
}

/* ============================================= */
/* === School Info Display (Step 2) === */
/* ============================================= */
.tjcm-school-info-display {
    margin-bottom: 20px; 
    padding: 15px;      
    background-color: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 4px;
    display: flex;
    align-items: center; 
    gap: 15px; 
}

#tjcm_school_logo_img {
    display: none; 
    max-height: 60px;
    max-width: 150px;
    border: 1px solid #ddd;
    object-fit: contain; 
    flex-shrink: 0; 
}

.tjcm-school-info-display p {
    margin: 0; 
    font-size: 1.05em; 
    line-height: 1.4; 
}
.tjcm-school-info-display p strong {
    font-weight: 600;
}


/* ============================================= */
/* === Progress Bar === */
/* ============================================= */
.tjcm-progress-bar {
    display: flex;
    justify-content: space-between;
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px; 
}
.tjcm-progress-bar .tjcm-step {
    flex: 1;
    text-align: center;
    color: #aaa; 
    font-size: 0.9em;
    position: relative;
    padding-top: 30px; 
}
.tjcm-progress-bar .tjcm-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 12px; 
    left: 50%;
    width: 100%;
    height: 2px;
    background-color: #eee; 
    z-index: 1; 
}

.tjcm-progress-bar .tjcm-step span {
    display: block;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 26px; 
    height: 26px;
    line-height: 26px;
    border-radius: 50%;
    background-color: #aaa; 
    color: white;
    font-weight: bold;
    font-size: 0.9em;
    z-index: 2; 
    border: 2px solid #fefefe; 
    box-sizing: border-box;
}
.tjcm-progress-bar .tjcm-step.active {
    color: #0073aa; 
    font-weight: 600; 
}
.tjcm-progress-bar .tjcm-step.active span {
    background-color: #0073aa;
    border-color: #fefefe;
}
.tjcm-progress-bar .tjcm-step.completed {
    color: #4CAF50; 
}
.tjcm-progress-bar .tjcm-step.completed span {
    background-color: #4CAF50;
    border-color: #fefefe;
    color: white;
}
.tjcm-progress-bar .tjcm-step.completed span::before {
    content: '\2713'; 
    display: block; 
    font-size: 1.1em; 
    line-height: 22px; 
}
.tjcm-progress-bar .tjcm-step.completed:not(:last-child)::after {
    background-color: #4CAF50; 
}


/* ============================================= */
/* === Form Elements === */
/* ============================================= */
.tjcm-form-steps-container {
    min-height: 200px; 
    margin-bottom: 20px;
}

.tjcm-step-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.tjcm-form-field {
    margin-bottom: 20px;
}
.tjcm-form-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600; 
    font-size: 0.95em;
    color: #444;
}
.tjcm-input,
.tjcm-modal-content select,
.tjcm-modal-content textarea {
    width: 100%;
    padding: 10px 12px; 
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
}
.tjcm-input[type="date"], 
.tjcm-input.tjcm-datepicker { 
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 16px 16px;
}

.tjcm-input:focus,
.tjcm-modal-content select:focus,
.tjcm-modal-content textarea:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

.tjcm-checkbox-field {
    padding-top: 5px;
    padding-bottom: 5px;
}
.tjcm-checkbox-field label {
    display: inline-block;
    margin-left: 8px;
    font-weight: normal; 
    color: #333;
}
.tjcm-checkbox-field input[type="checkbox"] {
    vertical-align: middle;
    margin-right: 0; 
    width: 16px; 
    height: 16px;
}
.tjcm-checkbox-field p { 
    font-size: smaller;
    color: #666;
    margin-left: 25px !important; 
    margin-top: 5px !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
}

.tjcm-field-error {
    color: #d63638; 
    font-size: 0.85em;
    margin-top: 5px;
    display: none; 
}
.tjcm-form-field input.error,
.tjcm-form-field select.error,
.tjcm-form-field textarea.error {
    border-color: #d63638 !important; 
}
.tjcm-form-field input[type="checkbox"].error + label {
    color: #d63638; 
}

#tjcm-general-error-message {
    padding: 10px 15px !important; 
}
#tjcm-general-error-message p {
    margin: 0 !important;
    padding: 0 !important;
}

.tjcm-student-entry h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #555;
}
#tjcm-students-added-list {
    background-color: #f8f9fa;
    border: 1px dashed #ccc;
    padding: 10px 15px;
    margin-top: 15px;
    font-size: 0.9em;
    border-radius: 4px;
}
#tjcm-students-added-list ul {
    margin: 5px 0 0 20px;
    padding: 0;
}
#tjcm-students-added-list li {
    margin-bottom: 3px;
    /* Added for edit/remove buttons */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Styling for Edit/Remove links in the added students list */
#tjcm-students-added-list li button.button-link {
    margin-left: 10px;
    padding: 0;
    border: none;
    background: none;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9em; /* Match list item font size */
}
#tjcm-students-added-list li button.button-link.delete {
    color: #d63638; /* WordPress error red */
}
#tjcm-students-added-list li button.button-link.delete:hover {
    color: #a02426;
}
#tjcm-students-added-list li button.button-link:hover { /* For edit button hover */
    color: #0073aa; /* WordPress blue */
}

.tjcm-editing-indicator {
    font-size: 0.8em;
    font-style: italic;
    color: #777;
    margin-left: 5px;
}


#tjcm-processing-message p {
    font-size: 1.1em;
    margin-bottom: 20px;
}

.tjcm-spinner {
    border: 4px solid #f3f3f3; 
    border-top: 4px solid #0073aa; 
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: tjcm-spin 1s linear infinite;
    display: inline-block;
    margin: 0 auto; 
}
.tjcm-ajax-spinner { 
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    animation: tjcm-spin 1s linear infinite;
    display: none; 
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes tjcm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tjcm-modal-navigation {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between; 
    align-items: center;
}
.tjcm-nav-buttons {
    display: flex;
    gap: 10px; 
    justify-content: flex-end; 
    flex-grow: 1; 
}

#tjcm-registration-modal .tjcm-nav-buttons button {
    box-shadow: none;
    text-shadow: none;
    height: auto;
    line-height: normal;
    margin: 0;
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out, color 0.2s ease-in-out, opacity 0.2s ease-in-out;
    vertical-align: middle;
}

#tjcm-registration-modal .tjcm-nav-buttons button.button-primary,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-validate,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-next,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-finish-students,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-submit {
    background-color: #0073aa; 
    border-color: #006799;
    color: #ffffff;
}
#tjcm-registration-modal .tjcm-nav-buttons button.button-primary:hover,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-validate:hover,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-next:hover,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-finish-students:hover,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-submit:hover {
    background-color: #005f8c;
    border-color: #004c70;
    color: #ffffff;
}
#tjcm-registration-modal .tjcm-nav-buttons button.button-primary:focus,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-validate:focus,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-next:focus,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-finish-students:focus,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-submit:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #0073aa;
}

#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-prev,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-add-student {
    background-color: #f0f0f1;
    border-color: #cccccc;
    color: #333333;
}
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-prev:hover,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-add-student:hover {
    background-color: #e0e0e0;
    border-color: #bbbbbb;
    color: #000000;
}
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-prev:focus,
#tjcm-registration-modal .tjcm-nav-buttons button.tjcm-button-add-student:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #7e8993; 
}

#tjcm-registration-modal .tjcm-nav-buttons button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #ddd !important; 
    border-color: #ccc !important;
    color: #aaa !important;
}

@media (max-width: 600px) {
    .tjcm-modal-content {
        padding: 15px 20px 20px 20px;
    }
    .tjcm-progress-bar .tjcm-step {
        font-size: 0.8em; 
        padding-top: 25px;
    }
    .tjcm-progress-bar .tjcm-step span {
        width: 22px;
        height: 22px;
        line-height: 22px;
        font-size: 0.75em;
    }
    .tjcm-progress-bar .tjcm-step:not(:last-child)::after {
        top: 11px; 
    }

    #tjcm-registration-modal .tjcm-nav-buttons button {
        padding: 8px 12px;
        font-size: 13px;
    }
}
