/* Estilos para o modal de seleção de campeões */
#champions-modal {
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#champions-modal.show {
    opacity: 1;
    visibility: visible;
}

#champions-modal .modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    width: 95%;
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

#champions-modal.show .modal-content {
    transform: translateY(0);
    opacity: 1;
}

/* Cabeçalho do Modal */
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: #4b5563;
    background-color: #e5e7eb;
}

/* Corpo do Modal */
.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Rodapé do Modal */
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Estilos para botões do modal */
.modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.25rem;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    border: 1px solid transparent;
}

/* Botão primário */
.modal-btn-primary {
    background-color: #3b82f6;
    color: white;
}

.modal-btn-primary:hover {
    background-color: #2563eb;
}

.modal-btn-primary:active {
    background-color: #1d4ed8;
    transform: translateY(1px);
}

/* Botão secundário */
.modal-btn-secondary {
    background-color: #ffffff;
    color: #374151;
    border-color: #d1d5db;
}

.modal-btn-secondary:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.modal-btn-secondary:active {
    background-color: #f3f4f6;
    transform: translateY(1px);
}

/* Botão de perigo */
.modal-btn-danger {
    background-color: #ef4444;
    color: white;
}

.modal-btn-danger:hover {
    background-color: #dc2626;
}

.modal-btn-danger:active {
    background-color: #b91c1c;
    transform: translateY(1px);
}

/* Estado desabilitado */
.modal-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Ícones nos botões */
.modal-btn i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* Estilos responsivos para dispositivos móveis */
@media (max-width: 640px) {
    #champions-modal .modal-content {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        margin: 0;
    }
    
    .modal-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .modal-body {
        padding: 1rem;
        height: calc(100% - 120px);
    }
    
    .modal-footer {
        position: sticky;
        bottom: 0;
        padding: 0.75rem 1rem;
        background: white;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    }
    
    #champions-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.75rem;
        padding: 0.5rem;
    }
    
    .champion-item {
        padding: 0.5rem 0.25rem;
    }
    
    .champion-item img {
        width: 40px;
        height: 40px;
    }
    
    .champion-item span {
        font-size: 0.65rem;
        margin-top: 0.25rem;
    }
    
    /* Melhorias de acessibilidade para toque em dispositivos móveis */
    .champion-item {
        min-height: 90px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        border-radius: 0.5rem;
        transition: all 0.2s ease;
        padding: 0.75rem 0.5rem;
        border: 1px solid transparent;
        background-color: #ffffff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .champion-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        border-color: #e5e7eb;
    }

    .champion-item:active {
        transform: translateY(0);
        box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    }

    .champion-item.selected {
        background-color: #f0f9ff;
        border: 2px solid #3b82f6;
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
        position: relative;
        transform: translateY(-2px);
    }

    .champion-item.selected::before {
        content: '';
        position: absolute;
        top: -2px;
        left: -2px;
        right: -2px;
        bottom: -2px;
        border-radius: 0.5rem;
        border: 2px solid #3b82f6;
        animation: pulse 2s infinite;
        pointer-events: none;
    }

    @keyframes pulse {
        0% {
            opacity: 0.5;
            transform: scale(1);
        }
        50% {
            opacity: 0.2;
            transform: scale(1.02);
        }
        100% {
            opacity: 0.5;
            transform: scale(1);
        }
    }

    .champion-item.selected:hover {
        background-color: #e0f2fe;
        transform: translateY(-3px);
        box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2);
    }

    .champion-item.selected .champion-avatar::after {
        box-shadow: inset 0 0 0 2px #3b82f6;
    }

    .champion-item.selected .champion-name {
        color: #1e40af;
        font-weight: 600;
    }

    .champion-avatar {
        position: relative;
        margin-bottom: 0.5rem;
    }

    .champion-avatar::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 50%;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
        pointer-events: none;
    }

    .champion-avatar img {
        border-radius: 50%;
        width: 48px;
        height: 48px;
        object-fit: cover;
        border: 2px solid transparent;
        transition: all 0.2s ease;
    }

    .champion-item.selected .champion-avatar img {
        border-color: #3b82f6;
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
    }

    .champion-name {
        font-size: 0.75rem;
        font-weight: 500;
        color: #374151;
        text-align: center;
        line-height: 1.2;
        margin-top: 0.5rem;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Efeito de seleção com ícone de verificação */
    .champion-item.selected .champion-avatar::before {
        content: '✓';
        position: absolute;
        top: -4px;
        right: -4px;
        width: 20px;
        height: 20px;
        background-color: #3b82f6;
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.75rem;
        font-weight: bold;
        z-index: 1;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }
    
    /* Estilos para a barra de busca */
.search-container {
    position: relative;
    margin-bottom: 1.5rem;
}

#champion-search {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #374151;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

#champion-search:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    outline: none;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

/* Contador de campeões selecionados */
.selected-count {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background-color: #3b82f6;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    min-width: 1.5rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Ajustes para o campo de busca em telas pequenas */
@media (max-width: 640px) {
    #champion-search {
        font-size: 1rem;
        padding: 0.75rem 1rem 0.75rem 2.75rem;
    }
    
    .search-icon {
        left: 0.875rem;
    }
    
    .selected-count {
        right: 0.75rem;
        font-size: 0.6875rem;
        padding: 0.125rem 0.375rem;
        min-width: 1.25rem;
    }
}

/* Dark mode para campo de busca e contador */
@media (prefers-color-scheme: dark) {
    #champion-search {
        background-color: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }
    
    #champion-search::placeholder {
        color: #9ca3af;
    }
    
    #champion-search:focus {
        border-color: #818cf8;
        box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
    }
    
    .search-icon {
        color: #9ca3af;
    }
    
    .selected-count {
        background-color: #4f46e5;
    }
}
    
    /* Ajustes para os botões no rodapé */
    .modal-footer button {
        flex: 1;
        padding: 0.75rem;
        font-size: 1rem;
    }
}

/* Ajustes para tablets */
@media (min-width: 641px) and (max-width: 1024px) {
    #champions-grid {
        grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
        gap: 0.875rem;
    }
    
    .champion-item img {
        width: 44px;
        height: 44px;
    }
    
    .champion-item span {
        font-size: 0.7rem;
    }
}

/* Melhorias de acessibilidade */
.champion-item {
    position: relative;
    outline: none;
}

.champion-item:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3);
    z-index: 1;
}

/* Melhorar contraste para acessibilidade */
.champion-name {
    font-weight: 500;
}

/* Indicador de foco para teclado */
.champion-item:focus:not(:focus-visible) {
    outline: none;
}

/* Melhorar contraste para leitores de tela */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Estados de carregamento e mensagens */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: #6b7280;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.error-state {
    padding: 1.5rem;
    text-align: center;
    background-color: #fef2f2;
    border-radius: 0.5rem;
    color: #b91c1c;
    margin: 1rem;
    border-left: 4px solid #ef4444;
}

.error-state button {
    margin-top: 0.75rem;
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.error-state button:hover {
    background: #dc2626;
}

/* Dark mode para estados de carregamento e erro */
@media (prefers-color-scheme: dark) {
    .loading-state {
        color: #9ca3af;
    }
    
    .loading-spinner {
        border-color: #4b5563;
        border-top-color: #818cf8;
    }
    
    .error-state {
        background-color: #2a1a1a;
        color: #fca5a5;
        border-left-color: #f87171;
    }
    
    .error-state button {
        background: #ef4444;
    }
    
    .error-state button:hover {
        background: #f87171;
    }
}

/* Suporte para dark mode */
@media (prefers-color-scheme: dark) {
    #champions-modal .modal-content {
        background: #1f2937;
        color: #f3f4f6;
    }
    
    .modal-header {
        background: #111827;
        border-bottom-color: #374151;
    }
    
    .modal-header h3 {
        color: #f9fafb;
    }
    
    .modal-close {
        color: #9ca3af;
    }
    
    .modal-close:hover {
        color: #d1d5db;
        background-color: #374151;
    }
    
    .modal-footer {
        background: #111827;
        border-top-color: #374151;
    }
    
    #champion-search {
        background-color: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }
    
    #champion-search::placeholder {
        color: #9ca3af;
    }
    
    #champion-search:focus {
        border-color: #818cf8;
        box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.3);
    }
    
    /* Estilos para itens de campeão no dark mode */
    .champion-item {
        background: #1f2937;
        border-color: #374151;
        color: #f3f4f6;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }
    
    .champion-item:hover {
        background: #374151;
        border-color: #4b5563;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    }
    
    .champion-item:active {
        box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    }
    
    .champion-item.selected {
        background: #1e1b4b;
        border: 2px solid #818cf8;
        box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.3);
        transform: translateY(-2px);
    }
    
    .champion-item.selected::before {
        border-color: #818cf8;
    }
    
    .champion-item.selected:hover {
        background: #312e81;
        transform: translateY(-3px);
        box-shadow: 0 4px 8px rgba(129, 140, 248, 0.2);
    }
    
    .champion-item.selected .champion-avatar::after {
        box-shadow: inset 0 0 0 2px #818cf8;
    }
    
    .champion-item.selected .champion-name {
        color: #a5b4fc;
        font-weight: 600;
    }
    
    .champion-item.selected:hover {
        background: #312e81;
    }
    
    .champion-name {
        color: #e5e7eb;
    }
    
    .champion-avatar::after {
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    }
    
    .champion-item.selected .champion-avatar img {
        border-color: #818cf8;
        box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.5);
    }
    
    .champion-item.selected .champion-avatar::before {
        background-color: #818cf8;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }
    
    /* Estilos para botões no dark mode */
    .modal-btn-primary {
        background-color: #4f46e5;
    }
    
    .modal-btn-primary:hover {
        background-color: #4338ca;
    }
    
    .modal-btn-primary:active {
        background-color: #3730a3;
    }
    
    .modal-btn-secondary {
        background-color: #374151;
        color: #f3f4f6;
        border-color: #4b5563;
    }
    
    .modal-btn-secondary:hover {
        background-color: #4b5563;
        border-color: #6b7280;
    }
    
    .modal-btn-secondary:active {
        background-color: #374151;
    }
    
    .modal-btn-danger {
        background-color: #ef4444;
    }
    
    .modal-btn-danger:hover {
        background-color: #dc2626;
    }
    
    .modal-btn-danger:active {
        background-color: #b91c1c;
    }
    
    .modal-footer {
        background: #111827;
        border-top-color: #374151;
    }
}

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(10px); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.champion-item {
    animation: fadeIn 0.3s ease-out forwards;
    opacity: 0;
}

/* Atraso para o efeito de escada */
.champion-item:nth-child(1) { animation-delay: 0.05s; }
.champion-item:nth-child(2) { animation-delay: 0.1s; }
.champion-item:nth-child(3) { animation-delay: 0.15s; }
.champion-item:nth-child(4) { animation-delay: 0.2s; }
.champion-item:nth-child(5) { animation-delay: 0.25s; }
.champion-item:nth-child(6) { animation-delay: 0.3s; }
.champion-item:nth-child(7) { animation-delay: 0.35s; }
.champion-item:nth-child(8) { animation-delay: 0.4s; }
.champion-item:nth-child(9) { animation-delay: 0.45s; }
.champion-item:nth-child(10) { animation-delay: 0.5s; }

/* Grid de campeões */
#champions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 1rem;
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Mensagem de nenhum resultado */
.no-results {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: #6b7280;
}

.no-results i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results h4 {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: #374151;
}

.no-results p {
    margin: 0;
    font-size: 0.9375rem;
    max-width: 24rem;
}

/* Dark mode para mensagem de nenhum resultado */
@media (prefers-color-scheme: dark) {
    .no-results {
        color: #9ca3af;
    }
    
    .no-results h4 {
        color: #f3f4f6;
    }
    
    .no-results p {
        color: #d1d5db;
    }
}
/* Estilizando a barra de rolagem para WebKit (Chrome, Safari, Edge) */
#champions-grid::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#champions-grid::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

#champions-grid::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

#champions-grid::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

.champion-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    border: 1px solid #e5e7eb;
    text-align: center;
}

.champion-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #c7d2fe;
}

.champion-item.selected {
    background-color: #eef2ff;
    border-color: #818cf8;
    box-shadow: 0 0 0 2px #c7d2fe;
}

.champion-item img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    transition: all 0.2s ease;
}

.champion-item.selected img {
    border-color: #818cf8;
    transform: scale(1.05);
}

.champion-item span {
    font-size: 0.7rem;
    font-weight: 500;
    margin-top: 0.5rem;
    color: #374151;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    height: 2.4em;
}

/* Estilo para a barra de busca */
#champion-search {
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    width: 100%;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

#champion-search:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 2px #c7d2fe;
}

/* Estilo para o contador de selecionados */
#selected-count {
    font-size: 0.85rem;
    color: #4b5563;
    margin-bottom: 1rem;
}

/* Estilo para os botões do modal */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.modal-actions button {
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

#save-champions {
    background-color: #4f46e5;
    color: white;
    border: none;
}

#save-champions:hover {
    background-color: #4338ca;
}

#cancel-champions {
    background-color: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

#cancel-champions:hover {
    background-color: #e5e7eb;
}

/* Estilo para os campeões selecionados */
#selected-champions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    min-height: 2.5rem;
}

/* Responsividade */
@media (max-width: 640px) {
    #champions-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.75rem;
    }
    
    .champion-item {
        padding: 0.5rem 0.25rem;
    }
    
    .champion-item img {
        width: 40px;
        height: 40px;
    }
    
    .champion-item span {
        font-size: 0.65rem;
    }
}

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.champion-item {
    animation: fadeIn 0.2s ease-out forwards;
    opacity: 0;
}

/* Atraso para o efeito de escada */
.champion-item:nth-child(1) { animation-delay: 0.05s; }
.champion-item:nth-child(2) { animation-delay: 0.1s; }
.champion-item:nth-child(3) { animation-delay: 0.15s; }
.champion-item:nth-child(4) { animation-delay: 0.2s; }
.champion-item:nth-child(5) { animation-delay: 0.25s; }
.champion-item:nth-child(6) { animation-delay: 0.3s; }
.champion-item:nth-child(7) { animation-delay: 0.35s; }
.champion-item:nth-child(8) { animation-delay: 0.4s; }
.champion-item:nth-child(9) { animation-delay: 0.45s; }
.champion-item:nth-child(10) { animation-delay: 0.5s; }
