/*
 * Xablu.Blazor — Global Component Styles
 * v10.0 Alpha: Semantic tokens only. No legacy color ramps.
 *
 * Component-specific classes that cannot be scoped (e.g., portal-based overlays).
 * All colors reference --x-* semantic tokens from tokens.css.
 *
 * Phase 178: Wrapped in @layer library-globals — loaded via <link>, NOT @import.
 * This layer is reserved for portal/overlay styles only.
 */

@layer library-globals {

/* =============================================================================
 * XModal Component Styles (portal-rendered, cannot use scoped CSS)
 * ============================================================================= */

.x-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--x-color-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--x-z-modal-backdrop);
    animation: x-modal-fade-in var(--x-duration-normal) var(--x-ease-out);
}

@keyframes x-modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.x-modal {
    background-color: var(--x-color-card);
    border-radius: var(--x-radius-xl);
    box-shadow: var(--x-elevation-xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: x-modal-slide-up var(--x-duration-normal) var(--x-ease-out);
}

@keyframes x-modal-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.x-modal-small { width: min(90vw, 400px); }
.x-modal-medium { width: min(90vw, 600px); }
.x-modal-large { width: min(90vw, 800px); }

.x-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--x-spacing-5) var(--x-spacing-6);
    border-bottom: var(--x-border-width-1) solid var(--x-color-border);
}

.x-modal-title {
    margin: 0;
    color: var(--x-color-foreground);
}

.x-modal-close-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--x-spacing-2);
    border-radius: var(--x-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--x-color-muted-foreground);
}

.x-modal-close-button:hover {
    background-color: var(--x-color-muted);
}

.x-modal-body {
    padding: var(--x-spacing-6);
    overflow-y: auto;
    flex: 1;
}

.x-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--x-spacing-3);
    padding: var(--x-spacing-4) var(--x-spacing-6);
    border-top: var(--x-border-width-1) solid var(--x-color-border);
    background-color: var(--x-color-muted);
}

/* =============================================================================
 * XDropdown Component Styles (portal-rendered, cannot use scoped CSS)
 * ============================================================================= */

.x-dropdown {
    position: relative;
    display: inline-block;
}

.x-dropdown-trigger {
    cursor: pointer;
}

.x-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background-color: var(--x-color-card);
    border-radius: var(--x-radius-lg);
    box-shadow: var(--x-elevation-lg);
    z-index: var(--x-z-dropdown);
    overflow: hidden;
    animation: x-dropdown-fade-in var(--x-duration-fast) var(--x-ease-out);
}

@keyframes x-dropdown-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.x-dropdown-menu-right {
    left: auto;
    right: 0;
}

/* Phase 193: --x-dropdown-item-padding, --x-dropdown-item-hover-bg added */
.x-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--x-spacing-3);
    padding: var(--x-dropdown-item-padding, var(--x-spacing-3) var(--x-spacing-4));
    cursor: pointer;
    color: var(--x-color-foreground);
    transition: background-color var(--x-transition-fast);
}

.x-dropdown-item:hover {
    background-color: var(--x-dropdown-item-hover-bg, var(--x-color-muted));
}

.x-dropdown-item-icon {
    width: var(--x-icon-size-md);
    height: var(--x-icon-size-md);
}

.x-dropdown-item-active:not(:hover) {
    background-color: var(--x-color-primary-subtle);
}

.x-dropdown-item-disabled {
    color: var(--x-color-muted-foreground);
    cursor: not-allowed;
    pointer-events: none;
    opacity: var(--x-opacity-50);
}

.x-dropdown-item-danger {
    color: var(--x-color-destructive);
}

.x-dropdown-divider {
    height: 1px;
    background-color: var(--x-color-border);
    margin: var(--x-spacing-1) 0;
}

} /* end @layer library-globals */
