/**
 * API Keys Widget Styles
 */

.pfc-api-keys-widget {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.pfc-api-keys-widget h2 {
    margin-bottom: 10px;
    font-size: 24px;
    font-weight: 600;
}

.pfc-api-keys-description {
    margin-bottom: 30px;
    color: #666;
    font-size: 14px;
}

.pfc-api-keys-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.pfc-api-keys-container {
    display: grid;
    gap: 20px;
}

.pfc-api-key-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}

.pfc-api-key-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.pfc-api-key-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.pfc-api-key-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.pfc-api-key-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.pfc-api-key-status[data-status="valid"] {
    background: #d4edda;
    color: #155724;
}

.pfc-api-key-status[data-status="invalid"] {
    background: #f8d7da;
    color: #721c24;
}

.pfc-api-key-status[data-status="missing"] {
    background: #fff3cd;
    color: #856404;
}

.pfc-api-key-status[data-status="unknown"] {
    background: #e2e3e5;
    color: #383d41;
}

.status-icon {
    font-size: 14px;
}

.pfc-api-key-desc {
    margin-bottom: 15px;
    font-size: 13px;
    color: #666;
    line-height: 1.6;
}

.pfc-api-key-desc a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.pfc-api-key-desc a:hover {
    text-decoration: underline;
}

.pfc-api-key-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.pfc-api-key-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: monospace;
    transition: border-color 0.2s;
}

.pfc-api-key-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.pfc-api-key-input.has-value {
    background-color: #f0f8ff;
}

.pfc-api-key-save-btn,
.pfc-api-key-test-btn,
.pfc-api-key-remove-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pfc-api-key-save-btn {
    background: #0073aa;
    color: #fff;
}

.pfc-api-key-save-btn:hover {
    background: #005a87;
}

.pfc-api-key-save-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.pfc-api-key-test-btn {
    background: #28a745;
    color: #fff;
}

.pfc-api-key-test-btn:hover {
    background: #218838;
}

.pfc-api-key-remove-btn {
    background: #dc3545;
    color: #fff;
}

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

.pfc-api-key-usage {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.pfc-api-key-usage small {
    color: #999;
    font-size: 12px;
}

.pfc-api-keys-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 15px;
    margin-top: 20px;
    color: #721c24;
}

.pfc-api-keys-error .error-message {
    margin: 0;
    font-size: 14px;
}

/* Loading spinner */
.pfc-api-key-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

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

/* Responsive */
/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .pfc-api-keys-widget {
        padding: 1.25rem;
    }

    .pfc-api-key-card {
        padding: 1rem;
    }

    .pfc-api-key-save-btn,
    .pfc-api-key-test-btn,
    .pfc-api-key-remove-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.95rem;
    }
}

/* Mobile (up to 767px) */
@media (max-width: 767px) {
    .pfc-api-keys-widget {
        padding: 1rem;
    }

    .pfc-api-key-card {
        padding: 0.875rem;
    }

    .pfc-api-key-input-group {
        flex-wrap: wrap;
    }

    .pfc-api-key-input {
        flex-basis: 100%;
        font-size: 16px; /* Prevent iOS zoom */
    }

    .pfc-api-key-save-btn,
    .pfc-api-key-test-btn,
    .pfc-api-key-remove-btn {
        flex: 1;
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-height: 44px; /* Touch target */
    }

    .pfc-api-key-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .pfc-api-key-actions button {
        width: 100%;
    }
}

/* Extra Small (up to 480px) */
@media (max-width: 480px) {
    .pfc-api-keys-widget {
        padding: 0.75rem;
    }

    .pfc-api-key-card {
        padding: 0.75rem;
    }

    .pfc-api-key-save-btn,
    .pfc-api-key-test-btn,
    .pfc-api-key-remove-btn {
        padding: 0.875rem 1rem;
        min-height: 48px;
    }
}
