/* ========================================
   CSS Variables - Consolidated
   ======================================== */
:root {
    --dynamic-bg-color: #4E185B;
    --dynamic-color: #E5BC1F;
    --dynamic-background-color-input: #dbcddc;
    --dynamic-border-radius: 4px;
    --dynamic-transition: all 0.2s ease-in-out;
    --dynamic-shadow: 0 4px 12px rgba(78, 24, 91, 0.2);
}

/* ========================================
   Layout & Container - Bootstrap Compatible
   ======================================== */
.outreach-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.back-link {
    color: var(--dynamic-bg-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--dynamic-transition);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 1rem;
}

.back-link:hover {
    color: var(--dynamic-color);
    text-decoration: underline;
}

/* ========================================
   Header Styles - Mobile First
   ======================================== */
.form-header {
    background-color: var(--dynamic-bg-color);
    padding: 1rem;
    border-radius: var(--dynamic-border-radius);
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

@media (min-width: 768px) {
    .form-header {
        flex-direction: row;
        text-align: left;
        padding: 1rem 1.5rem;
        align-items: center;
        justify-content: space-between;
    }
}

.section-title {
    color: var(--dynamic-color);
    font-weight: 600;
    font-size: 1.5rem;
    margin: 0;
    line-height: 1.3;
}

@media (min-width: 768px) {
    .section-title {
        font-size: 1.75rem;
    }
}

.logo-img {
    max-height: 100px;
    width: auto;
    max-width: 100%;
}

@media (min-width: 768px) {
    .logo-img {
        max-height: 150px;
    }
}

/* ========================================
   Alerts & Notices
   ======================================== */
.alert-notice {
    background-color: var(--dynamic-background-color-input);
    border-left: 4px solid var(--dynamic-bg-color);
    color: var(--dynamic-bg-color);
    font-weight: 500;
    border-radius: 0 var(--dynamic-border-radius) var(--dynamic-border-radius) 0;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.alert-box {
    border-left: 4px solid #dc3545;
    background-color: #fff5f5;
    border-radius: var(--dynamic-border-radius);
    padding: 1rem;
    outline: none;
    transition: opacity 0.2s ease;
}

.alert-box:focus {
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.4);
}

.alert-box:not(.d-none) {
    display: block !important;
    animation: slideDown 0.3s ease-out;
}

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

.error-list {
    padding-left: 1.25rem;
    color: #721c24;
    list-style-type: disc;
    margin: 0;
}

.error-list li {
    margin-bottom: 0.25rem;
    line-height: 1.4;
    font-size: 0.95rem;
}

/* ========================================
   Form Sections & Fieldsets
   ======================================== */
.form-section {
    border: 1px solid #dee2e6;
    border-radius: var(--dynamic-border-radius);
    padding: 1rem;
    background-color: #fff;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .form-section {
        padding: 1.25rem;
    }
}

.section-legend {
    color: var(--dynamic-bg-color);
    font-weight: 600;
    font-size: 1.15rem;
    padding: 0 0.5rem;
    margin: 0 0 1rem 0;
    width: auto;
    border-bottom: 2px solid var(--dynamic-color);
    float: none;
}

@media (min-width: 768px) {
    .section-legend {
        font-size: 1.25rem;
    }
}

/* ========================================
   Labels & Inputs - Full Width on Mobile
   ======================================== */
.label-heading {
    background-color: var(--dynamic-bg-color);
    color: var(--dynamic-color);
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: var(--dynamic-border-radius);
    display: flex;
    align-items: center;
    min-height: 40px;
    margin: 0 0 0.5rem 0;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.95rem;
}

@media (min-width: 768px) {
    .label-heading {
        margin: 0;
        min-height: 42px;
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
}

.form-control {
    background-color: var(--dynamic-background-color-input) !important;
    border: 1px solid #ced4da;
    border-radius: var(--dynamic-border-radius);
    padding: 0.5rem 0.75rem;
    transition: var(--dynamic-transition);
    width: 100%;
    box-sizing: border-box;
    font-size: 1rem;
}

.form-control:focus {
    background-color: #fff !important;
    border-color: var(--dynamic-color);
    box-shadow: 0 0 0 0.2rem rgba(229, 188, 31, 0.25);
    outline: none;
}

.form-control.is-invalid {
    border-color: #dc3545;
    background-color: #fff5f5 !important;
    padding-right: calc(1.5em + 1rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.375rem) center;
    background-size: calc(0.75em + 0.75rem) calc(0.75em + 0.75rem);
}

.invalid-feedback {
    font-size: 0.875rem;
    color: #dc3545;
    margin-top: 0.25rem;
    display: block;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ========================================
   SELECT BOX STYLING (Educational Sessions)
   ======================================== */
.form-select,
select.form-control {
    background-color: var(--dynamic-background-color-input) !important;
    border: 1px solid #ced4da;
    border-radius: var(--dynamic-border-radius);
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234E185B' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    appearance: none;
    cursor: pointer;
    transition: var(--dynamic-transition);
    width: 100%;
    box-sizing: border-box;
    font-size: 1rem;
}

.form-select:focus,
select.form-control:focus {
    background-color: #fff !important;
    border-color: var(--dynamic-color);
    box-shadow: 0 0 0 0.2rem rgba(229, 188, 31, 0.25);
    outline: none;
}

.form-select:disabled,
select.form-control:disabled {
    background-color: #e9ecef !important;
    cursor: not-allowed;
    opacity: 0.7;
    background-image: none;
}

.form-select.is-invalid,
select.form-control.is-invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234E185B' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-position: right 0.75rem center, center right 2.25rem;
    background-size: 16px 12px, 16px 12px;
}

/* Hide old checkbox card styles */
.session-card,
.session-card-label,
.educational-session-checkbox {
    display: none;
}

/* ========================================
   Checkbox & Conditional Fields
   ======================================== */
.academy-trust-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--dynamic-bg-color);
    cursor: pointer;
    flex-shrink: 0;
}

.academy-trust-fields {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.5rem;
}

@media (min-width: 768px) {
    .academy-trust-fields {
        flex-direction: row;
        align-items: center;
        margin-top: 0;
    }
}

.academy-trust-fields .form-control {
    width: 100%;
    min-width: unset;
}

@media (min-width: 768px) {
    .academy-trust-fields .form-control {
        min-width: 200px;
        flex: 1;
    }
}

/* ========================================
   Educational Content Links
   ======================================== */
.content-info a {
    color: var(--dynamic-color);
    font-weight: 500;
    text-decoration: none;
    transition: var(--dynamic-transition);
}

.content-info a:hover {
    text-decoration: underline;
    color: #ffc107;
}

.text-highlight {
    color: var(--dynamic-color);
    font-weight: 600;
}

.text-justify {
    text-align: justify;
    margin-bottom: 0.75rem;
    line-height: 1.6;
    font-size: 0.95rem;
}

.content-info p:last-child {
    margin-bottom: 0;
}

/* ========================================
   Submit Button - Full Width on Mobile
   ======================================== */
.btn-submit {
    background-color: var(--dynamic-color);
    color: var(--dynamic-bg-color);
    border: none;
    border-radius: 28px;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 2rem;
    transition: var(--dynamic-transition);
    width: 100%;
    max-width: 300px;
    cursor: pointer;
}

@media (min-width: 768px) {
    .btn-submit {
        font-size: 1.125rem;
        padding: 0.75rem 2.5rem;
        min-width: 200px;
        width: auto;
    }
}

.btn-submit:hover:not(:disabled) {
    background-color: #d4a915;
    transform: translateY(-2px);
    box-shadow: var(--dynamic-shadow);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   Term Time Notice & Time Input
   ======================================== */
.form-text.text-muted {
    color: #6c757d !important;
    font-size: 0.85rem;
    display: block;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.form-text.text-muted i {
    color: var(--dynamic-color);
}

#sessionTime {
    text-transform: uppercase;
}

/* ========================================
   Agreement Checkboxes & Footer
   ======================================== */
.agreement-checkbox {
    padding: 0.75rem;
    background-color: var(--dynamic-background-color-input);
    border-radius: var(--dynamic-border-radius);
    border-left: 3px solid var(--dynamic-bg-color);
    margin-bottom: 0.75rem;
}

.agreement-checkbox:last-child {
    margin-bottom: 0;
}

.agreement-checkbox .form-check-input {
    width: 20px;
    height: 20px;
    accent-color: var(--dynamic-bg-color);
    margin-top: 0.15rem;
    cursor: pointer;
}

.agreement-checkbox .form-check-label {
    font-weight: 500;
    color: var(--dynamic-bg-color);
    cursor: pointer;
    padding-left: 0.25rem;
    font-size: 0.95rem;
    display: block;
}

.agreement-checkbox .form-check-label a {
    color: var(--dynamic-color);
    text-decoration: none;
    font-weight: 600;
}

.agreement-checkbox .form-check-label a:hover {
    text-decoration: underline;
    color: #ffc107;
}

.agreement-checkbox.is-invalid {
    border-left-color: #dc3545;
    background-color: #fff5f5;
}

.agreement-footer {
    background-color: var(--dynamic-background-color-input);
    border-radius: var(--dynamic-border-radius);
    padding: 1rem;
    margin-top: 1rem;
}

.agreement-footer .row {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
}

@media (min-width: 768px) {
    .agreement-footer .row {
        flex-direction: row;
        text-align: left;
    }

    .agreement-footer .col-md-4 {
        text-align: right;
    }
}

.logo-img-small {
    max-height: 70px;
    width: auto;
    max-width: 100%;
}

@media (min-width: 768px) {
    .logo-img-small {
        max-height: 80px;
    }
}

.agreement-link {
    color: var(--dynamic-color);
    font-weight: 600;
    text-decoration: none;
}

.agreement-link:hover {
    text-decoration: underline;
    color: #ffc107;
}

/* Empty state for sessions */
.alert-info {
    background-color: var(--dynamic-background-color-input);
    border-left: 4px solid var(--dynamic-color);
    color: var(--dynamic-bg-color);
    border-radius: var(--dynamic-border-radius);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.alert-link {
    color: var(--dynamic-bg-color);
    font-weight: 600;
    text-decoration: none;
}

.alert-link:hover {
    text-decoration: underline;
}

/* ========================================
   Form Row Layout - Mobile First Stacking
   ======================================== */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0 -0.5rem;
}

.form-row > [class*="col-"] {
    padding: 0 0.5rem;
    width: 100%;
}

@media (min-width: 768px) {
    .form-row {
        flex-direction: row;
        gap: 0;
        margin: 0 -0.75rem;
    }

    .form-row > [class*="col-"] {
        padding: 0 0.75rem;
    }

    .form-row > .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .form-row > .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .form-row > .col-md-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }
}

/* Align items in form rows */
.form-row.align-items-center {
    align-items: flex-start;
}

@media (min-width: 768px) {
    .form-row.align-items-center {
        align-items: center;
    }
}

/* ========================================
   Scroll & Animation
   ======================================== */
html {
    scroll-behavior: smooth;
}

html.no-smooth-scroll {
    scroll-behavior: auto !important;
}

.alert-box,
.form-section {
    will-change: transform, opacity;
}

/* Focus visible for keyboard navigation */
.form-control:focus-visible,
.btn-submit:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
    outline: 2px solid var(--dynamic-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .btn-submit,
    .back-link,
    .form-header {
        display: none;
    }

    .form-section {
        break-inside: avoid;
        border: 1px solid #000;
        padding: 0.5rem;
    }

    body {
        font-size: 11pt;
    }
}

/* ========================================
   Extra Small Mobile Fixes (< 576px)
   ======================================== */
@media (max-width: 575px) {
    .outreach-container {
        padding: 0 0.75rem;
    }

    .form-header {
        padding: 0.75rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .logo-img {
        max-height: 80px;
    }

    .form-section {
        padding: 0.75rem;
    }

    .section-legend {
        font-size: 1rem;
    }

    .label-heading {
        font-size: 0.9rem;
        padding: 0.4rem 0.6rem;
    }

    .form-control,
    .form-select {
        font-size: 0.95rem;
        padding: 0.45rem 0.75rem;
    }

    .btn-submit {
        font-size: 0.95rem;
        padding: 0.65rem 1.5rem;
    }

    .alert-notice,
    .alert-box,
    .alert-info {
        font-size: 0.9rem;
        padding: 0.65rem 0.85rem;
    }

    .agreement-checkbox {
        padding: 0.6rem 0.75rem;
    }

    .agreement-checkbox .form-check-label {
        font-size: 0.9rem;
    }
}

/* ========================================
   Touch Device Improvements
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    .form-control,
    .form-select,
    .btn-submit,
    .form-check-input {
        min-height: 44px; /* Apple touch target guideline */
    }

    .label-heading {
        min-height: 44px;
    }

    .btn-submit {
        padding: 0.85rem 2rem;
    }
}
