/**
 * Command Education HubSpot Integration
 * Form Styles - Updated Design
 */

/* ===== Variables - Updated Color Palette ===== */
:root {
    /* New Color Palette */
    --navy: #1a2b4a;
    --navy-light: #2d4165;
    --blue: #D5E1EC;
    --blue-light: #E3EBF3;
    --blue-dark: #C4D4E3;
    --white: #ffffff;
    --cream: #fafaf8;
    --gray-light: #e8e8e6;
    --gray-medium: #8b8b89;
    --gray-dark: #4a4a48;
    
    /* Utility Colors */
    --ce-error: #d9534f;
    --ce-success: #5cb85c;

    /* Effects */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Typography Import ===== */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ===== Global Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== Form Wrapper ===== */
.ce-intake-form-wrapper {
    max-width: 800px;
    margin: 40px auto;
    background: linear-gradient(135deg, #f5f5f3 0%, #fafaf8 100%);
    padding: 40px 20px;
}

/* Embed Mode Styling */
.ce-intake-form-wrapper.ce-embed-mode {
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    background: var(--white);
}

.ce-intake-form-wrapper.ce-embed-mode .ce-form-header {
    padding: 30px 20px 20px;
}

.ce-intake-form-wrapper.ce-embed-mode .ce-progress-bar {
    padding: 30px 20px;
}

.ce-intake-form-wrapper.ce-embed-mode .ce-form-card {
    box-shadow: none;
    border-radius: 0;
    padding: 30px 20px;
}

/* ===== Form Header ===== */
.ce-form-header {
    text-align: center;
    margin-bottom: 50px;
}

.ce-form-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 42px;
    font-weight: 500;
    color: var(--navy);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.ce-form-subtitle {
    font-size: 16px;
    color: var(--gray-medium);
    font-weight: 300;
    font-family: 'Inter', sans-serif;
}

/* ===== Progress Indicator ===== */
.ce-progress-container {
    margin-bottom: 50px;
}

.ce-progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    padding: 0 24px;
}

.ce-progress-line {
    position: absolute;
    top: 24px;
    left: 48px;
    right: 48px;
    height: 2px;
    background: var(--gray-light);
    z-index: 0;
}

.ce-progress-line-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--blue-dark), var(--blue));
    transition: width 0.5s ease;
    width: 0%;
}

.ce-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    width: 33.333%;
}

.ce-progress-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    color: var(--gray-medium);
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-family: 'Inter', sans-serif;
}

.ce-progress-step.active .ce-progress-number {
    background: linear-gradient(135deg, var(--blue-dark), var(--blue));
    border-color: var(--blue-dark);
    color: var(--navy);
    box-shadow: 0 4px 16px rgba(213, 225, 236, 0.4);
}

.ce-progress-step.completed .ce-progress-number {
    background: var(--navy);
    border-color: var(--navy);
    color: var(--white);
}

.ce-progress-label {
    margin-top: 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-medium);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    max-width: 100px;
    line-height: 1.3;
}

.ce-progress-step.active .ce-progress-label {
    color: var(--navy);
    font-weight: 600;
}

.ce-progress-step.completed .ce-progress-label {
    color: var(--navy);
}

/* ===== Form Card ===== */
.ce-form-card {
    background: var(--white);
    border-radius: 16px;
    padding: 50px;
    box-shadow: 0 8px 40px rgba(26, 43, 74, 0.08);
    transition: var(--transition);
}

/* ===== Form Steps ===== */
.ce-intake-form {
    font-family: 'Inter', sans-serif;
}

.ce-form-step {
    display: none;
    animation: fadeIn 0.4s ease;
}

.ce-form-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ce-form-step h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 32px;
    font-weight: 500;
    color: var(--navy);
    margin-bottom: 8px;
}

.ce-form-step .description,
.ce-form-step p.description {
    font-size: 15px;
    color: var(--gray-medium);
    margin-bottom: 40px;
    font-weight: 300;
}

.ce-form-step h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 26px;
    font-weight: 500;
    color: var(--navy);
    margin-bottom: 8px;
}

.ce-form-step h4 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px;
    font-weight: 500;
    color: var(--navy);
    margin-bottom: 12px;
}

/* ===== Form Fields ===== */
.ce-form-field {
    margin-bottom: 20px;
}

.ce-form-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--navy);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
}

.ce-form-field .required {
    color: var(--blue-dark);
    margin-left: 4px;
}

.ce-form-field input[type="text"],
.ce-form-field input[type="email"],
.ce-form-field input[type="tel"],
.ce-form-field input[type="url"],
.ce-form-field select,
.ce-form-field textarea {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid var(--gray-light);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--navy);
    background: var(--white);
    transition: var(--transition);
    box-sizing: border-box;
    outline: none;
    box-shadow: 0 1px 3px rgba(26, 43, 74, 0.05);
}

.ce-form-field textarea {
    border-radius: 12px;
    line-height: 1.6;
    resize: vertical;
    min-height: 120px;
}

.ce-form-field input:hover,
.ce-form-field textarea:hover {
    border-color: var(--blue);
    box-shadow: 0 2px 6px rgba(26, 43, 74, 0.08);
}

.ce-form-field input:focus,
.ce-form-field select:focus,
.ce-form-field textarea:focus {
    border-color: var(--blue-dark);
    box-shadow: 0 0 0 3px rgba(213, 225, 236, 0.25), 0 2px 8px rgba(26, 43, 74, 0.08);
}

.ce-form-field input::placeholder,
.ce-form-field textarea::placeholder {
    color: var(--gray-medium);
    opacity: 0.6;
}

.ce-form-field select {
    cursor: pointer;
    appearance: none;
    background-color: var(--white);
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='9' viewBox='0 0 14 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L7 7.5L13 1.5' stroke='%23C4D4E3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 45px;
    font-weight: 400;
}

.ce-form-field select:hover {
    border-color: var(--blue);
}

.ce-form-field select option {
    padding: 12px;
    background: var(--white);
    color: var(--navy);
    font-weight: 400;
}

.ce-form-field.has-error input,
.ce-form-field.has-error select,
.ce-form-field.has-error textarea {
    border-color: var(--ce-error);
    background-color: #fff5f5;
}

.ce-error-message {
    display: none;
    color: var(--ce-error);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    margin-top: 6px;
}

.ce-form-field.has-error .ce-error-message {
    display: block;
}

.ce-help-text {
    display: block;
    color: var(--gray-medium);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    margin-top: 6px;
    line-height: 1.4;
}

/* ===== Form Rows (2-column layout) ===== */
.ce-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* ===== Circle Selection Buttons ===== */
.ce-circle-selection-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.ce-circle-option {
    position: relative;
    cursor: pointer;
}

.ce-circle-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ce-circle-option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 16px;
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    background: var(--white);
    transition: var(--transition);
    min-height: 80px;
    box-shadow: 0 1px 3px rgba(26, 43, 74, 0.05);
}

.ce-circle-option:hover .ce-circle-option-content {
    border-color: var(--blue);
    background: rgba(213, 225, 236, 0.15);
    box-shadow: 0 2px 6px rgba(26, 43, 74, 0.08);
}

.ce-circle-option input[type="radio"]:checked + .ce-circle-option-content {
    border-color: var(--blue-dark);
    background: linear-gradient(135deg, rgba(213, 225, 236, 0.25), rgba(227, 235, 243, 0.15));
    box-shadow: 0 4px 12px rgba(213, 225, 236, 0.3);
}

.ce-circle-option-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
    text-align: center;
    font-family: 'Inter', sans-serif;
}

/* ===== Referral Selection Grid ===== */
.ce-referral-selection-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* ===== Social Media Platform Grid ===== */
.ce-social-platform-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.ce-social-platform-grid .ce-circle-option.ce-small .ce-circle-option-content {
    padding: 12px 10px;
    min-height: 45px;
}

.ce-social-platform-grid .ce-circle-option.ce-small .ce-circle-option-title {
    font-size: 14px;
}

/* ===== Student/Parent Blocks ===== */
.ce-student-block,
.ce-parent-block {
    padding: 32px;
    background: var(--cream);
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid var(--gray-light);
}

.ce-student-block h3,
.ce-parent-block h4 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 24px;
    font-weight: 500;
    color: var(--navy);
    margin: 0 0 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ce-remove-parent,
.ce-remove-student {
    background: var(--ce-error);
    color: var(--white);
    border: none;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    font-weight: 600;
    transition: background 0.3s ease;
}

.ce-remove-parent:hover,
.ce-remove-student:hover {
    background: #c9302c;
}

/* ===== Buttons ===== */
.ce-btn {
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.ce-btn-secondary {
    background: transparent;
    color: var(--navy);
    border: 2px solid var(--navy);
}

.ce-btn-secondary:hover:not(:disabled) {
    background: var(--navy);
    color: var(--white);
}

.ce-btn-primary,
.ce-btn-next,
.ce-submit-btn {
    background: var(--navy);
    color: var(--white);
    border: none;
    box-shadow: 0 4px 16px rgba(26, 43, 74, 0.2);
}

.ce-btn-primary:hover:not(:disabled),
.ce-btn-next:hover:not(:disabled),
.ce-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(26, 43, 74, 0.3);
    background: var(--navy-light);
}

.ce-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ce-add-student,
.ce-add-parent {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    border: 2px solid var(--navy);
    border-radius: 12px;
    color: var(--navy);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 24px;
    font-family: 'Inter', sans-serif;
}

.ce-add-student:hover,
.ce-add-parent:hover {
    background: var(--navy);
    color: var(--white);
}

.ce-add-student::before,
.ce-add-parent::before {
    content: '+';
    font-size: 20px;
    font-weight: 400;
}

/* ===== Form Navigation ===== */
.ce-form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--gray-light);
}

.ce-form-navigation .ce-btn-next,
.ce-form-navigation .ce-submit-btn {
    margin-left: auto;
}

/* ===== Section Divider ===== */
.ce-section-divider {
    margin: 48px 0;
    border: none;
    border-top: 1px solid var(--gray-light);
    height: 1px;
    background: var(--gray-light);
}

.ce-subsection-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 26px;
    font-weight: 500;
    color: var(--navy);
    margin-bottom: 8px;
}

.ce-subsection-subtitle {
    font-size: 14px;
    color: var(--gray-medium);
    margin-bottom: 24px;
}

/* ===== Conditional Fields ===== */
.ce-conditional-field,
.ce-us-location,
.ce-international-location,
.ce-press-attribution,
.ce-role-other-field {
    margin-top: 24px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Checkbox styling ===== */
.ce-consent-field {
    margin: 24px 0;
}

.ce-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
}

.ce-checkbox-label input[type="checkbox"] {
    margin-right: 12px;
    margin-top: 3px;
    cursor: pointer;
    width: 20px;
    height: 20px;
    accent-color: var(--blue-dark);
}

.ce-checkbox-label span {
    flex: 1;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--navy);
}

.ce-checkbox-label a {
    color: var(--navy);
    text-decoration: none;
    font-weight: 500;
}

.ce-checkbox-label a:hover {
    text-decoration: underline;
}

/* ===== Review Summary ===== */
.ce-form-review {
    background: var(--cream);
    padding: 30px;
    border-radius: 12px;
    margin: 24px 0;
    border: 1px solid var(--gray-light);
}

.ce-form-review h3 {
    font-family: 'Cormorant Garamond', serif;
    color: var(--navy);
    margin-top: 0;
    margin-bottom: 20px;
}

.ce-review-section {
    margin-bottom: 20px;
}

.ce-review-section h4 {
    font-family: 'Cormorant Garamond', serif;
    color: var(--navy);
    font-size: 18px;
    margin-bottom: 10px;
}

.ce-review-section p {
    font-family: 'Inter', sans-serif;
    margin: 6px 0;
    color: var(--navy);
    line-height: 1.6;
}

.ce-review-summary {
    font-family: 'Inter', sans-serif;
}

/* ===== Messages ===== */
.ce-form-messages {
    margin: 24px 0;
    padding: 16px 20px;
    border-radius: 12px;
}

.ce-success-message {
    color: #155724;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
}

.ce-form-messages .ce-error-message {
    display: none;
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}

.ce-form-messages .ce-error-message:not(:empty) {
    display: block;
}

/* ===== Loading State ===== */
.ce-intake-form.loading {
    opacity: 0.6;
    pointer-events: none;
}

.ce-submit-btn:disabled::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* ===== Select2 Overrides ===== */
.select2-container {
    z-index: 9999;
}

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border: 1.5px solid var(--gray-light);
    border-radius: 12px;
    min-height: 48px;
    padding: 4px 8px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--navy);
    line-height: 38px;
    padding-left: 12px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--navy);
    border: none;
    border-radius: 20px;
    color: var(--white);
    font-family: 'Inter', sans-serif;
    padding: 4px 10px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--blue-dark);
    box-shadow: 0 0 0 3px rgba(213, 225, 236, 0.25);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--navy);
}

.select2-dropdown {
    border: 1.5px solid var(--gray-light);
    border-radius: 12px;
    z-index: 10000;
}

.select2-results__option {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .ce-intake-form-wrapper {
        margin: 20px;
    }
    
    .ce-form-card {
        padding: 40px;
    }
}

@media (max-width: 768px) {
    .ce-form-row {
        grid-template-columns: 1fr;
    }

    .ce-progress-steps {
        padding: 0 10px;
    }

    .ce-progress-line {
        left: 30px;
        right: 30px;
    }

    .ce-progress-number {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .ce-progress-label {
        font-size: 10px;
        letter-spacing: 0.3px;
        max-width: 80px;
    }

    .ce-form-card {
        padding: 30px 24px;
    }

    .ce-form-step h2 {
        font-size: 28px;
    }

    .ce-form-step h3 {
        font-size: 22px;
    }

    .ce-form-navigation {
        flex-direction: column;
        gap: 12px;
    }

    .ce-form-navigation .ce-btn-next,
    .ce-form-navigation .ce-submit-btn {
        margin-left: 0;
        width: 100%;
    }

    .ce-form-navigation .ce-btn-back {
        width: 100%;
    }

    .ce-student-block,
    .ce-parent-block {
        padding: 24px;
    }

    .ce-circle-selection-group {
        grid-template-columns: repeat(2, 1fr);
    }

    .ce-referral-selection-grid {
        grid-template-columns: 1fr;
    }
    
    .ce-social-platform-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .ce-progress-steps {
        padding: 0 5px;
    }

    .ce-progress-line {
        left: 23px;
        right: 23px;
    }

    .ce-progress-number {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .ce-progress-label {
        font-size: 9px;
        letter-spacing: 0.2px;
        max-width: 70px;
    }

    .ce-form-card {
        padding: 24px 20px;
    }

    .ce-form-step h2 {
        font-size: 26px;
    }

    .ce-btn {
        padding: 12px 24px;
        font-size: 14px;
        letter-spacing: 0.8px;
    }
}

/* ===== Accessibility ===== */
.ce-intake-form *:focus {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
}

.ce-intake-form button:focus,
.ce-intake-form input:focus,
.ce-intake-form select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 43, 74, 0.25);
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
