/* User Contact Info Block Styles */

/* Main wrapper */
.wpuf-contact {
    margin: 0;
    padding: 0;
}

/* Individual contact field - optimized structure */
.wpuf-contact-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Field icon */
.wpuf-field-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.wpuf-field-icon svg {
    width: 1rem;
    height: 1rem;
}

/* Icon sizes */
.wpuf-icon-small svg {
    width: 0.875rem;
    height: 0.875rem;
}

.wpuf-icon-medium svg {
    width: 1rem;
    height: 1rem;
}

.wpuf-icon-large svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Field label */
.wpuf-field-label {
    font-weight: 500;
    color: inherit;
    flex-shrink: 0;
}

/* Field value */
.wpuf-field-value {
    word-break: break-word;
    color: inherit;
    flex: 1;
    min-width: 0; /* Allow text to wrap */
}

.wpuf-field-value a {
    color: inherit;
    text-decoration: none;
}

.wpuf-field-value a:hover {
    text-decoration: underline;
}

/* Layout styles */
.wpuf-layout-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.is-layout-flex.is-vertical .wpuf-layout-list {
    align-items: center;
}

.wpuf-layout-inline {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.wpuf-layout-inline .wpuf-contact-field {
    gap: 0.25rem;
}

/* No contact info message */
.wpuf-no-contact-info {
    margin: 0;
    padding: 0.5rem 0;
    color: inherit;
    font-style: italic;
}

/* WordPress Block Editor Styling Support */
/* Ensure block styles are inherited and applied correctly */
.wpuf-contact {
    color: inherit;
    background-color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

/* Apply WordPress color classes */
.wpuf-contact.has-text-color .wpuf-contact-field,
.wpuf-contact.has-text-color .wpuf-field-icon,
.wpuf-contact.has-text-color .wpuf-field-label,
.wpuf-contact.has-text-color .wpuf-field-value,
.wpuf-contact.has-text-color .wpuf-no-contact-info {
    color: inherit;
}

.wpuf-contact.has-background .wpuf-contact-field,
.wpuf-contact.has-background .wpuf-field-icon,
.wpuf-contact.has-background .wpuf-field-label,
.wpuf-contact.has-background .wpuf-field-value,
.wpuf-contact.has-background .wpuf-no-contact-info {
    background-color: inherit;
}

/* Alignment styles */
.wpuf-contact.has-text-align-left {
    text-align: left;
}

.wpuf-contact.has-text-align-center {
    text-align: center;
}

.wpuf-contact.has-text-align-right {
    text-align: right;
}

/* Alignment for list layout */
.wpuf-contact.has-text-align-center.wpuf-layout-list .wpuf-contact-fields {
    align-items: center;
}

.wpuf-contact.has-text-align-right.wpuf-layout-list .wpuf-contact-fields {
    align-items: flex-end;
}

/* Center alignment for inline layout */
.wpuf-contact.has-text-align-center.wpuf-layout-inline {
    justify-content: center;
}

.wpuf-contact.has-text-align-right.wpuf-layout-inline {
    justify-content: flex-end;
}

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

/* Ensure block editor styling is preserved */
.block-editor-block-list__layout .wpuf-contact,
.block-editor-block-list__layout .wpuf-contact .wpuf-contact-field,
.block-editor-block-list__layout .wpuf-contact .wpuf-field-icon,
.block-editor-block-list__layout .wpuf-contact .wpuf-field-label,
.block-editor-block-list__layout .wpuf-contact .wpuf-field-value,
.block-editor-block-list__layout .wpuf-contact .wpuf-no-contact-info {
    color: inherit !important;
    background-color: inherit !important;
    margin: inherit;
    padding: inherit;
}

/* Container context styles */
.wpuf-contact.wpuf-in-directory {
    /* Directory-specific styles if needed */
}

.wpuf-contact.wpuf-in-profile {
    /* Profile-specific styles if needed */
}

/* Ensure proper inheritance for all child elements */
.wpuf-contact * {
    color: inherit;
    background-color: inherit;
}

/* Override for links to maintain proper styling */
.wpuf-contact .wpuf-field-value a {
    color: inherit;
    text-decoration: none;
}

.wpuf-contact .wpuf-field-value a:hover {
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .wpuf-contact-field {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .wpuf-field-value {
        width: 100%;
    }
}

/* Backward compatibility - support both class names */
.wpuf-user-contact-info {
    margin: 0;
    padding: 0;
}

.wpuf-user-contact-info .wpuf-contact-field {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    max-width: fit-content;
}

.wpuf-user-contact-info .wpuf-field-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.wpuf-user-contact-info .wpuf-field-label {
    font-weight: 500;
    color: inherit;
    flex-shrink: 0;
}

.wpuf-user-contact-info .wpuf-field-value {
    word-break: break-word;
    color: inherit;
    flex: 1;
    min-width: 0;
}

.wpuf-user-contact-info .wpuf-field-value a {
    color: inherit;
    text-decoration: none;
}

.wpuf-user-contact-info .wpuf-field-value a:hover {
    text-decoration: underline;
}
