/* WPUF User Bio Block Styles */

/* Bio Container */
.wpuf-user-bio {
    margin: 0;
    padding: 0;
}

.wpuf-bio-content {
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* Ensure block styles (colors, etc.) are inherited by the bio content */
.wpuf-user-bio .wpuf-bio-text {
    /* Inherit all text-related styles from the block wrapper */
    color: inherit;
    background-color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    text-align: inherit;
    line-height: inherit;
}

/* Ensure paragraph elements inherit block styles properly */
.wpuf-user-bio p.wpuf-bio-text {
    /* Force inheritance of block styles */
    color: inherit !important;
    background-color: inherit !important;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    text-align: inherit;
    line-height: inherit;
    margin: 0 0 1rem 0;
    word-wrap: break-word;
}

.wpuf-user-bio p.wpuf-bio-text:last-child {
    margin-bottom: 0;
}

/* Bio Content States - for read more functionality */
.wpuf-bio-truncated,
.wpuf-bio-full {
    transition: opacity 0.3s ease;
}

.wpuf-bio-full[style*="display: none"] {
    opacity: 0;
}

.wpuf-bio-full[style*="display: block"] {
    opacity: 1;
}

/* Read More Toggle Button */
.wpuf-read-more-toggle {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.25rem 0;
    margin-top: 0.5rem;
    text-decoration: underline;
    transition: opacity 0.2s ease, color 0.2s ease;
    display: inline-block;
    position: relative;
}

.wpuf-read-more-toggle:hover {
    opacity: 0.8;
    text-decoration: none;
}

.wpuf-read-more-toggle:active {
    transform: translateY(1px);
}

/* Loading state for toggle */
.wpuf-read-more-toggle[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Container-specific styling support */
/* User Profile context */
.wpuf-user-profile .wpuf-user-bio .wpuf-bio-text {
    color: inherit !important;
    background-color: inherit !important;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    text-align: inherit;
    line-height: inherit;
}

/* User Directory context */
.wpuf-user-directory .wpuf-user-bio .wpuf-bio-text {
    color: inherit !important;
    background-color: inherit !important;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    text-align: inherit;
    line-height: inherit;
}

/* Handle nested wrapper structures */
.wpuf-inner-blocks-container .wpuf-user-bio .wpuf-bio-text,
.wpuf-user-profile .wpuf-inner-blocks-container .wpuf-user-bio .wpuf-bio-text {
    color: inherit !important;
    background-color: inherit !important;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    text-align: inherit;
    line-height: inherit;
}

/* Block Editor Specific Styles */
.block-editor-block-list__layout .wpuf-user-bio {
    margin: 0;
}

/* Ensure block editor styles are applied to bio content */
.block-editor-block-list__layout .wpuf-user-bio .wpuf-bio-text {
    color: inherit !important;
    background-color: inherit !important;
    margin: inherit;
    padding: inherit;
}

.block-editor-block-list__layout .wpuf-user-bio p.wpuf-bio-text {
    color: inherit !important;
    background-color: inherit !important;
    margin: inherit;
    padding: inherit;
}

/* HTML Content Styling */
.wpuf-user-bio h1,
.wpuf-user-bio h2,
.wpuf-user-bio h3,
.wpuf-user-bio h4,
.wpuf-user-bio h5,
.wpuf-user-bio h6 {
    margin: 0 0 0.5rem 0;
    color: inherit;
}

.wpuf-user-bio a {
    color: inherit;
    text-decoration: underline;
}

.wpuf-user-bio a:hover {
    text-decoration: none;
}

.wpuf-user-bio ul,
.wpuf-user-bio ol {
    margin: 0 0 1rem 1.5rem;
    padding: 0;
}

.wpuf-user-bio li {
    margin-bottom: 0.25rem;
}

.wpuf-user-bio blockquote {
    margin: 0 0 1rem 1rem;
    padding-left: 1rem;
    border-left: 3px solid currentColor;
    font-style: italic;
}

.wpuf-user-bio code {
    background-color: #f4f4f4;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875em;
}

/* Empty message styling */
.wpuf-bio-content .wpuf-bio-empty {
    font-style: italic;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wpuf-user-bio .wpuf-bio-content {
        margin-bottom: 0.75rem;
    }

    .wpuf-read-more-toggle {
        font-size: 0.8125rem;
        margin-top: 0.375rem;
    }
}

@media (max-width: 480px) {
    .wpuf-bio-content ul,
    .wpuf-bio-content ol {
        margin-left: 1rem;
    }

    .wpuf-bio-content blockquote {
        margin-left: 0.5rem;
        padding-left: 0.75rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .wpuf-read-more-toggle {
        transition: none;
    }

    .wpuf-bio-truncated,
    .wpuf-bio-full {
        transition: none;
    }
}

/* WordPress Block Editor Font Size Classes */
.wpuf-user-bio.has-small-font-size .wpuf-bio-content,
.wpuf-user-bio.has-small-font-size .wpuf-bio-text {
    font-size: inherit !important;
}

.wpuf-user-bio.has-medium-font-size .wpuf-bio-content,
.wpuf-user-bio.has-medium-font-size .wpuf-bio-text {
    font-size: inherit !important;
}

.wpuf-user-bio.has-large-font-size .wpuf-bio-content,
.wpuf-user-bio.has-large-font-size .wpuf-bio-text {
    font-size: inherit !important;
}

.wpuf-user-bio.has-x-large-font-size .wpuf-bio-content,
.wpuf-user-bio.has-x-large-font-size .wpuf-bio-text {
    font-size: inherit !important;
}

/* WordPress Block Editor Font Family Classes */
.wpuf-user-bio.has-system-font-family .wpuf-bio-content,
.wpuf-user-bio.has-system-font-family .wpuf-bio-text {
    font-family: inherit !important;
}

.wpuf-user-bio.has-serif-font-family .wpuf-bio-content,
.wpuf-user-bio.has-serif-font-family .wpuf-bio-text {
    font-family: inherit !important;
}

.wpuf-user-bio.has-mono-font-family .wpuf-bio-content,
.wpuf-user-bio.has-mono-font-family .wpuf-bio-text {
    font-family: inherit !important;
}

/* Print styles */
@media print {
    .wpuf-read-more-toggle {
        display: none;
    }

    .wpuf-bio-truncated {
        display: none !important;
    }

    .wpuf-bio-full {
        display: block !important;
    }
}
