/**
 * API Manager Specific Styles
 * Tabs styles are in tabs-common.css
 * This file only contains API key management specific styles
 */

/* API Keys Manager Container */
.aiautotool-provider-nav {
    margin: 20px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    max-width: 100%;
    overflow: visible;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 10px;
}

.aiautotool-provider-nav .aiautotool-tab-btn {
    width: 100%;
    min-height: 40px;
    justify-content: flex-start;
    gap: 8px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 5px;
    border-bottom: 1px solid #dcdcde;
    color: #2c3338;
    padding: 9px 12px;
    font-size: 13px;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.aiautotool-provider-nav .aiautotool-tab-btn:hover {
    background: #f0f6f2;
    border-color: #00875c;
    color: #00684a;
}

.aiautotool-provider-nav .aiautotool-tab-btn.active {
    background: #00875c;
    border-color: #00875c;
    color: #fff;
    box-shadow: none;
}

.aiautotool-provider-nav .aiautotool-tab-btn i {
    color: #646970;
}

.aiautotool-provider-nav .aiautotool-tab-btn:hover i {
    color: #00875c;
}

.aiautotool-provider-nav .aiautotool-tab-btn.active i {
    color: #fff;
}

.aiautotool-provider-nav .aiautotool-tab-btn span:not(.aiautotool-tab-badge) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aiautotool-provider-nav .aiautotool-tab-badge {
    background: #e7f5e7;
    color: #00684a;
    border: 1px solid #b8dfc3;
}

.aiautotool-provider-nav .aiautotool-tab-btn.active .aiautotool-tab-badge {
    background: #fff;
    color: #00875c;
    border-color: #fff;
}

.aiautotool-provider-routing {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
    max-width: 760px;
}

.aiautotool-provider-routing label {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    row-gap: 3px;
    align-items: start;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    background: #fff;
    padding: 12px;
}

.aiautotool-provider-routing input {
    margin-top: 2px;
}

.aiautotool-provider-routing strong {
    color: #1d2327;
    font-size: 13px;
}

.aiautotool-provider-routing span {
    grid-column: 2;
    color: #646970;
    font-size: 12px;
    line-height: 1.4;
}

.aiautotool-provider-groups {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 24px;
}

.aiautotool-provider-group {
    border: 1px solid #dcdcde;
    border-radius: 6px;
    background: #fff;
    padding: 16px;
}

.aiautotool-provider-group-free {
    border-top: 3px solid #00875c;
}

.aiautotool-provider-group-paid {
    border-top: 3px solid #50575e;
}

.aiautotool-provider-group-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.aiautotool-provider-group-header h4 {
    margin: 0;
    color: #1d2327;
    font-size: 15px;
    line-height: 1.3;
}

.aiautotool-provider-group-header h4 i {
    color: #00875c;
    margin-right: 6px;
}

.aiautotool-provider-group-paid .aiautotool-provider-group-header h4 i {
    color: #50575e;
}

.aiautotool-provider-group-header p {
    margin: 5px 0 0;
    color: #646970;
    font-size: 13px;
    line-height: 1.45;
}

.aiautotool-provider-group-count {
    border: 1px solid #b8dfc3;
    border-radius: 999px;
    background: #f0f6f2;
    color: #00684a;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    white-space: nowrap;
}

.aiautotool-provider-group-paid .aiautotool-provider-group-count {
    border-color: #dcdcde;
    background: #f6f7f7;
    color: #50575e;
}

.aiautotool-provider-catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 0;
}

.aiautotool-provider-card {
    border: 1px solid #dcdcde;
    border-radius: 6px;
    background: #fff;
    padding: 14px;
}

.aiautotool-provider-card.is-configured {
    border-left: 4px solid #008a20;
    background: #fbfffc;
}

.aiautotool-provider-card.is-not-configured {
    border-left: 4px solid #dcdcde;
}

.aiautotool-provider-card-main,
.aiautotool-provider-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.aiautotool-provider-status {
    border-radius: 999px;
    padding: 3px 8px;
    background: #f0f0f1;
    color: #50575e;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.aiautotool-provider-card.is-configured .aiautotool-provider-status {
    background: #edfaef;
    color: #008a20;
}

.aiautotool-provider-meta {
    margin-top: 10px;
    color: #646970;
    font-size: 12px;
}

.aiautotool-provider-best-for {
    margin-top: 10px;
    color: #2c3338;
    font-size: 13px;
    line-height: 1.4;
}

.api-keys-manager {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
}

/* Keys List */
.api-keys-list {
    margin: 20px 0;
}

/* API Key Item */
.api-key-item {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.api-key-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #2271b1;
}

.api-key-item.disabled {
    opacity: 0.6;
    background: #f0f0f0;
}

/* API Key Info */
.api-key-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.api-key-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.api-key-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.api-key-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.api-key-status-badge.active {
    background: #d4edda;
    color: #155724;
}

.api-key-status-badge.disabled {
    background: #f8d7da;
    color: #721c24;
}

.api-key-value {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #666;
    background: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    display: inline-block;
}

/* API Key Stats */
.api-key-stats {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.api-key-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.api-key-stat i {
    color: #2271b1;
}

/* API Key Actions */
.api-key-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.api-key-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.api-key-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-test {
    background: #2271b1;
    color: white;
}

.btn-test:hover {
    background: #135e96;
}

.btn-toggle {
    background: #f0f0f0;
    color: #333;
}

.btn-toggle:hover {
    background: #e0e0e0;
}

.btn-remove {
    background: #dc3545;
    color: white;
}

.btn-remove:hover {
    background: #c82333;
}

/* Add Key Form */
.add-key-form {
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.add-key-form h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: flex-end;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.form-group input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.btn-add-key {
    background: #00875c;
    color: white;
    padding: 9px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-add-key:hover {
    background: #00684a;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-add-key:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Rotation Info */
.rotation-info {
    background: #e7f3ff;
    border-left: 4px solid #2271b1;
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.rotation-info p {
    margin: 0;
    font-size: 13px;
    color: #333;
}

.rotation-info strong {
    color: #2271b1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 15px;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .aiautotool-provider-group-header {
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }
    
    .api-key-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .api-key-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .api-key-stats {
        flex-direction: column;
        gap: 8px;
    }
}
