/* AI Magic Modern Settings Page Styles */

.ai-magic-modern-settings {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Header */
/* Header */
.ai-magic-settings-header-minimal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 10px 20px !important;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 32px;
    background: white;
    z-index: 100;
    margin-right: 20px;
    margin-left: 20px;
    margin-top: -20px;

    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content h1 {
    margin: 0 0 6px 0;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    /* Darker gray for modern feel */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    letter-spacing: -0.025em;
}

.header-content p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* Save Button modernized */
.ai-magic-btn-save {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ai-magic-btn-save:hover {
    background: #135e96;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.ai-magic-btn-save:active {
    transform: translateY(0);
}

.ai-magic-btn-save .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    /* Optical alignment */
}

/* Buttons */
.ai-magic-btn-primary {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.ai-magic-btn-primary:hover {
    background: #135e96;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ai-magic-btn-primary .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Sections */
.ai-magic-settings-section {
    margin-bottom: 40px;
    padding: 0 20px;
}

.ai-magic-section-header {
    margin-bottom: 20px;
}

.ai-magic-section-header h2 {
    margin: 0 0 6px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.ai-magic-section-header p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* Cards */
.ai-magic-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Form Groups */
.ai-magic-form-group {
    margin-bottom: 24px;
}

.ai-magic-form-group:last-child {
    margin-bottom: 0;
}

.ai-magic-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.ai-magic-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.ai-magic-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.ai-magic-form-group small {
    display: block;
    margin-top: 6px;
    color: #6b7280;
    font-size: 13px;
}

.ai-magic-form-group small a {
    color: #2271b1;
    text-decoration: none;
}

.ai-magic-form-group small a:hover {
    text-decoration: underline;
}

/* Provider Cards */
.ai-magic-providers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 1200px) {
    .ai-magic-providers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .ai-magic-providers-grid {
        grid-template-columns: 1fr;
    }
}

.ai-magic-provider-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
}

.ai-magic-provider-card:hover {
    border-color: #2271b1;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.ai-magic-provider-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.ai-magic-provider-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f6fc;
}

.ai-magic-provider-header h3 {
    margin: 0 0 2px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.ai-magic-provider-header small {
    display: block;
    color: #6b7280;
    font-size: 12px;
}

.ai-magic-provider-card .ai-magic-input {
    margin-bottom: 8px;
}

.ai-magic-provider-card small {
    display: block;
    font-size: 12px;
}

.ai-magic-provider-card small a {
    color: #2271b1;
    text-decoration: none;
    font-weight: 600;
}

.ai-magic-provider-card small a:hover {
    text-decoration: underline;
}

/* Model Cards */
.ai-magic-model-category {
    margin-bottom: 24px;
}

.ai-magic-model-category h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.ai-magic-model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.ai-magic-model-card {
    position: relative;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: block;
}

.ai-magic-model-card:hover {
    border-color: #2271b1;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.ai-magic-model-card.selected {
    border-color: #2271b1;
    background: #f0f6fc;
}

.ai-magic-model-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.ai-magic-model-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.ai-magic-model-info h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
}

.ai-magic-model-info p {
    margin: 0 0 12px 0;
    color: #6b7280;
    font-size: 12px;
}

.ai-magic-model-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.ai-magic-model-stats .stat {
    text-align: center;
}

.ai-magic-model-stats .label {
    display: block;
    font-size: 10px;
    color: #9ca3af;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ai-magic-model-stats .value {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #1f2937;
}

.ai-magic-model-check {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2271b1;
    display: none;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.ai-magic-model-card.selected .ai-magic-model-check {
    display: flex;
}

.ai-magic-model-check .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Info Box */
.ai-magic-info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    margin-top: 16px;
    font-size: 13px;
    color: #1e40af;
}

.ai-magic-info-box .dashicons {
    flex-shrink: 0;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.ai-magic-info-box a {
    color: #1e40af;
    font-weight: 600;
    text-decoration: none;
}

.ai-magic-info-box a:hover {
    text-decoration: underline;
}

/* Option Grid */
.ai-magic-option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.ai-magic-option-card {
    position: relative;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-magic-option-card:hover {
    border-color: #2271b1;
}

.ai-magic-option-card.selected {
    border-color: #2271b1;
    background: #f0f6fc;
}

.ai-magic-option-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.ai-magic-option-card .option-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.ai-magic-option-card .option-name {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
}

.ai-magic-option-card small {
    display: block;
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

/* Footer */
.ai-magic-settings-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #e5e7eb;
}

/* Message */
#ai-magic-message {
    margin-bottom: 20px;
    margin-left: 20px;
    margin-right: 20px;
}

#ai-magic-message.success {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
    padding: 12px 16px;
    border-radius: 6px;
}

#ai-magic-message.error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 6px;
}

/* Spin animation for loading */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Toggle Switch */
.ai-magic-toggle {
    display: flex;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: #2271b1;
}

input:focus+.slider {
    box-shadow: 0 0 1px #2271b1;
}

input:checked+.slider:before {
    transform: translateX(16px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Provider Preferences */
.ai-magic-provider-card.active {
    border-color: #2271b1;
    background-color: #f0f6fc;
}

.ai-magic-provider-prefs {
    margin-top: 15px;
    padding-top: 5px;
}

.ai-magic-provider-prefs .ai-magic-form-group {
    margin-bottom: 12px;
}

.ai-magic-provider-prefs label {
    font-size: 12px;
    margin-bottom: 4px;
}

.ai-magic-provider-prefs select {
    width: 100%;
    font-size: 13px;
    padding: 6px 10px;
}

/* Test Result Container */
div[id^="ai-magic-test-result-"] {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
    /* Prevent overflow */
    display: none;
}

div[id^="ai-magic-test-result-"].success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

div[id^="ai-magic-test-result-"].error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Spinner for icon only */
.ai-magic-btn-test-icon .dashicons.spin {
    animation: spin 1s linear infinite;
}

/* Model Container Tab Switching */
.ai-magic-provider-models-container {
    display: none;
    animation: fadeIn 0.3s ease;
}

.ai-magic-provider-models-container.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}