/* API Configuration - VERSÃO COMPACTA */
.api-config {
    background: var(--pure-black);
    border: 2px solid var(--primary-green);
    border-radius: 15px;
    backdrop-filter: blur(15px);
    box-shadow: var(--glow-green);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.api-config.compact {
    padding: 0;
}

/* Header compacto e clicável */
.api-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(0, 255, 0, 0.2);
}

.api-header:hover {
    background: rgba(0, 255, 0, 0.05);
}

.api-header h2 {
    color: var(--primary-green);
    text-shadow: var(--text-shadow-green);
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

#keysSummary {
    font-size: 0.85rem;
    color: var(--pure-white);
    text-shadow: var(--text-shadow-white);
    opacity: 0.8;
}

.expand-btn {
    background: none;
    border: 1px solid var(--primary-green);
    color: var(--primary-green);
    text-shadow: var(--text-shadow-green);
    border-radius: 4px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
}

.expand-btn:hover {
    background: rgba(0, 255, 0, 0.1);
    transform: scale(1.1);
}

.expand-btn.expanded {
    transform: rotate(180deg);
}

/* Conteúdo colapsável */
.api-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.api-content.collapsed {
    max-height: 0;
    opacity: 0;
}

.api-content:not(.collapsed) {
    max-height: 1000px;
    opacity: 1;
    padding: 0 20px 20px 20px;
}

.api-description {
    color: var(--pure-white);
    text-shadow: var(--text-shadow-white);
    margin-bottom: 15px;
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Sistema de Abas */
.api-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 15px;
    background: var(--black-30);
    border-radius: 8px;
    padding: 3px;
}

.api-tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--pure-white);
    text-shadow: var(--text-shadow-white);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-weight: 500;
}

.api-tab:hover {
    background: rgba(0, 255, 0, 0.1);
    color: var(--primary-green);
    text-shadow: var(--text-shadow-green);
}

.api-tab.active {
    background: var(--primary-green);
    color: var(--pure-black);
    text-shadow: none;
    font-weight: 600;
}

/* Conteúdo das abas */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Seção individual compacta */
.add-key-section.compact {
    margin-bottom: 0;
}

.key-input-row.compact {
    display: flex;
    gap: 8px;
    align-items: center;
}

.key-input-row.compact input#keyName {
    flex: 0 1 25%;
    padding: 8px 10px;
    font-size: 0.85rem;
}

.password-input {
    position: relative;
    flex: 1;
}

.password-input input {
    width: 100%;
    padding: 8px 35px 8px 10px;
    background: var(--input-bg);
    color: var(--pure-white);
    text-shadow: var(--text-shadow-white);
    border: 1px solid var(--primary-green);
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.add-key-btn.compact {
    padding: 8px 12px;
    background: var(--gradient-green);
    border: none;
    border-radius: 6px;
    color: var(--pure-black);
    text-shadow: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

/* Seção de múltiplas chaves */
.bulk-add-section {
    background: rgba(0, 255, 0, 0.03);
    border: 1px dashed var(--primary-green);
    border-radius: 8px;
    padding: 15px;
}

.bulk-label {
    display: block;
    color: var(--pure-white);
    text-shadow: var(--text-shadow-white);
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.bulk-textarea {
    width: 100%;
    padding: 10px;
    background: var(--input-bg);
    border: 1px solid var(--primary-green);
    border-radius: 6px;
    color: var(--pure-white);
    text-shadow: var(--text-shadow-white);
    font-size: 0.85rem;
    font-family: monospace;
    resize: vertical;
    min-height: 80px;
    line-height: 1.4;
}

.bulk-textarea:focus {
    outline: none;
    border-color: var(--green-light);
    box-shadow: 0 0 8px var(--green-glow);
}

.bulk-textarea::placeholder {
    color: var(--gray-medium);
    text-shadow: var(--text-shadow-black-blur);
    font-family: inherit;
}

.bulk-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.bulk-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.bulk-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--pure-white);
    text-shadow: var(--text-shadow-white);
    font-size: 0.8rem;
    user-select: none;
}

.bulk-option input[type="checkbox"] {
    display: none;
}

.bulk-option .checkmark {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 14px;
    background: var(--input-bg);
    border: 1px solid var(--primary-green);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.bulk-option .checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 3px;
    top: 1px;
    width: 4px;
    height: 7px;
    border: solid var(--primary-green);
    border-width: 0 1px 1px 0;
    transform: rotate(45deg);
}

.bulk-option input[type="checkbox"]:checked + .checkmark {
    background: var(--pure-black);
    border-color: var(--primary-green);
}

.bulk-option input[type="checkbox"]:checked + .checkmark::after {
    display: block;
}

.bulk-add-btn {
    padding: 10px 16px;
    background: var(--gradient-green);
    border: none;
    border-radius: 6px;
    color: var(--pure-black);
    text-shadow: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-black);
    white-space: nowrap;
}

.bulk-add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--green-glow);
}

.bulk-add-btn:disabled {
    background: var(--gray-dark);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Lista de chaves compacta */
.keys-list.compact {
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
}

.keys-list.compact::-webkit-scrollbar {
    width: 6px;
}

.keys-list.compact::-webkit-scrollbar-track {
    background: var(--black-30);
    border-radius: 3px;
}

.keys-list.compact::-webkit-scrollbar-thumb {
    background: var(--primary-green);
    border-radius: 3px;
}

/* Item de chave compacto */
.keys-list.compact .key-item {
    margin-bottom: 5px;
    padding: 8px 10px;
    border-radius: 4px;
    background: var(--card-bg);
    border-left: 3px solid var(--gray-dark);
    transition: all 0.2s ease;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(0, 255, 0, 0.1);
}

.keys-list.compact .key-item:last-child {
    border-bottom: none;
}

.keys-list.compact .key-item.active {
    border-left-color: var(--primary-green);
    background: rgba(0, 0, 0, 0.5);
}

.keys-list.compact .key-item:hover {
    background: rgba(0, 255, 0, 0.05);
    transform: translateX(2px);
}

/* Header da chave compacto */
.keys-list.compact .key-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.keys-list.compact .key-status {
    font-size: 0.9rem;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--black-30);
    flex-shrink: 0;
}

.keys-list.compact .key-name {
    font-weight: 600;
    color: var(--pure-white);
    text-shadow: var(--text-shadow-white);
    font-size: 0.85rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.keys-list.compact .key-item.active .key-name {
    color: var(--primary-green);
    text-shadow: var(--text-shadow-green);
}

/* Ações da chave compactas */
.keys-list.compact .key-actions {
    display: flex;
    gap: 3px;
    align-items: center;
}

.keys-list.compact .key-action-btn {
    background: var(--black-30);
    border: none;
    border-radius: 3px;
    color: var(--pure-white);
    text-shadow: var(--text-shadow-white);
    padding: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Detalhes ocultos por padrão */
.keys-list.compact .key-details {
    display: none;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 255, 0, 0.2);
    font-size: 0.7rem;
}

.keys-list.compact .key-item:hover .key-details {
    display: block;
}

/* Ações das chaves compactas */
.keys-actions.compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 6px 10px;
    background: var(--card-bg);
    border: 1px solid var(--gray-dark);
    border-radius: 4px;
    color: var(--pure-white);
    text-shadow: var(--text-shadow-white);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    font-weight: 500;
}

.action-btn.test:hover {
    border-color: var(--primary-green);
    color: var(--primary-green);
    text-shadow: var(--text-shadow-green);
}

.action-btn.clear:hover {
    border-color: var(--error-color);
    color: var(--error-color);
    text-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
}

.action-btn.refresh {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.action-btn.refresh:hover {
    border-color: var(--primary-green);
    color: var(--primary-green);
    text-shadow: var(--text-shadow-green);
    transform: rotate(180deg);
}

.keys-status {
    font-size: 0.75rem;
    color: var(--pure-white);
    text-shadow: var(--text-shadow-white);
    opacity: 0.8;
    flex: 1;
    text-align: right;
    min-width: 120px;
}

/* Responsividade */
@media (max-width: 768px) {
    .api-header {
        padding: 12px 15px;
    }
    
    .api-content:not(.collapsed) {
        padding: 0 15px 15px 15px;
    }
    
    .api-tabs {
        flex-direction: column;
        gap: 2px;
    }
    
    .key-input-row.compact {
        flex-direction: column;
        gap: 8px;
    }
    
    .key-input-row.compact input#keyName,
    .password-input {
        flex: 1;
        width: 100%;
    }
    
    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .bulk-options {
        justify-content: center;
    }
    
    .keys-actions.compact {
        flex-direction: column;
        gap: 8px;
    }
    
    .keys-status {
        text-align: center;
        order: -1;
    }
}

/* Estado de carregamento */
.api-config.loading {
    opacity: 0.7;
    pointer-events: none;
}

.api-config.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 0, 0.1), transparent);
    animation: scan 2s linear infinite;
}

/* Aviso sobre onde obter chave API */
.api-key-notice {
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.2);
    animation: slideInDown 0.5s ease-out;
}

.notice-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.notice-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.notice-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.notice-text strong {
    font-size: 13px;
    font-weight: 600;
}

.api-link {
    color: #fff !important;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.api-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.notice-tip {
    font-size: 11px;
    opacity: 0.9;
    font-style: italic;
}

/* Link inline para quando não há chaves */
.no-keys-help {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
}

.inline-api-link {
    color: #4285f4 !important;
    text-decoration: none;
    font-weight: 500;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.inline-api-link:hover {
    background: rgba(66, 133, 244, 0.1);
    color: #1a73e8 !important;
}

/* Animação de entrada */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsividade */
@media (max-width: 768px) {
    .api-key-notice {
        padding: 10px 12px;
        margin-bottom: 12px;
    }
    
    .notice-content {
        gap: 8px;
    }
    
    .notice-icon {
        font-size: 16px;
    }
    
    .notice-text strong {
        font-size: 12px;
    }
    
    .api-link {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .notice-tip {
        font-size: 10px;
    }
}

/* Estilos específicos para API paga do Gemini */
.gemini-notice {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #ffd700 100%);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.gemini-notice::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

/* Removido: estilos premium da aba múltiplas (agora é gratuita) */

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* Ícone premium apenas para Gemini individual (pago) */
.gemini-notice .notice-icon {
    font-size: 20px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Link premium apenas para API paga (individual) */
.gemini-notice .api-link {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.4);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.gemini-notice .api-link:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Dicas premium apenas para API paga (individual) */
.gemini-notice .notice-tip {
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 8px;
    border-radius: 8px;
    font-weight: 500;
    margin-top: 4px;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Link inline padrão para chaves gratuitas */
.inline-api-link {
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    color: white !important;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 6px rgba(66, 133, 244, 0.3);
}

.inline-api-link:hover {
    background: linear-gradient(135deg, #34a853 0%, #4285f4 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(66, 133, 244, 0.4);
}