/* ============================================================================
   A11Y FORM VALIDATOR - COMPLETE CSS
   ============================================================================
   
   Single source of truth for all styling
   Clean, organized, and responsive
   ============================================================================ */

/* Global Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

    /* ============================================================================
   CSS VARIABLES & CUSTOM PROPERTIES
       ============================================================================ */

:root {
    /* Color Palette */
    --background1: #1E1E1E;
    --background2: #2E2E2E;
    --background3: #383838;
    --background4: #4A4A4A;
    
    /* Text Colors */
    --text1: #FFFFFF;
    --text2: #CCCCCC;
    --text3: #999999;
    --text4: #666666;
    
    /* Border Colors */
    --border1: rgba(255, 255, 255, 0.13);
    --border2: rgba(255, 255, 255, 0.08);
    --border3: rgba(255, 255, 255, 0.05);
    
    /* Action Colors - WCAG AA Compliant */
    --actionPrimaryBackground: #007AFF;  /* Brighter blue for better contrast against #1E1E1E */
    --actionPrimaryText: #FFFFFF;        /* White text - meets 4.5:1+ contrast with #007AFF */
    --actionPrimaryHover: #0056CC;       /* Darker blue for hover - maintains contrast */
    --actionSecondaryBackground: #383838;
    --actionSecondaryText: #E0E0E0;
    --actionSecondaryHover: #4A4A4A;
    
    /* Status Colors - WCAG 5:1+ contrast ratio */
    --greenBackground: #005A2B;             /* Darker green - meets 5:1+ with white text */
    --greenText: #FFFFFF;
    --greenBorder: #007A41;
    --redBackground: #B71C1C;               /* Darker red - meets 5:1+ with white text */
    --redText: #FFFFFF;
    --redBorder: #CF313B;
    /* Warning colors with WCAG 5:1+ contrast ratio */
    --yellowBackground: #6B4F0F;            /* Dark brown-yellow - meets 7:1 with white text */
    --yellowBackgroundAlt: #5A420D;         /* Darker brown-yellow - meets 8:1 with white text */
    --yellowText: #FFFFFF;                  /* White text for maximum contrast */
    --yellowBorder: #8B6914;
    
    /* Typography */
    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-h1: 20px;
    --font-size-h2: 17px;
    --font-size-h3: 14px;
    --font-size-h4: 13px;
    --font-size-p: 12px;
    --font-size-small: 11px;
    --font-size-tiny: 10px;
    
    /* Font Weights */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-xxl: 24px;
    --spacing-xxxl: 32px;
    
    /* Layout */
    --border-radius: 4px;
    --border-radius-lg: 8px;
    --border-radius-xl: 12px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ============================================================================
   BASE STYLES & RESET
   ============================================================================ */

/* Box Sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Reset Margins and Padding */
body,
h1, h2, h3, h4, h5, h6,
p, ul, ol, li,
figure, figcaption,
blockquote, dl, dd {
    margin: 0;
    padding: 0;
}

/* List Reset */
ul, ol {
    list-style: none;
}

/* Link Reset */
a {
    text-decoration: none;
    color: inherit;
}

/* Button Reset */
button {
    background: none;
    border: none;
    padding: 0;
    margin-top: 8px;
    font: inherit;
    cursor: pointer;
    outline: none;
}

/* Input Reset */
input, textarea, select {
    font: inherit;
    border: none;
    outline: none;
    background: none;
}

/* Focus Styles */
*:focus {
    outline: 2px solid var(--actionPrimaryBackground);
    outline-offset: 2px;
}

/* Remove Validation Button - WCAG 2.2 AA Compliant */
#remove-all-validations.btn.btn-danger.btn-secondary-action {
    margin-bottom: var(--spacing-md);
    color: #FFFFFF !important; /* True white for maximum contrast */
    background: var(--redBackground);
    border-color: var(--redBackground);
    font-weight: var(--font-weight-medium);
}

/* ===================== Upgrade Modal (vanilla) ===================== */
.a11y-upgrade-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}
.a11y-upgrade-modal {
    background: var(--background1);
    color: var(--text1);
    border: 1px solid var(--border1);
    border-radius: var(--border-radius);
    width: 420px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
}
.aum-header { display:flex; align-items:center; justify-content: space-between; padding: var(--spacing-md) var(--spacing-lg); border-bottom: 1px solid var(--border1); }
.aum-header h2 { margin:0; font-size: var(--font-size-h3); }
.aum-close { background:none; border:none; color: var(--text2); font-size: 18px; cursor:pointer; }
.aum-close:hover { color: var(--text1); }
.aum-body { padding: var(--spacing-md) var(--spacing-lg); color: var(--text2); }
.aum-recommend { padding: 0 var(--spacing-lg) var(--spacing-md); }
.aum-recommend h3 { font-size: var(--font-size-h3); margin: 0 0 var(--spacing-sm) 0; color: var(--text1); }
.aum-benefits { margin:0; padding-left: 18px; }
.aum-benefits li { margin: 4px 0; }
.aum-actions { padding: var(--spacing-md) var(--spacing-lg) var(--spacing-lg); display:flex; gap: var(--spacing-sm); }
.aum-upgrade { flex:1; text-align:center; background: var(--actionPrimaryBackground); color: var(--actionPrimaryText); padding: var(--spacing-sm) var(--spacing-md); border-radius: var(--border-radius); }
.aum-upgrade:hover { background: var(--actionPrimaryHover); }
.aum-compare { flex:1; text-align:center; background: var(--actionSecondaryBackground); color: var(--actionSecondaryText); padding: var(--spacing-sm) var(--spacing-md); border-radius: var(--border-radius); border: 1px solid var(--border1); }

#remove-all-validations.btn.btn-danger.btn-secondary-action:hover:not(:disabled) {
    background: var(--redBorder);
    border-color: var(--redBorder);
    color: #FFFFFF !important; /* Maintain white text on hover */
}


/* ============================================================================
   MAIN CONTAINER & PANEL STYLES
   ============================================================================ */

/* Main Container */
.form-validator-container {
    width: 100%;
    height: 100vh;
    background: var(--background1);
    color: var(--text1);
    font-family: var(--font-stack);
    overflow-y: auto;
    overflow-x: hidden;
    font-size: var(--font-size-p);
    line-height: 1.4;
    scroll-behavior: smooth;
}

/* Panel Header */
.panel-header {
    background: var(--background2);
    border-bottom: 2px solid var(--border1);
    padding: var(--spacing-lg);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.panel-header.expanded-view {
    padding: var(--spacing-lg) var(--spacing-md);
}

/* Header Controls Layout */
.header-controls-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
}

/* Header controls layout - always expanded */
.header-controls-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

/* Site Page Info Layout - block layout with right border */
.site-page-info-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Site Page Info Content - block layout */
.site-page-info-content {
    display: block;
}

/* Remove bottom margin from site-name and page-name elements */
#site-name,
#page-name {
    margin-bottom: 0 !important;
}

/* Validation Info Header - block layout, no borders */
.validation-info-header {
    display: block;
}



/* Page Info Layout */
.page-info-layout {
    display: block;
}

/* Expanded view - horizontal flex layout for page-name and page-slug */
.panel-header.expanded-view .page-info-layout {
    display: block;
    gap: var(--spacing-md);
}

/* Minimal view - block layout for page-name and page-slug */
.panel-header:not(.expanded-view) .page-info-layout {
    display: block;
}

.panel-header h2 {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: var(--font-size-h2);
    font-weight: var(--font-weight-semibold);
    color: var(--text1);
}

.panel-header p {
    margin: 0;
    color: var(--text2);
    font-size: var(--font-size-p);
    line-height: 1.4;
}

.panel-header .instructions-link {
    color: var(--text2);
    text-decoration: underline;
    font-weight: var(--font-weight-semibold);
}

.panel-header .instructions-link:hover {
    color: #FFFFFF;
    text-decoration: underline;
}

.panel-header .instructions-link:focus {
    outline: 2px solid var(--actionPrimaryBackground);
    outline-offset: 2px;
    border-radius: var(--border-radius);
}

/* Close Button */
.close-button {
    position: absolute;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    background: none;
    border: none;
    color: var(--text2);
    font-size: 14px;
    cursor: pointer;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    transition: all var(--transition-normal);
}

.close-button:hover {
    background: var(--background3);
    color: var(--text1);
}

/* Panel Content */
.panel-content {
    padding: var(--spacing-xs);
    background: var(--background1);
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

/* Status Message */
.status-message {      
    background: var(--background2);
    border: 1px solid var(--border1);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-p);
    line-height: 1.4;
    text-align: left;
    display: flex;
    align-items: center;
}

/* Normalize default button top margin for root button elements */
button {
    margin-top: 0;
}

/* Status row with Upgrade button on the right */
.status-upgrade-row {
    display: flex;
    align-items: stretch;
    gap: 0;
}
.status-upgrade-row .status-message {
    flex: 1 1 auto;
}
.btn-upgrade-status {
    margin-left: var(--spacing-lg);
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
}

.status-message.success {
    background: var(--greenBackground);
    color: #FFFFFF; /* White text for better contrast */
    border-color: var(--greenBorder);
}

.status-message.error {
    background: var(--redBackground);
    color: #FFFFFF; /* White text for better contrast */
    border-color: var(--redBorder);
}

.status-message.warning {
    background: var(--yellowBackground);
    color: #000000;
    border-color: var(--yellowBorder);
    font-weight: var(--font-weight-medium);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    /* WCAG contrast ratio: Dark brown-yellow (#6B4F0F) with black text (#000000) */
}

/* No forms found message styling */
.no-forms-message {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-secondary);
}

/* Add top margin when warning status message is active */
.status-message.warning + .no-forms-message {
    margin-top: 12px;
}

/* Remove bottom margin from site & page info section */
#site-page-info .section-content-layout {
    margin-bottom: 0;
}

/* Override section-subsection styles for site-page-info-content */
.site-page-info-content.section-subsection {
    padding: 0;
    margin-bottom: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

/* Expanded view - Add right border to site-page-info-content */
.panel-header.expanded-view .site-page-info-content.section-subsection {
    border-right: 1px solid var(--border1);
    padding-right: var(--spacing-md);
    margin-right: var(--spacing-md);
}

/* Plan Enforcement Styles */
.upgrade-prompt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: var(--border-radius);
}

.upgrade-prompt {
    background: var(--background1);
    border: 1px solid var(--border1);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    text-align: center;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.upgrade-prompt h4 {
    margin: 0 0 var(--spacing-sm) 0;
    color: var(--text1);
    font-size: var(--font-size-h3);
}

.upgrade-prompt p {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--text2);
    font-size: var(--font-size-p);
    line-height: 1.4;
}

.upgrade-prompt .upgrade-btn {
    background: var(--actionPrimaryBackground);
    color: var(--actionPrimaryText);
    border: none;
    border-radius: var(--border-radius);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-p);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.upgrade-prompt .upgrade-btn:hover {
    background: var(--actionPrimaryHover);
}

/* Disabled feature styling */
.disabled {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}

/* Hidden upgrade elements for legacy MVP components (plan enforcement handles visibility) */
.upgrade-btn,
.premium-feature,
.pro-feature,
.agency-feature {
    display: none !important;
}

/* Upgrade link styling - moved to STARTER PLAN LIMIT STYLING section */

/* ============================================================================
   BASE LAYOUT (Mobile/Comfortable View)
   ============================================================================ */

/* Layout Classes */
/* Stacked Layout - vertical stacking with no gap between sections */
.layout-stacked .section-content-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Section Headers */
.section-subsection h3 {
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-semibold);
    color: var(--text1);
}

/* Section Descriptions */
.section-subsection p,
.section-subsection .description {
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-p);
    line-height: 1.4;
    color: var(--text2);
}



/* ============================================================================
   VALIDATION INTERFACE SPECIFIC STYLES
   ============================================================================ */

/* Validation Interface Container */
.validation-interface {
    margin-bottom: var(--spacing-xl);
}

/* Forms Validation - Inherits from base responsive system above */

/* ============================================================================
   FORMS LIST STYLING
   ============================================================================ */

/* Forms List Container */
.forms-list {
    padding: var(--spacing-md);
    scroll-behavior: smooth;
}



/* Forms List Header */
.forms-list-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    background: var(--background2);
    margin-bottom: var(--spacing-sm);
}

.forms-list-header h3 {
    margin-bottom: 0;
}

.forms-header h3 {
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-semibold);
    color: var(--text1);
}

/* General Close Button */
.close-btn {
    color: white;
    text-transform: uppercase;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-h3);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    transition: all var(--transition-normal);
}

.close-btn.close-forms-list:hover {
    background: var(--background1);
    opacity: 0.8;
}

button.close-btn.close-forms-list {
    margin-top: 0;
}

/* Forms Count */
.forms-count {
    font-size: var(--font-size-p);
    color: var(--text2);
    margin-bottom: 8px;
}

.forms-count-badge {
    display: inline-block;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.5;
    max-width: 100%;
}

/* Forms List Wrapper */
.forms-list-wrapper {
    max-height: 250px;
    overflow: hidden;
    overflow-y: auto;
    border: 1px solid var(--border1);
    border-radius: var(--border-radius);
    background: var(--background1);
}

/* Forms Actions - Step 1 Select/Deselect Buttons */
/* Base Layout - Stacked Vertically (Minimal View) */
.forms-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    width: 100%;
}

/* Expanded View - Horizontal Layout (Side-by-Side) */
.panel-header.expanded-view ~ .panel-content .forms-actions {
    flex-direction: row;
    gap: var(--spacing-lg);
}

.forms-actions .btn {
    flex: 1;
    min-width: 0;
}

/* ============================================================================
   SCRIPT INSTRUCTIONS STYLING
   ============================================================================ */

/* Script Instructions Container */
.script-instructions {
    background: var(--background2);
    border: 1px solid var(--border1);
    border-radius: var(--border-radius);
    margin-top: var(--spacing-md);
    overflow: hidden;
}

/* Instructions Header */
.instructions-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    background: var(--background3);
    border-bottom: 1px solid var(--border1);
    padding: var(--spacing-md) var(--spacing-lg);
}

.instructions-header h4 {
    margin: 0;
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-semibold);
    color: var(--text1);
}

/* Instructions Ordered List */
.script-instructions ol {
    margin: 0;
    padding: var(--spacing-lg);
    list-style: none;
    counter-reset: instruction-counter;
}

.script-instructions li {
    counter-increment: instruction-counter;
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-xxl);
    position: relative;
    font-size: var(--font-size-p);
    line-height: 1.5;
    color: var(--text1);
}

.script-instructions li:last-child {
    margin-bottom: 0;
}

.script-instructions li::before {
    content: counter(instruction-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: var(--actionPrimaryBackground);
    color: var(--actionPrimaryText);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-semibold);
}

/* Setup Note */
.setup-note {
    background: var(--background1);
    border-top: 1px solid var(--border1);
    padding: var(--spacing-md) var(--spacing-lg);
}

.setup-note p {
    margin: 0;
    font-size: var(--font-size-p);
    line-height: 1.5;
    color: var(--text2);
}

.setup-note strong {
    color: var(--text1);
    font-weight: var(--font-weight-semibold);
}

/* Form Item Container */
.form-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border: 1px solid var(--border1);
    border-radius: var(--border-radius);
    background: var(--background1);
    margin-bottom: var(--spacing-sm);
    transition: all var(--transition-normal);
}

/* Form Header - Consolidated */
.form-header {
    border-bottom: 0px solid var(--border1);
    margin-bottom: 4px;
}

.form-header h4 {
    font-size: var(--font-size-h4);
    font-weight: var(--font-weight-semibold);
    color: var(--text1);
}



.form-item:last-child {
    margin-bottom: 0;
}

/* Form Info Section */
.form-info-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

/* Form Action Buttons - Consolidated */
.form-actions {
    display: flex;
    flex-direction: row;
    gap: var(--spacing-sm);
    align-items: center;
    justify-content: flex-start;
    padding: var(--spacing-md) var(--spacing-sm);
    transition: background-color var(--transition-normal);
    background: var(--background3);
}

.form-actions:hover {
    background: var(--background2);
}



/* Form Checkbox in Actions */
.form-actions .form-checkbox {
    margin-right: auto;
}

/* Field Information Classes */
.field-count,
.field-types,
.field-labels,
.validation-status {
    margin-bottom: 4px;
    font-size: var(--font-size-p);
    color: var(--text1);
}

/* ============================================================================
   SECTION STYLES
   ============================================================================ */

/* Section Container */
.section {
    background: var(--background2);
    border: 1px solid var(--border1);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin: 20px 0 20px 0
}

/* Section Header */
.section-header {
    background: transparent;
    border-bottom: 1px solid var(--border1);
    cursor: pointer;
    transition: background-color var(--transition-normal);
    padding: var(--spacing-sm) var(--spacing-md); /* Merged from small screen */
    display: flex;
    flex-direction: column;
}

.section-header:hover {
    background: var(--background2);
}

.header-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.header-content h2 {
    margin: 0 0 10px 0;
    font-size: var(--font-size-h2);
    font-weight: var(--font-weight-semibold);
    color: var(--text1);
}

.section-toggle {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: var(--border-radius);
    transition: all var(--transition-normal);
    align-self: flex-start;  /* Merged from small screen */
    margin-top: 0;           /* Merged from small screen */
}

.section-toggle:hover {
    background: var(--background1);
    color: var(--text1);
}

.toggle-icon {
    font-size: var(--font-size-small);
    transition: transform var(--transition-normal);
}

/* Section Content */
.section-content {
    padding: var(--spacing-md);
    background: var(--background1);
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Smooth scrolling for section content */
.section-content {
    scroll-behavior: smooth;
}

/* Custom scrollbar styling for section content */
.section-content::-webkit-scrollbar {
    width: 8px;
}

.section-content::-webkit-scrollbar-track {
    background: var(--background2);
    border-radius: var(--border-radius);
}

.section-content::-webkit-scrollbar-thumb {
    background: var(--border1);
    border-radius: var(--border-radius);
}

.section-content::-webkit-scrollbar-thumb:hover {
    background: var(--text2);
}

/* Layout for section content - Default: Stacked/Column */
.section-content-layout {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* Step Row Container - Self-contained with proper borders */
.step-row-container {
    display: flex;
    flex-direction: row;
    gap: 0;
    border: 1px solid var(--border1);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    background: var(--background2);
}

/* Always use expanded view - Side-by-side layout */
.panel-content .section-content-layout {
    display: flex;
    flex-direction: row;
    gap: 0;
}

/* Step content - equal width in side-by-side layout */
.step-row-container > .step-content {
    flex: 1;
    min-width: 0; /* Allows flex items to shrink below content size */
}

/* Step content styling */
.step-content {
    margin-bottom: 0;
}

.step-content h3 {
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-semibold);
    color: var(--text1);
}

.step-content p,
.step-content .section-description {
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-p);
    line-height: 1.4;
    color: var(--text2);
}

/* Forms Validation Section - Remove outer scrollbar */
#forms-page-info {
    max-height: none;
    overflow-y: visible;
}

/* Forms Validation Section - H2 spacing */
#forms-page-info > h2 {
    margin-bottom: var(--spacing-md);
}

/* Section subsections - Add background and padding for visual definition */
.section-subsection {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--background2);
    border-radius: var(--border-radius);
    border: 1px solid var(--border1);
}

.section-subsection:last-child {
    margin-bottom: 0;
}

/* Minimal/Stacked view - Add bottom borders for Step 1 & 2 */
#scan-forms {
    border-bottom: 1px solid var(--border1);
    padding-bottom: var(--spacing-md);
}

#apply-validation-section {
    border-bottom: 1px solid var(--border1);
    padding-bottom: var(--spacing-md);
}

/* Remove bottom border in expanded view since we have vertical separator */
.panel-header.expanded-view ~ .panel-content #scan-forms,
.panel-header.expanded-view ~ .panel-content #apply-validation-section {
    border-bottom: none;
    padding-bottom: var(--spacing-md);
}

/* ============================================================================
   FORMS & VALIDATION INTERFACE
   ============================================================================ */

/* Remove Process Message */
.remove-process-message {
    display: none; /* Hidden by default */
    margin-top: 8px;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--background1); /* Dark background for WCAG 5:1 contrast */
    color: var(--text1); /* White text for WCAG 5:1 contrast */
    border-radius: var(--border-radius);
    border: 1px solid var(--border1);
    font-size: var(--font-size-p);
    line-height: 1.4;
}

/* Hide remove validation container by default - only show after page scan */
.remove-validation-container {
    display: none;
}

/* Show message when processing class is active */
.remove-validation-container.processing .remove-process-message {
    display: block;
}

.remove-process-message p {
    margin: 0; /* Remove default paragraph margin */
}

/* Form Container */
.form-container {
    background: var(--background2);
    border: 1px solid var(--border1);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-lg);
    overflow: hidden;
}



/* Form Content */
.form-content {
    padding: var(--spacing-lg);
}

/* Form Fields */
.form-field {
    margin-bottom: var(--spacing-lg);
}

.form-field:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-p);
    font-weight: var(--font-weight-medium);
    color: var(--text1);
}

.form-input {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--background1);
    border: 1px solid var(--border1);
    border-radius: var(--border-radius);
    color: var(--text1);
    font-size: var(--font-size-p);
    transition: border-color var(--transition-normal);
}

.form-input:focus {
    border-color: var(--actionPrimaryBackground);
}

.form-input::placeholder {
    color: var(--text3);
}

/* ============================================================================
   VALIDATION SETTINGS STYLING
   ============================================================================ */

/* Validation Settings Group */
.validation-settings-group {
    margin-bottom: var(--spacing-lg);
}

.validation-settings-group:last-child {
    margin-bottom: 0;
}

/* Validation Subsection Heading (h3-like) */
.validation-subsection-heading {
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-semibold);
    color: var(--text1);
    margin-bottom: var(--spacing-md);
    margin-top: 0;
}

/* Length Settings Row */
.length-settings-row {
    display: flex;
    flex-direction: row;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.length-settings-row:last-child {
    margin-bottom: 0;
}

/* Length Setting Item */
.length-setting-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.length-setting-item label {
    font-size: var(--font-size-p);
    font-weight: var(--font-weight-medium);
    color: var(--text1);
    margin-bottom: var(--spacing-xs);
}

/* Length Input - Text input styling */
.length-input {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--background1);
    border: 1px solid var(--border1);
    border-radius: var(--border-radius);
    color: var(--text1);
    font-size: var(--font-size-p);
    font-family: var(--font-stack);
    transition: border-color var(--transition-normal);
}

.length-input:focus {
    outline: none;
    border-color: var(--actionPrimaryBackground);
}

.length-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.length-input::placeholder {
    color: var(--text3);
}

/* Setting Hint */
.setting-hint {
    font-size: var(--font-size-small);
    color: var(--text3);
    font-style: italic;
    margin-top: var(--spacing-xs);
}



/* ============================================================================
   FORMS ACTIONS LAYOUT
   ============================================================================ */

/* Base Layout - Always Stacked Vertically */
.forms-actions-layout {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.primary-action-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.secondary-action-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* ============================================================================
   SIZE CONTROL BUTTONS - REMOVED
   ============================================================================ */
/* Size controls removed - always use expanded view */

/* ============================================================================
   BUTTONS & INTERACTIVE ELEMENTS
   ============================================================================ */

/* Button Base */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-size: var(--font-size-p);
    font-weight: var(--font-weight-medium);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    min-height: 36px;
    width: 100%;
    flex-shrink: 0;
}

/* Panel header buttons should not be full-width */
.panel-header .btn {
    width: auto;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Button Variants */
.btn-primary {
    background: var(--actionPrimaryBackground);
    color: var(--actionPrimaryText);
    border-color: var(--actionPrimaryBackground);
}

.btn-primary:hover:not(:disabled) {
    background: var(--actionPrimaryHover);
    border-color: var(--actionPrimaryHover);
}

.btn-secondary {
    background: var(--actionSecondaryBackground);
    color: var(--actionSecondaryText);
    border-color: var(--border1);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--actionSecondaryHover);
    border-color: var(--border2);
}

.btn-danger {
    background: var(--redBackground);
    color: #FFFFFF !important; /* True white for maximum WCAG contrast */
    border-color: var(--redBackground);
    font-weight: var(--font-weight-medium);
}

.btn-danger:hover:not(:disabled) {
    background: var(--redBorder);
    border-color: var(--redBorder);
    color: #FFFFFF !important; /* Maintain white text on hover */
}

/* Button Sizes */
.btn-sm {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-small);
    min-height: 28px;
}

.btn-lg {
    padding: var(--spacing-lg) var(--spacing-xl);
    font-size: var(--font-size-h4);
    min-height: 44px;
}

/* Button Groups */
.btn-group {
    display: flex;
    gap: var(--spacing-sm);
}

.btn-group .btn {
    flex: 1;
}



/* ============================================================================
   ACCESSIBILITY & FOCUS MANAGEMENT
   ============================================================================ */

/* 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: 0;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border1: rgba(255, 255, 255, 0.3);
        --border2: rgba(255, 255, 255, 0.2);
        --border3: rgba(255, 255, 255, 0.15);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* ============================================================================
   STARTER PLAN LIMIT STYLING
   ============================================================================ */

.upgrade-link {
    color: white;
    text-decoration: underline;
    font-weight: normal;
    transition: font-weight 0.2s ease;
}

.upgrade-link:hover {
    font-weight: 600;
    text-decoration: underline;
}

.upgrade-link:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Error message styling for limit violations */
.status-message.error {
    color: white;
}

.status-message.error .upgrade-link {
    color: white;
    font-weight: normal;
    text-decoration: underline;
}

.status-message.error .upgrade-link:hover {
    font-weight: 600;
    text-decoration: underline;
}

/* Success message styling */
.status-message.success {
    color: white;
}

/* Warning message styling */
.status-message.warning {
    color: black;
}

/* Limit status indicators in forms list */
.limit-status {
    margin-top: 8px;
}

.limit-indicator {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.limit-indicator.limit-exceeded {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Component Depth Warning Styles */
.depth-warning-container {
    margin-top: 8px;
}

.depth-warning {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
}

.depth-warning-text {
    color: #856404;
    font-weight: 500;
    display: block;
    line-height: 1.4;
}

.limit-indicator.limit-ok {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.limit-text {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Disabled form selection styling */
.form-checkbox input[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-checkbox .disabled-label {
    opacity: 0.5;
    cursor: not-allowed;
    color: #6c757d;
}

.form-checkbox input[disabled] + .disabled-label {
    opacity: 0.5;
    cursor: not-allowed;
    color: #6c757d;
}


/* ============================================================================
   PLAN DISPLAY (Phase 1M)
   ============================================================================ */

.plan-display {
    margin: 0;
    padding: 0;
}

/* Upgrade button next to plan badge */
.btn-upgrade {
    margin-left: var(--spacing-sm);
    padding: 4px 10px;
}

.plan-badge {
    font-size: var(--font-size-p);
    color: var(--text2);
    margin: 0;
    line-height: 1.4;
}

.plan-name {
    font-weight: var(--font-weight-semibold);
    color: var(--text1);
}

.plan-limit {
    color: var(--text3);
    font-size: var(--font-size-small);
}

/* ===================== Upgrade View Styles ===================== */



/* Upgrade Header - Title/Description on left, Toggle on right */
.upgrade-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.upgrade-title-description {
    flex: 1;
}

@media (max-width: 600px) {
    .upgrade-header {
        flex-direction: column;
        gap: var(--spacing-md);
    }
}

#upgrade-page-info .section-content-layout {
    display: block !important;
    flex-direction: unset !important;
}

#upgrade-page-info .section-subsection {
    width: 100%;
    max-width: 100%;
}

.upgrade-plan-cards {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: var(--spacing-lg);
    width: 100%;
}

@media (max-width: 900px) {
    .upgrade-plan-cards {
        grid-template-columns: 1fr;
    }
}

.upgrade-plan-card {
    background: var(--background2);
    border: 1px solid var(--border1);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    position: relative;
}

.upgrade-plan-card.featured {
    border: 2px solid var(--actionPrimaryBackground);
}

.upgrade-plan-card h3 {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: var(--font-size-h3);
    color: var(--text1);
}

.upgrade-plan-card .price {
    font-size: var(--font-size-h2);
    font-weight: var(--font-weight-bold);
    color: var(--text1);
    margin: var(--spacing-sm) 0;
    line-height: 1.2;
}

.upgrade-plan-card .price-period {
    font-size: 0.6em;
    vertical-align: super;
    color: var(--text3);
    font-weight: var(--font-weight-normal);
}

.upgrade-plan-card .price-billing-note {
    font-size: var(--font-size-small);
    color: var(--text3);
    margin-top: var(--spacing-xs);
    font-weight: var(--font-weight-normal);
}

.upgrade-plan-card .cta-btn {
    width: 100%;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.upgrade-plan-card .features {
    list-style: none;
    padding: 0;
    margin: var(--spacing-sm) 0;
}

.upgrade-plan-card .features li {
    padding: var(--spacing-xs) 0;
    color: var(--text2);
}

.upgrade-plan-card .features li:before {
    content: '✓ ';
    color: var(--greenBorder);
    font-weight: bold;
}

.upgrade-plan-card .features li.coming-soon {
    opacity: 0.7;
}

.upgrade-plan-card .features li.coming-soon::before {
    content: '⏳ ';
    color: var(--text3);
    font-weight: bold;
}

/* Billing Toggle Styles */
.billing-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-md);
}

.billing-toggle-label {
    font-size: var(--font-size-base);
    color: var(--text1);
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border1);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--actionPrimaryBackground);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.upgrade-plan-card .price-billing-note {
    font-size: 11px;
    color: var(--text3);
    font-weight: normal;
    margin-top: 2px;
}
