/**
 * Easy Architect - Meta Field Components
 * Clean base classes with components using them directly
 */

/*******************/
/* 1. BASE CLASSES */
/*******************/

/* Universal button base for all clickable elements */
.easy-button-base {
    border: 1px solid #949494;
    border-radius: 2px;
    box-shadow: 0 0 0 0 var(--wp-admin-theme-color);
    background-color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 40px;
    outline-offset: -1px;
    overflow: hidden;
    padding: 0;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.easy-button-base:hover {
    border-color: #757575;
}

.easy-button-base:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Universal label styling */
.easy-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    color: #1e1e1e;
    letter-spacing: 0.5px;
}

/* Universal help text styling with higher specificity */
.easy-help-text.easy-help-text {
    color: #757575 !important;
    text-transform: none;
    font-size: 12px !important;
    line-height: 1.4;
    font-weight: normal !important;
    margin: 0 !important;
}

.easy-help-text--error.easy-help-text--error {
    color: #d63638 !important;
    font-weight: 500 !important;
}

/* Universal controller base */
.easy-controller {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 8px;
}

/* Universal connection indicator */
.easy-connection-badge {
    font-size: 10px;
    background: #f0f0f0;
    color: #666;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.easy-connection-badge--active {
    background: #0073aa;
    color: white !important;
}

/* Universal icon styling */
.easy-icon {
    font-size: 16px;
    transition: color 0.2s ease;
    cursor: pointer;
    line-height: 1.2em;
    vertical-align: middle;
}

.easy-icon--inactive {
    color: #1e1e1e;
}

.easy-icon--inactive:hover {
    color: #000000;
}

.easy-icon--connected {
    color: #7c3aed; /* WordPress binding purple */
}

.easy-icon--error {
    color: #d63638; /* WordPress error red */
    animation: pulse 2s infinite ease-in-out;
}

.easy-icon--disabled {
    color: #cccccc;
    cursor: not-allowed;
}

/* Universal popover styling */
.easy-popover .components-popover__content {
    padding: 16px;
    min-width: 256px;
}

.easy-popover .components-base-control {
    margin: 0;
}

.easy-popover__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #eee;
    font-weight: bold;
}

.easy-popover__actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.easy-popover__content {
    min-width: 320px;
    padding: 16px;
}

/***********************/
/* 2. COMPONENT STYLES */
/***********************/

/* EasyImageControl - Component-specific styles only */
.easy-image-control__container {
    position: relative;
}

.easy-image-control__preview-image {
    aspect-ratio: 2 / 1;
    object-fit: cover;
    width: 100%;
}

.easy-image-control__actions {
    bottom: 0;
    opacity: 0;
    padding: 8px;
    position: absolute;
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 8px;
    justify-content: space-between;
    width: 100%;
    transition: opacity 0.2s ease;
}

.easy-image-control__action {
    flex-grow: 1;
    justify-content: center;
    backdrop-filter: blur(16px) saturate(180%);
    background: #ffffffbf;
}

.easy-image-control__container:focus .easy-image-control__actions,
.easy-image-control__container:focus-within .easy-image-control__actions,
.easy-image-control__container:hover .easy-image-control__actions {
    opacity: 1;
}

/* EasyImageControl variations - Component-specific overrides */
.easy-image-control__preview {
    height: auto !important;
    outline: 1px solid #0000001a;
}

.easy-image-control__toggle {
    box-shadow: inset 0 0 0 1px #ccc;
}

/* EasyConnectionButton - Component-specific styles only */
.easy-connection-button {
    padding: 0 !important;
    margin: 0 !important;
    min-width: auto !important;
    height: auto !important;
    width: auto !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.easy-connection-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* EasyMetaController - Component-specific styles only */
.easy-meta-controller--highlighted {
    border-left: 3px solid #0073aa;
    padding-left: 12px;
    padding-top: 1em;
    margin-bottom: 1em;
    background: rgba(0, 115, 170, 0.05);
    transition: all 0.2s ease;
}

/* EasyConnectionToolbar - Component-specific styles only */
.easy-connection-toolbar {
    position: relative;
}

/* Connected state - purple */
.easy-connection-toolbar--connected::before {
    background-color: rgba(139, 92, 246, 0.1) !important;
    border: 1px solid rgba(139, 92, 246, 0.2) !important;
}

.easy-connection-toolbar--connected svg {
    color: #8b5cf6 !important;
    fill: #8b5cf6 !important;
}

.easy-connection-toolbar--connected:hover::before {
    background-color: rgba(139, 92, 246, 0.15) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
}

.easy-connection-toolbar--connected:hover svg {
    color: #8b5cf6 !important;
    fill: #8b5cf6 !important;
}

/* 🌟 Error state - red (takes priority over connected) */
.easy-connection-toolbar--error::before {
    background-color: rgba(214, 54, 56, 0.1) !important;
    border: 1px solid rgba(214, 54, 56, 0.2) !important;
}

.easy-connection-toolbar--error svg {
    color: #d63638 !important;
    fill: #d63638 !important;
}

.easy-connection-toolbar--error:hover::before {
    background-color: rgba(214, 54, 56, 0.15) !important;
    border: 1px solid rgba(214, 54, 56, 0.3) !important;
}

.easy-connection-toolbar--error:hover svg {
    color: #d63638 !important;
    fill: #d63638 !important;
}

/* Default state - no special styling */
.easy-connection-toolbar:not(.easy-connection-toolbar--connected):not(.easy-connection-toolbar--error)::before {
    background-color: transparent;
    border: 1px solid transparent;
}

.easy-connection-toolbar:not(.easy-connection-toolbar--connected):not(.easy-connection-toolbar--error) svg {
    color: currentColor;
    fill: currentColor;
}

.easy-connection-toolbar:not(.easy-connection-toolbar--connected):not(.easy-connection-toolbar--error):hover::before {
    background-color: #f0f0f0;
}

.components-dropdown-menu__menu-item.is-active {
    background-color: rgba(139, 92, 246, 0.15) !important;
    color: #8b5cf6 !important;
}

.components-dropdown-menu__menu-item:hover {
    background-color: rgba(139, 92, 246, 0.08) !important;
}

.components-menu-item__button.is-active,
.components-menu-item.is-active {
    background-color: rgba(139, 92, 246, 0.15) !important;
    color: #8b5cf6 !important;
}

.components-menu-item__button:hover,
.components-menu-item:hover {
    background-color: rgba(139, 92, 246, 0.08) !important;
}

/************************/
/* 3. ANIMATIONS & UTILS */
/************************/

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
