/**
 * RTO Grow Enrolment Form Styles
 * @package RTOGrow
 * @since 2.1.0
 */

/* Modal */
.rto-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.rto-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.rto-modal-container {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 780px;
    width: 100%;
    max-height: 94vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.rto-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    color: #666;
    z-index: 10;
}

.rto-modal-close:hover {
    background: #e5e7eb;
}

/* Header */
.rto-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.rto-modal-header h2 {
    margin: 0 0 10px;
    font-size: 22px;
    font-weight: 700;
}

.rto-course-summary {
    background: #f9fafb;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: #555;
}

/* Steps */
.rto-steps {
    display: flex;
    justify-content: space-between;
    padding: 16px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.rto-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.rto-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #e5e7eb;
}

.rto-step.active:not(:last-child)::after,
.rto-step.completed:not(:last-child)::after {
    background: var(--rto-primary, #7c3aed);
}

.rto-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.rto-step.active .rto-step-num,
.rto-step.completed .rto-step-num {
    background: var(--rto-primary, #7c3aed);
    color: #fff;
}

.rto-step-label {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
}

.rto-step.active .rto-step-label {
    color: var(--rto-primary, #7c3aed);
    font-weight: 600;
}

/* Form Steps */
.rto-form-step {
    display: none;
    padding: 24px;
}

.rto-form-step.active {
    display: block;
}

.rto-form-step h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
}

.rto-step-desc {
    margin: 0 0 20px;
    color: #666;
    font-size: 14px;
}

/* Form Fields */
.rto-form-group {
    margin-bottom: 16px;
}

.rto-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.rto-form-group input[type="text"],
.rto-form-group input[type="email"],
.rto-form-group input[type="tel"],
.rto-form-group input[type="date"],
.rto-form-group input[type="password"],
.rto-form-group input[type="number"],
.rto-form-group textarea,
.rto-form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
}

.rto-form-group input:focus,
.rto-form-group textarea:focus,
.rto-form-group select:focus {
    outline: none;
    border-color: var(--rto-primary, #7c3aed);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.rto-field-error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
}

.rto-field-help {
    color: #666;
    font-size: 13px;
    margin-top: 4px;
}

.rto-field-help a {
    color: var(--rto-primary, #7c3aed);
}

/* Form Layout */
.rto-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0 16px;
}
.rto-form-row > .rto-form-group { box-sizing: border-box; }
.rto-half    { flex: 1 1 calc(50% - 16px);     min-width: 200px; }
.rto-third   { flex: 1 1 calc(33.333% - 16px); min-width: 150px; }
.rto-quarter { flex: 1 1 calc(25% - 16px);     min-width: 130px; }
.rto-form-group input, .rto-form-group select, .rto-form-group textarea { max-width: 100%; min-width: 0; box-sizing: border-box; }
.rto-form-step, .rto-enrolment-form { max-width: 100%; box-sizing: border-box; }

/* Checkboxes & Radios */
.rto-checkbox,
.rto-radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #444;
    cursor: pointer;
    margin-bottom: 8px;
}

.rto-checkbox input,
.rto-radio-group input {
    width: 18px;
    height: 18px;
    accent-color: var(--rto-primary, #7c3aed);
}

.rto-radio-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

/* Info Message */
.rto-info-msg {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 10px 14px;
    color: #1e40af;
    font-size: 14px;
    margin-bottom: 16px;
}

/* Buttons */
.rto-form-buttons {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.rto-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.rto-btn-primary {
    background: var(--rto-primary, #7c3aed);
    color: #fff;
}

.rto-btn-primary:hover {
    background: #6d28d9;
}

.rto-btn-primary:disabled {
    background: #a78bfa;
    cursor: not-allowed;
}

.rto-btn-secondary {
    background: #f3f4f6;
    color: #333;
}

.rto-btn-secondary:hover {
    background: #e5e7eb;
}

.rto-btn-link {
    background: none;
    border: none;
    color: var(--rto-primary, #7c3aed);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    margin-top: 8px;
}

/* Review Section */
.rto-review-section {
    margin-bottom: 20px;
}

.rto-review-section h4 {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 600;
}

.rto-review-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
    font-size: 14px;
}

.rto-review-box p {
    margin: 0 0 6px;
}

.rto-review-box p:last-child {
    margin-bottom: 0;
}

/* Price */
.rto-price-box {
    background: linear-gradient(135deg, var(--rto-primary, #7c3aed) 0%, var(--rto-primary-dark, #a855f7) 100%);
    color: #fff;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.rto-price {
    font-size: 32px;
    font-weight: 700;
}

/* Agreements */
.rto-agreements {
    margin-bottom: 20px;
}

.rto-agreements .rto-checkbox {
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
}

/* Success */
.rto-success-step {
    text-align: center;
    padding: 40px 24px;
}

.rto-success-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 20px;
}

.rto-success-step h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

.rto-success-step > p {
    color: #666;
    margin-bottom: 20px;
}

/* Mobile */
@media (max-width: 600px) {
    .rto-modal { padding: 0; }
    .rto-modal-container { border-radius: 0; max-height: 100vh; height: 100%; }
    .rto-step-label { display: none; }
    .rto-form-step { padding: 16px; }
    .rto-form-row { flex-direction: column; gap: 0; }
    .rto-half, .rto-third, .rto-quarter { flex: 1 1 100%; min-width: 0; }
    .rto-steps { padding: 12px 8px; }
    .rto-modal-header { padding-right: 56px; }
    .rto-pay-card { padding: 12px; }
    .rto-form-buttons { flex-direction: column-reverse; }
    .rto-btn { width: 100%; }
}


/* ── 2.12 additions: dynamic questions, payment choice, hand-off ── */
.rto-form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 15px; box-sizing: border-box; font-family: inherit; }
.rto-form-group .rto-q-label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 14px; color: #333; }
.rto-req { color: #dc2626; }
.rto-q.rto-invalid input[type="text"], .rto-q.rto-invalid input[type="tel"], .rto-q.rto-invalid input[type="date"],
.rto-q.rto-invalid input[type="number"], .rto-q.rto-invalid select, .rto-q.rto-invalid textarea,
.rto-form-group.rto-invalid input { border-color: #dc2626; }
.rto-q.rto-invalid .rto-q-label, .rto-q.rto-invalid > label:first-child { color: #b91c1c; }
.rto-q-hidden { display: none !important; }

.rto-form-error-banner { margin: 0 24px 20px; padding: 12px 14px; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 8px; font-size: 14px; }

.rto-pay-note { margin: 0 0 12px; padding: 10px 12px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px; color: #1e3a8a; font-size: 13px; }
.rto-pay-methods, .rto-pay-plans { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.rto-form-group .rto-pay-card, .rto-pay-card {
    display: grid; grid-template-columns: 22px 1fr; column-gap: 10px; row-gap: 2px; align-items: start;
    padding: 12px 14px; border: 1.5px solid #d1d5db; border-radius: 10px; background: #fff; cursor: pointer; margin: 0;
}
.rto-pay-card input { grid-row: 1 / span 2; margin-top: 3px; width: 18px; height: 18px; accent-color: var(--rto-primary, #7c3aed); }
.rto-pay-card-main { font-weight: 600; font-size: 14px; color: #111827; }
.rto-pay-card-sub { grid-column: 2; font-size: 13px; color: #4b5563; }
.rto-pay-card:has(input:checked) { border-color: var(--rto-primary, #7c3aed); background: #f5f3ff; box-shadow: 0 0 0 3px rgba(124,58,237,.12); }

.rto-next-box { margin: 20px 0; padding: 20px; border: 1px solid #ddd6fe; background: #f5f3ff; border-radius: 12px; }
.rto-next-box p { margin: 0 0 14px; color: #374151; }
.rto-next-box .rto-btn { display: inline-block; text-decoration: none; text-align: center; }
.rto-next-box .rto-next-count { margin: 12px 0 0; font-size: 13px; color: #6b7280; }
.rto-next-box .rto-next-count a { color: var(--rto-primary, #7c3aed); }
.rto-pay-group { display: flex; flex-direction: column; gap: 8px; }
.rto-pay-group + .rto-pay-group { margin-top: 6px; }
.rto-pay-group-title { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #6b7280; margin: 4px 2px 0; }
.rto-pay-save { font-size: 13px; font-weight: 600; color: #047857; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 8px; padding: 8px 12px; }
