/*
 * Frontend Styles Summary
 * - Form shell, layout, and typography controls for the public submission form
 * - Announcement system banner that appears above forms when configured
 * - Consent, notice, and helper components for guidance and validation
 * - Field groupings, tag selectors, slider questions, and list displays
 * - Story metadata and excerpt presentation for shortcode outputs
 */

/* =Form Layout & Typography =============================== */
.story-submission-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

.story-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.story-form .form-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.story-form .form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.story-form.is-age-locked .form-section,
.story-form.is-age-locked .form-field {
    opacity: 0.55;
}

.story-form.is-age-locked .age-confirm-callout {
    opacity: 1;
}

.privacy-notice {
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #6B7280;
    line-height: 1.4;
}

.privacy-notice a {
    color: inherit;
    text-decoration: underline !important;
    font-weight: 600;
}

.age-confirm-callout {
    margin-bottom: .5rem;
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid rgba(239, 68, 68, 0.65);
    background: rgba(239, 68, 68, 0.08);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.age-confirm-callout label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.age-confirm-callout input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
}

/* =Announcement System =================================== */
.announcement-box {
    padding: 12px 16px;
    margin: 0 0 20px 0;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.5;
}

.announcement-box .announcement-copy {
    margin: 0;
    font-family: inherit;
}

.announcement-none {
    background-color: #ffffff;
    border-left: 4px solid #d7d7d7;
    color: inherit;
}

.announcement-blue {
    background-color: #e3f2fd;
    border-left: 4px solid #1976d2;
    color: #0d47a1;
}

.announcement-orange {
    background-color: #fff3e0;
    border-left: 4px solid #f57c00;
    color: #e65100;
}

.announcement-yellow {
    background-color: #fffbe7;
    border-left: 4px solid #ffe082;
    color: #5d4037;
}

.announcement-red {
    background-color: #ffebee;
    border-left: 4px solid #c62828;
    color: #b71c1c;
}

.announcement-neutral {
    background-color: #f3e5f5;
    border-left: 4px solid #7b1fa2;
    color: #4a148c;
}

/* =Consent Fields ======================================== */
.privacy-consent-field {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 2px solid #240774;
    background: transparent;
}

.privacy-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-weight: 600;
    color: #240774;
}

.privacy-consent-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
    accent-color: #240774;
}

/* Restore attention animation placement after announcement styles */
.age-confirm-callout.is-attention {
    border-left-color: #b91c1c;
    background: rgba(239, 68, 68, 0.16);
    box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.15);
    animation: age-callout-shake 0.45s ease-in-out 0s 2;
}

.story-form .section-heading {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: inherit;
}

.story-form .section-subheading {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: inherit;
}

.form-section-intro {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.story-form label {
    display: block;
    margin-bottom: 0.125rem;
    font-weight: 600;
    color: inherit;
    font-size: 1rem;
}

.story-form input[type="text"],
.story-form input[type="email"],
.story-form textarea,
.story-form select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    border: 1px solid var(--story-form-border-color, var(--wp--preset--color--border, #d0d0d0));
    background-color: var(--story-form-field-bg, #fff);
    color: inherit;
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.story-form input[type="text"]:focus,
.story-form input[type="email"]:focus,
.story-form textarea:focus,
.story-form select:focus {
    outline: none;
    border-color: var(--story-form-focus-color, var(--wp--preset--color--primary, #2271b1));
    box-shadow: 0 0 0 1px var(--story-form-focus-color, var(--wp--preset--color--primary, #2271b1));
}

/* --- AI Model Picker Styles (FIXED) --- */

.ai-model-search-field {
    position: relative;
    width: 100%;
}

/* 1. Main Container: Forces single line layout */
.ai-model-search-wrap {
    display: flex;
    flex-wrap: nowrap;     /* Forces button to stay on same line */
    gap: 8px;              /* Tight gap */
    align-items: stretch;
    width: 100%;
}

/* 2. Input Field: Takes available space */
.ai-model-search-field {
    flex-grow: 1;
    width: auto;
    min-width: 0;
}

.ai-model-search-input {
    width: 100%;
    height: 42px;
    margin: 0;
}

/* 3. The Submit Button: Visible, Purple, Inline */
.story-submission-form .ai-model-search-wrap .ai-model-add-button {
    flex: 0 0 auto;        /* Stop squishing */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem !important;
    
    background-color: #240774 !important;
    color: #ffffff !important;
    border: 1px solid #240774;
    border-radius: 999px;
    
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    opacity: 1 !important;
    height: 42px; /* Match input height */
}

/* 4. Green Hover for Submit Button */
.story-submission-form .ai-model-search-wrap .ai-model-add-button:hover,
.story-submission-form .ai-model-search-wrap .ai-model-add-button:active {
    background-color: #0D5727 !important;
    border-color: #0D5727 !important;
    color: #ffffff !important;
}



/* 5. The Results Dropdown */
.ai-model-results {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    z-index: 30;
    list-style: none;        
    margin: 0;               
    padding: 0.35rem 0;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    max-height: 22rem;
    overflow-y: auto;
}

.ai-model-results[hidden] { display: none !important; }

.ai-model-result-item {
    display: flex;           
    align-items: center;  
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.ai-model-result-item:hover {
    background: rgba(34, 113, 177, 0.12);
    color: #2271b1;
}

/* 6. "No Models" Box: Transparent & Collapsed */
.ai-model-selected-region {
    margin-top: 5px;
    padding: 0;
    border: none;
    background: transparent !important; /* Fixes white box issue */
    min-height: 0; /* Collapses when empty */
}

.ai-model-selected-empty {
    margin: 0;
    font-size: 0.85rem;
    font-style: italic;
    color: #666; /* Subtle text */
    padding: 2px 0;
}

/* 7. Gap Adjustments */
.ai-model-search-wrap + .description {
    margin-top: 5px !important;
    margin-bottom: 0 !important;
}

.ai-model-section .section-subheading + p.description {
    margin-bottom: 8px !important;
}

/* 8. Selected Items List */
.ai-model-selected-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ai-model-selected-item {
    display: flex;
    align-items: center;
}

/* Selected AI Model Buttons (Removable) */
.ai-model-remove-button {
    display: inline-flex;
    align-items: center;
    background-color: #f0f6fc; 
    color: #2271b1; 
    border: 1px solid #2271b1; 
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 1 !important; 
    cursor: pointer;
}

.ai-model-remove-button:hover {
    background-color: #1a8f3d !important;
    border-color: #1a8f3d !important;
    color: #ffffff !important;
}

.ai-model-remove-button:focus-visible {
    outline: 2px solid var(--story-form-focus-color, var(--wp--preset--color--primary, #2271b1));
    outline-offset: 2px;
}

.ai-model-remove-button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =Standard Form Fields ================================== */

.story-form input.error-field,
.story-form textarea.error-border,
.story-form select.error-field {
    border-color: #dc3232 !important;
}

.story-form textarea.error-border {
    box-shadow: 0 0 4px rgba(220, 50, 50, 0.3) !important;
}

.story-form .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.story-form .checkbox-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.25rem 1rem;
    border-radius: 999px;
    border: 2px solid #240774;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    background: transparent;
}

.story-form .checkbox-label:hover {
    border-color: #0D5727;
}

.story-form .checkbox-label input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.story-form .checkbox-label-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #240774;
    width: 100%;
}

.story-form .checkbox-label input:focus-visible + .checkbox-label-text {
    outline: 2px solid var(--story-form-focus-color, var(--wp--preset--color--primary, #2271b1));
    outline-offset: 2px;
    border-radius: 999px;
}

.story-form .checkbox-label:has(input:checked) {
    background-color: #240774 !important;
    border-color: #1a0552;
}

.story-form .checkbox-label:has(input:checked) .checkbox-label-text {
    color: #ffffff !important;
}

.emotion-group,
.tag-group-field,
.content-warning-field {
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--story-form-border-color, var(--wp--preset--color--border, #d0d0d0));
}



/* =Story Shortcode Display =============================== */
.story-shortcode-entry {
    margin: 0 0 2.5rem 0;
    padding: 0 !important;
    border: none !important;
}

.story-shortcode-entry .story-content-warnings {
    margin: 0 0 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.story-shortcode-entry .story-warning-heading,
.story-shortcode-entry .story-warning-values {
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

.story-shortcode-entry .story-warning-values {
    font-weight: normal; 
}

.story-shortcode-entry .story-warning-heading.story-no-warnings {
    font-weight: 600;
}

/* =UNIFIED ACCORDION & TAG STYLES (Specificity Fix) = */

/* 1. Main Wrappers */
.story-form .tag-group-field,
.story-form .emotion-field {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
}

/* 2. Accordion Containers */
.story-form .tag-parent-block,
.story-form .emotion-group {
    background: var(--story-form-chip-bg, rgba(34, 113, 177, 0.06)); 
    border-radius: 6px;
    padding: 0.75rem;
    width: 100%;
    box-sizing: border-box;
    display: block;
}

.story-form .emotion-group {
    background: var(--story-form-chip-bg, rgba(0, 0, 0, 0.02));
}

/* 3. The Clickable Headers */
.story-form .tag-parent-toggle,
.story-form .emotion-group-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    
    background: #240774;
    color: #ffffff;
    border: none;
    
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: left;
}

/* Hover States */
.story-form .tag-parent-toggle:hover, 
.story-form .tag-parent-toggle:active, 
.story-form .tag-parent-toggle[aria-expanded="true"],
.story-form .emotion-group-toggle:hover, 
.story-form .emotion-group-toggle:active, 
.story-form .emotion-group-toggle[aria-expanded="true"] {
    background: #0D5727;
    color: #ffffff;
}

/* Arrow Icons */
.tag-parent-toggle::after,
.emotion-group-toggle::after {
    content: "\25BC";
    font-size: 0.85rem;
    color: #ffffff;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.tag-parent-toggle[aria-expanded="true"]::after,
.emotion-group-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* 4. List Containers */
.story-form .tag-child-list,
.story-form .emotion-choice-list {
    display: none; 
    margin-top: 0.75rem;
    width: 100%;
    /* No flex here prevents conflict with JS toggles */
}

.story-form .tag-direct-options {
    display: block; /* Ensures consistent wrapping context */
    margin-top: 0;
}

/* 5. The Pills (High Specificity to Overwrite Labels) */
.story-form .tag-choice,
.story-form .emotion-choice {
    position: relative;
    display: inline-flex !important; /* Force inline to sit next to each other */
    width: auto !important;          /* Force auto width so they don't stretch */
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.85rem;
    margin: 0 0.5rem 0.5rem 0;       /* Spacing (Gap replacement) */
    
    border: 2px solid #240774;
    border-radius: 6px;
    background: transparent;
    
    font-size: 0.9rem;
    color: #240774;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.story-form .tag-choice:hover,
.story-form .emotion-choice:hover {
    border-color: #0D5727;
    color: #0D5727;
}

.story-form .tag-choice input[type="checkbox"],
.story-form .emotion-choice input[type="checkbox"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    height: 100%;
    width: 100%;
    margin: 0;
}

/* Selected State */
.story-form .tag-choice.is-selected,
.story-form .emotion-choice.is-selected {
    background: #240774 !important;
    color: #ffffff !important;
    border-color: #1a0552;
}

/* Disabled State */
.story-form .tag-choice.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Word Counter */
.story-form .word-counter {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    text-align: right;
}
.word-counter .error { color: #dc3232; font-weight: 600; }
.word-counter .success { color: #1a8f3d; font-weight: 600; }

/* =Slider Styles - Connected Rectangles ================== */

.slider-choice-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider-choice-grid {
    display: flex;
    width: 100%;
}

.slider-choice {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 0;
}

.slider-choice-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.slider-choice-button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.5rem 0.25rem !important;
    
    border: 2px solid #240774;
    border-right-width: 1px; /* Shared borders */
    background: transparent;
    color: #240774;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* First item: round left corners */
.slider-choice:first-child .slider-choice-button {
    border-radius: 6px 0 0 6px;
    border-right-width: 1px;
}

/* Last item: round right corners */
.slider-choice:last-child .slider-choice-button {
    border-radius: 0 6px 6px 0;
    border-right-width: 2px;
}

/* Single item edge case */
.slider-choice:only-child .slider-choice-button {
    border-radius: 6px;
    border-width: 2px;
}

/* Hover state */
.slider-choice-button:hover {
    border-color: #0D5727;
    color: #0D5727;
}

/* Focus state */
.slider-choice-input:focus-visible + .slider-choice-button {
    box-shadow: 0 0 0 2px rgba(36, 7, 116, 0.35);
    z-index: 1;
}

/* Selected state */
.slider-choice-input:checked + .slider-choice-button,
.slider-choice.is-selected .slider-choice-button {
    background: #240774 !important;
    color: #ffffff !important;
    border-color: #240774;
}

/* Labels above the scale */
.slider-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.85rem;
    color: inherit;
    opacity: 0.8;
    font-weight: 600;
}

.slider-question-collection {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--story-form-border-color, var(--wp--preset--color--border, #d0d0d0));
    background: var(--story-form-chip-bg, rgba(0, 0, 0, 0.02));
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.slider-question-collection > .section-subheading {
    margin: 0;
    text-align: center;
}

.section-subheading .required-indicator {
    color: #c62828;
    margin-left: 0.35rem;
    font-weight: 600;
}

.selection-limit-note {
    font-weight: 600;
    margin-left: 0.35rem;
    color: var(--story-form-muted, #555);
}

.selection-limit-note.limit-error {
    color: #d63638;
    font-weight: 700;
    transition: color 0.3s ease;
}

.shake-limit {
    display: inline-block;
    animation: shake-horizontal 0.4s cubic-bezier(0.455, 0.030, 0.515, 0.955) both;
}

@keyframes shake-horizontal {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.form-actions {
    margin-top: 1rem;
}

.story-form .submit-button,
.story-deletion-actions .submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 2.5rem;
    border-radius: 999px;
    border: none;
    background: #240774 !important;
    color: #ffffff !important;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.story-form .submit-button:focus-visible,
.story-deletion-actions .submit-button:focus-visible {
    background: #0D5727 !important;
    box-shadow: 0 0 0 2px rgba(13, 87, 39, 0.3);
}

.story-form .submit-button:hover,
.story-deletion-actions .submit-button:hover {
    background: #0D5727 !important;
    color: #ffffff !important;
    border-color: #0D5727;
}

.story-form .submit-button.submit-button-secondary,
.submit-button-secondary {
    background: transparent;
    color: #240774;
    border: 1px solid #240774;
    box-shadow: none;
}

.story-form .submit-button.submit-button-secondary:hover,
.story-form .submit-button.submit-button-secondary:focus-visible,
.submit-button-secondary:hover,
.submit-button-secondary:focus-visible {
    background: #240774;
    color: #ffffff;
    border-color: #240774;
    box-shadow: 0 0 0 2px rgba(36, 7, 116, 0.2);
}

.story-form .submit-button:disabled {
    background: var(--story-form-button-disabled-bg, #999);
    cursor: not-allowed;
    box-shadow: none;
}

.form-message {
    margin-top: 1.25rem;
    padding: 1rem;
    border-radius: 4px;
    display: none;
    border: 1px solid transparent;
}

.form-message.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.form-message.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.hidden-field,
.is-hidden {
    display: none !important;
}

.screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.story-deletion-key-callout {
    margin: 2rem 0;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border-left: 4px solid var(--story-form-button-bg, #2271b1);
    background: #f8fafc;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.story-deletion-key-callout.is-expired {
    border-left-color: #dc2626;
    background: #fef2f2;
    text-align: center;
}

.story-deletion-key-callout h2 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.story-deletion-key-callout p {
    margin: 0.5rem 0;
}

.story-deletion-keys {
    display: grid;
    gap: 1rem;
    margin: 1.25rem 0;
}

.story-deletion-value {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.story-deletion-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
}

.story-deletion-data {
    font-size: 1.5rem;
    font-weight: 700;
    word-break: break-word;
}

.story-deletion-expiration {
    color: #475569;
    font-size: 0.9rem;
}

.story-deletion-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.story-deletion-warning {
    color: #b91c1c;
    font-weight: 700;
}

.story-deletion-form-wrapper {
    max-width: 640px;
    margin: 2rem auto;
}

.story-deletion-form.story-form {
    gap: 1.5rem;
}

.story-deletion-form .deletion-message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    display: none;
}

.story-deletion-form .deletion-message.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.story-deletion-form .deletion-message.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

@keyframes age-callout-shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

@media (max-width: 640px) {
    .story-submission-form {
        padding: 2rem 1rem;
    }

    .story-form .checkbox-group {
        gap: 0.5rem;
    }
    
    /* Slider scales down on mobile */
    .slider-choice-button {
        min-height: 2.5rem;
        font-size: 0.85rem;
        padding: 0.4rem 0.15rem !important;
    }
}

/* Force remove the line between stories */
.story-shortcode-entry {
    border: none !important;
    padding: 0 !important;
}

/* Story Metadata Display */
.story-metadata {
    margin-bottom: 30px;
}

.story-metadata p {
    margin: 8px 0;
    font-size: 14px;
}

/* Main metadata headers (like "Emotional Resonance") */
.story-metadata h2 {
    font-size: 1.3em;
    margin: 15px 0 10px 0;
    font-weight: 600;
    color: inherit;
}

/* Sub-headers in metadata (like "Positive", "Negative") */
.story-metadata h3 {
    font-size: 1em;
    margin: 10px 0 5px 0;
    font-weight: 600;
    color: inherit;
}

.story-metadata strong {
    color: inherit;
    margin-right: 5px;
}

/* No warnings indicator - green circle */
.story-no-warnings {
    margin: 0;
}

.warning-badge {
    display: inline-block;
    background: #dc3232;
    color: #fff;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
    margin-top: 5px;
}

.story-categories {
    margin-top: 15px;
}

.story-categories a {
    display: inline-block;
    background: #2271b1;
    color: #fff;
    padding: 5px 12px;
    border-radius: 3px;
    text-decoration: none;
    font-size: 13px;
    margin-right: 8px;
    margin-top: 5px;
    transition: background 0.2s;
}

.story-categories a:hover {
    background: #135e96;
}

.story-tags {
    margin-top: 15px;
}

.story-tags .tag-group {
    margin-bottom: 10px;
}

.story-tags .tag-group-name {
    display: block;
    color: #2271b1;
    font-size: 13px;
    margin-bottom: 5px;
}

.story-tags .tag-group-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.story-tags .tag-group-items .tag {
    display: inline-block;
    background: #f0f0f1;
    color: #1d2327;
    padding: 5px 12px;
    border-radius: 3px;
    font-size: 12px;
    border: 1px solid #ddd;
    text-decoration: none;
    transition: all 0.2s;
}

.story-tags .tag-group-items .tag:hover {
    background: #e0e0e1;
    border-color: #2271b1;
}

/* Story Metadata in Excerpts (Archive Pages) */
.story-metadata-excerpt {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 13px;
}

.story-metadata-excerpt span {
    display: inline-flex;
    align-items: center;
}

.story-metadata-excerpt .story-author,
.story-metadata-excerpt .story-ai {
    color: #555;
}

.story-metadata-excerpt .story-warnings-summary {
    background: #fff3cd;
    color: #856404;
    padding: 4px 10px;
    border-radius: 3px;
    font-weight: 600;
}

/* No warnings on archive pages - green background */
.story-metadata-excerpt .story-no-warnings-summary {
    background: #d4edda;
    color: #155724;
    padding: 4px 10px;
    border-radius: 3px;
    font-weight: 600;
}

/* Slider Questions Section */
.slider-questions-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.slider-section-intro {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
}

.slider-section-intro h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: inherit;
}

.slider-section-intro p {
    font-size: 14px;
    line-height: 1.6;
    color: inherit;
    margin-bottom: 10px;
}

/* Individual Slider Question */
.slider-question-field {
    margin-bottom: 35px;
}

.slider-question-field label {
    font-size: 16px;
    font-weight: 600;
    color: inherit;
    margin-bottom: 8px;
}

.slider-question-field .description {
    font-size: 13px;
    color: inherit;
    opacity: 0.7;
    margin-bottom: 15px;
}

/* Legacy slider input styles (range type - keeping for backwards compatibility) */
.slider-container {
    padding: 20px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
}

.slider-input {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 15px;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #2271b1;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider-input::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #2271b1;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider-input:hover::-webkit-slider-thumb {
    background: #135e96;
}

.slider-input:hover::-moz-range-thumb {
    background: #135e96;
}

/* Value Display */
.slider-value-display {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #2271b1;
}

.slider-current-value {
    font-size: 24px;
}

.slider-max-value {
    font-size: 16px;
    color: #666;
}

/* Slider Responses Display (on post) */
.story-slider-responses {
    margin-top: 20px;
    padding: 15px;
    border: none;
    border-radius: 4px;
    border-left: none;
    border-right: none;
    background: var(--story-slider-background, rgba(34, 113, 177, 0.08));
    box-shadow: none;
}

.story-slider-responses h2 {
    font-size: 1.2em;
    margin: 0 0 10px 0;
    color: inherit;
}

.slider-post-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 5ch;
}

.slider-post-entry {
    white-space: nowrap;
    font-size: 0.95rem;
}

.slider-post-label {
    font-weight: 600;
}

.slider-post-value {
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Story shortcode content warnings - no line breaks between label and values */
.story-shortcode-entry .story-content-warnings {
    margin: 0 0 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.story-shortcode-entry .story-warning-heading,
.story-shortcode-entry .story-warning-values {
    margin: 0;
    padding: 0;
    line-height: 1.4;
}
.story-shortcode-entry .story-warning-values {
    font-weight: normal; 
}
.story-shortcode-entry .story-warning-heading.story-no-warnings {
    font-weight: 600;
}

/* Story Metadata in Shortcode */
.story-shortcode-entry .story-field,
.story-shortcode-entry .story-content,
.story-shortcode-entry .story-field-value,
.story-shortcode-entry h5 {
    margin: 0 0 1rem 0;
}

/* Display metadata fields inline with small gap between items; other content retains paragraph spacing */
.story-shortcode-entry .metadata-field {
    display: block; 
    margin: 0;         
    padding: 0;        
    line-height: 1.35; 
}

.story-shortcode-entry .story-field:last-child,
.story-shortcode-entry .story-content:last-child,
.story-shortcode-entry .story-field-value:last-child,
.story-shortcode-entry h5:last-child {
    margin-bottom: 0;
}

.story-shortcode-entry .read-more-line {
    margin-top: 0.75rem;
}

.story-slider-group {
    margin: 0 0 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.story-slider-item {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
}

.story-slider-item strong {
    font-weight: 700;
    margin-right: 0.35rem;
}

.story-divider {
    height: 2px;
    background-color: #a87c4f;
    width: 80%;
    margin: 3rem auto;
    border: none;
}

.story-divider:last-of-type {
    display: none;
}

/* --- Story Metadata Fixes --- */

/* 1. Stack Metadata Vertically */
.story-metadata-group {
    display: flex;
    flex-direction: column !important; 
    gap: 0 !important; 
    margin-bottom: 20px;
}

/* 2. Fix Metadata Text Size and Spacing */
.story-meta-item {
    font-size: inherit !important; 
    line-height: 1.5; 
    color: inherit;
    margin: 0;
    padding: 0;
}

/* 3. Fix Content Warning Header Styling (Full Page) */
.story-warning-block h4.story-heading-warnings {
    font-size: inherit !important; 
    font-weight: 700 !important;   
    margin: 0 !important;
    padding: 0 !important;
    display: block;
    line-height: inherit;
    color: inherit;
}

.story-warning-block p.story-warnings {
    margin: 0 !important;
    font-weight: 400;
}

/* 4. Make "Content Warning" Bold */
.story-warning-heading {
    font-weight: 700 !important; 
    margin: 0 0 5px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .story-submission-form {
        padding: 20px;
    }
    
    .story-form .checkbox-group {
        grid-template-columns: 1fr;
    }
    
    .story-metadata-excerpt {
        flex-direction: column;
        gap: 8px;
    }
}
/* Optional field indicator */
.optional-indicator {
    font-style: italic;
    font-weight: 400;
    font-size: 0.85em;
    color: #0D5727;
    margin-left: 0.35rem;
}

/* Experience Date Field */
.experience-date-field {
    margin-bottom: 1.5em;
}

.experience-date-selectors {
    display: flex;
    gap: 1em;
    flex-wrap: wrap;
}

.experience-date-select {
    padding: 0.6em 1em;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    min-width: 140px;
    cursor: pointer;
}

.experience-date-select:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

.experience-date-select:required:invalid {
    border-color: #d63638;
}

.active-filter-pill {
    cursor: pointer;
}


/* =MOBILE FIXES (Final Polish) = */
@media (max-width: 640px) {

    /* --- 1. Fix the Pills (Soft Rectangles) --- */
    .story-form .tag-choice,
    .story-form .emotion-choice {
        border-radius: 8px !important; 
        flex: 1 1 auto; 
        text-align: center;
        padding: 0.6rem 0.5rem; 
    }

    /* --- 2. Fix the 1-10 Slider Layout --- */
    .slider-choice-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 8px; 
        border: none; 
        border-radius: 0;
        overflow: visible;
    }

    .slider-choice {
        flex: none;
        width: auto;
    }

    /* --- 3. The Button Style (Unselected) --- */
    .slider-choice-button {
        min-height: 3.5rem; 
        font-size: 1rem;
        font-weight: 600;
        -webkit-tap-highlight-color: transparent; 
        border: 2px solid #240774 !important;
        border-radius: 6px !important;
        background-color: transparent;
        color: #240774 !important;
    }

    /* --- 4. The Selected State (Must Win!) --- */
    .story-form .slider-choice.is-selected .slider-choice-button,
    .story-form .slider-choice-input:checked + .slider-choice-button {
        background-color: #240774 !important; 
        color: #ffffff !important; 
        border-color: #240774 !important;
    }
}


/* Story Spacer - Visual separator between fields */
.story-spacer {
  display: block !important;
  visibility: visible !important;
  width: 100% !important;
  height: 24px !important;
  min-height: 24px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  clear: both;
  line-height: 0 !important;
  font-size: 0 !important;
  
  /* Flex/Grid container compatibility */
  flex: 0 0 100% !important;
  flex-shrink: 0 !important;
  grid-column: 1 / -1 !important;
  
  /* Prevent collapse/removal */
  content-visibility: visible !important;
}

.story-spacer {
    height: 1px;           /* Thickness of the line */
    background-color: #ddd; /* Color of the line */
    margin: 20px 0;        /* Space above and below */
    width: 100%;           /* Full width */
    line-height: 1px;      /* Ensure the &nbsp; doesn't make it tall */
    font-size: 0;          /* Hide the &nbsp; text */
    display: block;        /* Ensure it behaves like a block */
}