/* Server Showcase Accessibility Enhancements */

/* Focus indicators for interactive elements */
.server-toggle__btn:focus,
.server-dropdown__toggle:focus,
.server-dropdown__option:focus,
.server-plan-slider-nav:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* High contrast focus for better visibility */
@media (prefers-contrast: high) {
    .server-toggle__btn:focus,
    .server-dropdown__toggle:focus,
    .server-dropdown__option:focus,
    .server-plan-slider-nav:focus {
        outline: 3px solid #000;
        outline-offset: 2px;
    }
}

/* Keyboard navigation states */
.server-dropdown__option:focus {
    background-color: #f8f9fa;
    color: #212529;
}

.server-dropdown__option:focus:hover {
    background-color: #e9ecef;
}

/* Improved button states */
.server-toggle__btn {
    transition: all 0.2s ease;
    position: relative;
}

.server-toggle__btn:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.server-toggle__btn.is-active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.server-toggle__btn:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Dropdown accessibility improvements */
.server-dropdown__toggle[aria-expanded="true"] .fa-chevron-up {
    transform: rotate(180deg);
}

.server-dropdown__toggle {
    transition: all 0.2s ease;
}

.server-dropdown__toggle:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

/* Navigation button improvements */
.server-plan-slider-nav {
    transition: all 0.2s ease;
    cursor: pointer;
}

.server-plan-slider-nav:hover {
    background-color: #007bff;
    color: white;
    transform: scale(1.05);
}

.server-plan-slider-nav:active {
    transform: scale(0.95);
}

/* Screen reader only text for better accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .server-toggle__btn,
    .server-dropdown__toggle,
    .server-plan-slider-nav {
        transition: none;
    }
    
    .server-dropdown__toggle .fa-chevron-up {
        transition: none;
    }
}

/* Loading state for dynamic content */
.server-showcase[aria-busy="true"] {
    opacity: 0.7;
    pointer-events: none;
}

.server-showcase[aria-busy="true"]::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #007bff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error state styling */
.server-card--error {
    border: 2px solid #dc3545;
    background-color: #f8d7da;
    color: #721c24;
}

.server-card__error {
    text-align: center;
    padding: 20px;
}

/* Interactive element spacing */
.server-showcase__filter-bar {
    margin: 20px 0;
}

.server-toggle {
    margin-bottom: 15px;
}

.server-dropdown {
    margin: 0; /* Remove margin to allow CSS Grid to handle spacing */
}

/* Filter controls */
.filter-controls {
    margin-bottom: 15px;
}

.clear-filters-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.clear-filters-btn:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.clear-filters-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.clear-filters-btn:active {
    transform: translateY(0);
}

/* Active filters display */
.active-filters {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    background-color: #007bff;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.filter-tag:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

.filter-tag:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.25);
}

.filter-tag::after {
    content: "×";
    font-weight: bold;
    margin-left: 4px;
}

/* Plan filtering transitions */
.server-card {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.server-card[style*="opacity: 0"] {
    transform: scale(0.95);
}

/* Loading state for filtered content */
.server-showcase__plans[aria-busy="true"] {
    position: relative;
}

.server-showcase__plans[aria-busy="true"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1;
    pointer-events: none;
}

.server-showcase__plans[aria-busy="true"]::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #007bff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    z-index: 2;
}

/* Responsive focus indicators */
@media (max-width: 768px) {
    .server-toggle__btn:focus,
    .server-dropdown__toggle:focus {
        outline-width: 3px;
    }
    
    .active-filters {
        margin-top: 10px;
    }
    
    .filter-tag {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
}