/**
 * App Switcher Block Frontend Styles
 */

.huxly-app-switcher {
    display: inline-block;
    position: relative;
}

.huxly-app-switcher.alignment-left {
    text-align: left;
}

.huxly-app-switcher.alignment-center {
    text-align: center;
}

.huxly-app-switcher.alignment-right {
    text-align: right;
}

.app-switcher-container {
    position: relative;
    display: inline-block;
}

.app-switcher-button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    padding: 15px 10px;
    border: none;
}

.app-switcher-button:hover,
.app-switcher-button:focus {
    background-color: var(--ast-global-color-1)!important;
    outline: none;
}

.app-switcher-button:active,
.app-switcher-button[aria-expanded="true"] {
    background: var(--ast-global-color-1);
}

.app-switcher-button svg {
    display: block;
    pointer-events: none;
    margin-right: 4px;
}

.app-switcher-dropdown {
    position: absolute;
    background: var(--ast-global-color-1);
    border: 1px solid var(--ast-global-color-1);
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 320px;
    max-width: 320px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    padding: 0;
    margin-top: 0;
}

/* Dropdown positioning */
.app-switcher-dropdown.position-bottom-left {
    top: 100%;
    left: 0;
}

.app-switcher-dropdown.position-bottom-right {
    top: 100%;
    right: 0;
}

.app-switcher-dropdown.position-top-left {
    bottom: 100%;
    left: 0;
    margin-top: 0;
    margin-bottom: 4px;
}

.app-switcher-dropdown.position-top-right {
    bottom: 100%;
    right: 0;
    margin-top: 0;
    margin-bottom: 4px;
}

/* Application items */
.app-item {
    display: flex;
    align-items: center;
    padding: 10px;
    text-decoration: none;
    color: var(--ast-global-color-4);
    transition: background-color 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
}

.app-item:hover,
.app-item:focus {
    background-color: var(--ast-global-color-0);
    color: var(--ast-global-color-4);
    text-decoration: none;
    outline: none;
}

.app-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 10px;
    background: transparent;
    border-radius: 4px;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

.app-icon .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #50575e;
}

.app-label {
    font-size: 18px;
    line-height: 1.4;
    color: inherit;
    flex-grow: 1;
    text-align: left;
    word-break: break-word;
}

/* Loading and error states */
.dropdown-loading,
.dropdown-error,
.dropdown-empty {
    padding: 16px;
    text-align: center;
    color: var(--ast-global-color-4);
    font-size: 18px;
}

.dropdown-error {
    color: #d63638;
}

.dropdown-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid #c3c4c7;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .app-switcher-dropdown {
        min-width: 200px;
        max-width: 280px;
    }
    
    .app-item {
        padding: 10px 12px;
    }
    
    .app-icon {
        width: 28px;
        height: 28px;
        margin-right: 10px;
    }
    
    .app-icon .dashicons {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }
    
    .app-label {
        font-size: 13px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .app-switcher-button {
        border-width: 0.5px;
    }
    
    .app-switcher-dropdown {
        border-width: 0.5px;
    }
}

/* Dark mode support */
/* @media (prefers-color-scheme: dark) {
    .app-switcher-button {
        background: #2c3338;
        border-color: #50575e;
        color: #f6f7f7;
    }
    
    .app-switcher-button:hover,
    .app-switcher-button:focus {
        background: #3c434a;
        border-color: #646970;
    }
    
    .app-switcher-dropdown {
        background: #1d2327;
        border-color: #3c434a;
    }
    
    .app-item {
        color: #f6f7f7;
    }
    
    .app-item:hover,
    .app-item:focus {
        background-color: #2c3338;
        color: #f6f7f7;
    }
    
    .app-icon {
        background: #3c434a;
    }
    
    .app-icon .dashicons {
        color: #a7aaad;
    }
} */