/* ========================================
   AA Forms Frontend Styles
   Complete stylesheet for all form pages
   ======================================== */

/* ========================================
   HTML CONTENT BLOCKS IN FORMS
   ======================================== */

.aa-form-html-content {
    padding-bottom: 20px;
    margin: 0;
    border-radius: 4px;
    line-height: 1.6;
}

.aa-form-html-content h1,
.aa-form-html-content h2,
.aa-form-html-content h3,
.aa-form-html-content h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
}

.aa-form-html-content p,
.aa-form-html-content ul li,
.aa-form-html-content ol li {
    margin-bottom: 15px;
    padding-bottom: 0;
}

.aa-form-html-content ul,
.aa-form-html-content ol {
    margin-left: 20px;
    margin-top: 10px;
    margin-bottom: 15px;
}

.aa-form-html-content a {
    color: #007bff;
    text-decoration: underline;
}

.aa-form-html-content a:hover {
    color: #0056b3;
}

/* ========================================
   INTAKE SECTIONS AND FORM FIELDS
   ======================================== */

.aa-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #2c3e50;
    background: none !important;
}

.aa-form-field > label {
    color: #000 !important;
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 8px;
    display: block;
}

.aa-form-field > label .required {
    color: #d63638 !important;
    font-size: 18px;
}

.aa-form-field > label span {
    color: #000 !important;
}

/* Custom Checkbox Styles */
.aa-form-field input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border: 3px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    background: white;
    margin-right: 10px;
    vertical-align: middle;
    flex-shrink: 0;
}

.aa-form-field input[type="checkbox"]:hover {
    transform: scale(1.1);
    border-color: #999;
}

.aa-form-field input[type="checkbox"]:checked {
    background: #003C52;
    border-color: #003C52;
}

.aa-form-field input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

/* Custom Radio Button Styles - matching checkboxes */
.aa-form-field input[type="radio"],
.aa-form-radio-option input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border: 3px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    background: white;
    margin-right: 10px;
    vertical-align: middle;
    flex-shrink: 0;
}

.aa-form-field input[type="radio"]:hover,
.aa-form-radio-option input[type="radio"]:hover {
    transform: scale(1.1);
    border-color: #999;
}

.aa-form-field input[type="radio"]:checked,
.aa-form-radio-option input[type="radio"]:checked {
    background: #003C52;
    border-color: #003C52;
}

.aa-form-field input[type="radio"]:checked::after,
.aa-form-radio-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: white;
}

/* Single checkbox layout */
.aa-form-checkbox-single {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0 !important;
}

.aa-form-checkbox-single input[type="checkbox"] {
    margin-right: 10px;
}

.aa-form-checkbox-single span {
    font-size: 14px;
    color: #000;
    line-height: 1.5;
}

/* Checkbox group layout */
.aa-form-field .aa-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aa-form-checkbox-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
}

.aa-form-checkbox-option input[type="checkbox"] {
    margin-right: 10px;
}

.aa-form-checkbox-option span {
    font-size: 16px;
    color: #000;
    line-height: 1.5;
}

/* Radio group layout */
.aa-form-field .aa-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aa-form-radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
}

.aa-form-radio-option input[type="radio"] {
    margin-right: 10px;
}

.aa-form-radio-option span {
    font-size: 16px;
    color: #000;
    line-height: 1.5;
}

/* ========================================
   FORM STEPS PAGE - Main form with background
   ======================================== */

/* Form Steps Page with Background Image */
.aa-form-steps-page {
    min-height: 100vh;
    padding: 20px 20px 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: relative;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dark overlay for background image */
.aa-steps-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 0;
}

.aa-steps-container {
    position: relative;
    z-index: 1;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.aa-steps-header {
    text-align: center;
    color: white;
    margin-bottom: 15px;
}

.aa-steps-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.aa-steps-instructions {
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 auto;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Hide instructions for intake forms only */
body.aa-form-type-intakes .aa-steps-instructions {
    display: none;
}

/* Progress indicator */
.aa-form-progress-wrapper {
    text-align: center;
    margin-bottom: 15px;
}

.aa-progress-text {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 8px 20px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Progress Bar with Dots */
.aa-progress-bar-container {
    margin-bottom: 30px;
}

.aa-progress-bar {
    background: rgba(255, 255, 255, 0.2);
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 20px;
    display: none; /* Hidden - progress dots show progress instead */
}

.aa-progress-bar-fill {
    background: white;
    height: 100%;
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 2px;
}

.aa-progress-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 100%;
    overflow: visible;
    padding: 10px 0;
}

.aa-step-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    flex-shrink: 0;
}

.aa-step-dot:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.aa-step-dot.active {
    background: white;
    border-color: white;
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.aa-step-dot.completed {
    color: white;
}

.aa-dot-number {
    display: inline-block;
}

.aa-step-dot.completed .aa-dot-number {
    display: none;
}

.aa-dot-check {
    display: none;
}

.aa-step-dot.completed .aa-dot-check {
    display: inline-block;
    font-size: 0.7rem;
}

/* Form container */
.aa-form-container {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}


.aa-form-step {
    display: none;
    animation: fadeIn 0.4s ease;
}

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

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

/* Question Styles */
.aa-question-header {
    margin-bottom: 25px;
}

.aa-question-title {
    font-size: 1.3rem;
    margin-bottom: 10px;
    font-weight: 600;
    line-height: 1.4;
    width: 100%;
    text-align: center;
}

.aa-field-prompt {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Psychometric Scale Styles */
.aa-form-scale {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 15px;
    margin: 30px 0;
    align-items: flex-start;
}

.aa-form-scale-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    text-align: center;
    position: relative;
}

.aa-form-scale-option input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 35px;
    height: 35px;
    border: 3px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    margin: 0 0 10px 0;
    background: white;
}

.aa-form-scale-option input[type="radio"]:hover {
    transform: scale(1.1);
}

.aa-form-scale-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: white;
}

.aa-form-scale-label {
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.3;
    color: #000 !important;
    word-wrap: break-word;
    hyphens: auto;
    transition: all 0.3s ease;
}

/* Assessment Textarea */
.aa-assessment-step textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    min-height: 150px;
    transition: all 0.3s ease;
}

.aa-assessment-step textarea:focus {
    border-color: #003C52;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 60, 82, 0.1);
}

.aa-field-error {
    color: #d63638;
    font-size: 0.9rem;
    margin-top: 10px;
    display: block;
}

/* Intake form validation errors */
.aa-field-error-msg {
    color: #d63638;
    font-size: 0.9rem;
    margin-top: 8px;
    display: block;
    font-weight: 500;
}

.aa-field-invalid {
    border-color: #d63638 !important;
    box-shadow: 0 0 0 1px #d63638 !important;
}

.aa-form-field input[type="checkbox"].aa-field-invalid,
.aa-form-field input[type="radio"].aa-field-invalid {
    border-color: #d63638 !important;
    border-width: 3px;
}

/* Form Navigation */
.aa-form-navigation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-top: 30px;
}

/* Shortcode forms: align button to the left */
.aa-form-shortcode .aa-form-navigation {
    align-items: flex-start;
}

.aa-form-shortcode .aa-nav-buttons {
    justify-content: flex-start;
}

.aa-nav-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.aa-step-prev {
    background: transparent;
    color: #999;
    border: none;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    padding: 0;
    transition: color 0.3s ease;
}

.aa-step-prev:hover {
    color: #666;
    text-decoration: underline;
}

.aa-step-next,
.aa-form-submit {
    padding: 14px 48px !important;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #003C52;
    color: white;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.aa-step-next:hover,
.aa-form-submit:hover {
    background: #502A65;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.aa-step-next:active,
.aa-form-submit:active {
    transform: translateY(0);
}

.aa-step-next:disabled,
.aa-form-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.aa-step-next:focus,
.aa-form-submit:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 60, 82, 0.2);
}

.aa-nav-divider {
    width: 60px;
    height: 1px;
    background: #e0e0e0;
    margin: 15px 0 10px 0;
}

.aa-nav-footer {
    text-align: center;
}

.aa-overview-link {
    color: #aaa;
    font-size: 12px;
    text-decoration: none;
    font-weight: 400;
    transition: color 0.3s ease;
}

.aa-overview-link:hover {
    color: #888;
    text-decoration: underline;
}

/* Form Messages */
.aa-form-messages {
    margin-top: 20px;
}

.aa-form-success {
    padding: 20px;
    text-align: center;
    color: #2c3e50;
}

.aa-form-success h2,
.aa-form-success h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.aa-form-success p {
    color: #666;
    line-height: 1.6;
}

.aa-form-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

/* ========================================
   FORM PREVIEW PAGE - Overview page
   ======================================== */

.aa-form-preview-page {
    min-height: 100vh;
    padding: 20px 20px 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.aa-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 60, 82, 0.85);
    z-index: 0;
}

.aa-preview-container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.aa-preview-header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.aa-preview-image {
    margin-bottom: 20px;
}

.aa-preview-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.aa-preview-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 15px;
}

.aa-preview-instructions {
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 auto;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
}

.aa-preview-meta {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.aa-preview-meta-item,
.aa-preview-type,
.aa-preview-time,
.aa-preview-questions {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.aa-meta-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.aa-meta-value {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.aa-preview-form {
    padding: 30px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

.aa-preview-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
    margin-bottom: 0;
    text-align: left;
}

.aa-preview-questions {
    padding: 0;
    margin: 0 0 30px 0;
    counter-reset: question-counter;
}

.aa-preview-question {
    position: relative;
    list-style: none;
    padding-left: 25px;
    margin-bottom: 12px;
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
    text-align: left;
}

.aa-preview-question::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #666;
    font-weight: bold;
    font-size: 1.2rem;
}

.aa-preview-empty {
    text-align: center;
    padding: 40px;
    color: #666;
    background: #f8f9fa;
    border-radius: 6px;
}

.aa-preview-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #e9ecef;
}

.aa-preview-actions .aa-btn-secondary {
    order: 1;
}

.aa-preview-actions .aa-btn-primary {
    order: 2;
}

/* Buttons */
.aa-btn {
    padding: 14px 48px !important;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    font-size: 16px;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.aa-btn-primary {
    background: white;
    color: #0073aa;
    border: 1px solid #0073aa;
}

.aa-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.aa-btn-primary:active {
    transform: translateY(0);
}

.aa-btn-secondary {
    background: transparent;
    color: #aaa;
    border: none;
    text-decoration: underline;
    padding: 10px 24px;
    font-size: 12px;
}

.aa-btn-secondary:hover {
    color: white;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    /* Form Steps Page */
    .aa-form-steps-page {
        padding: 20px 10px;
    }
    
    .aa-steps-title {
        font-size: 1.5rem;
    }
    
    .aa-form-container {
        padding: 30px 20px;
    }
    
    .aa-question-title {
        font-size: 1.1rem;
    }
    
    .aa-nav-buttons {
        flex-direction: column-reverse;
        gap: 12px;
        width: 100%;
    }
    
    .aa-step-next,
    .aa-form-submit {
        width: 100%;
        padding: 14px 32px !important;
    }
    
    .aa-step-prev {
        margin-top: 5px;
    }
    
    /* Psychometric scale on mobile */
    .aa-form-scale {
        flex-direction: column;
        gap: 15px;
    }
    
    .aa-form-scale-option {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
    }
    
    .aa-form-scale-option input[type="radio"] {
        margin-right: 15px;
        margin-bottom: 0;
    }
    
    .aa-form-scale-label {
        font-size: 1rem;
        text-align: left;
    }
    
    .aa-progress-dots {
        gap: 10px;
    }
    
    .aa-step-dot {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }
    
    .aa-step-dot.completed .aa-dot-check {
        font-size: 0.85rem;
    }
    
    /* Form Preview Page */
    .aa-preview-header {
        padding: 20px;
    }
    
    .aa-preview-title {
        font-size: 1.3rem;
    }
    
    .aa-preview-form {
        padding: 20px;
    }
    
    .aa-preview-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .aa-preview-actions .aa-btn {
        width: 100%;
    }
    
    .aa-preview-meta {
        gap: 15px;
    }
}
