/**
 * BotWriter Settings Page Styles
 * 
 * @package BotWriter
 */

/* Save Status Indicator */
.botwriter-save-indicator {
    display: inline-block;
    margin-left: 15px;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    vertical-align: middle;
    transition: all 0.3s ease;
}
.botwriter-save-indicator.saving {
    background: #f0f6fc;
    color: #2271b1;
}
.botwriter-save-indicator.saving::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #2271b1;
    border-top-color: transparent;
    border-radius: 50%;
    margin-right: 6px;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}
.botwriter-save-indicator.saved {
    background: #d4edda;
    color: #155724;
}
.botwriter-save-indicator.saved::before {
    content: '✓';
    margin-right: 4px;
}
.botwriter-save-indicator.error {
    background: #f8d7da;
    color: #721c24;
}
.botwriter-save-indicator.error::before {
    content: '✕';
    margin-right: 4px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Main Tabs */
.botwriter-main-tabs {
    display: flex;
    border-bottom: 2px solid #2271b1;
    margin-bottom: 20px;
    background: #f6f7f7;
    padding: 0;
}
.botwriter-main-tabs .main-tab {
    padding: 15px 25px;
    cursor: pointer;
    border: none;
    background: transparent;
    text-decoration: none;
    color: #50575e;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.botwriter-main-tabs .main-tab:hover {
    background: #fff;
    color: #2271b1;
}
.botwriter-main-tabs .main-tab.main-tab-active {
    background: #fff;
    color: #2271b1;
    border-bottom: 2px solid #2271b1;
    margin-bottom: -2px;
}
.botwriter-main-tabs .main-tab .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.botwriter-main-tab-content {
    display: none;
    padding: 0;
}
.botwriter-main-tab-content.active {
    display: block;
}

/* Provider Selection Header */
.provider-selection-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 25px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #fff;
}
.provider-selection-header h3 {
    margin: 0 0 15px 0;
    color: #fff;
    font-size: 18px;
}
.provider-select {
    width: 100%;
    max-width: 350px;
    padding: 10px 15px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
}

/* Provider Content */
.provider-content {
    display: none;
}
.provider-content.active {
    display: block;
}

/* Provider Config Cards */
.provider-config-section {
    display: grid;
    gap: 20px;
}
.provider-config-card,
.provider-info-card,
.provider-pricing-card,
.provider-features-card,
.provider-links-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
}
.provider-config-card h4,
.provider-info-card h4,
.provider-pricing-card h4,
.provider-features-card h4,
.provider-links-card h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 15px;
    color: #1d2327;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* API Key Wrapper */
.api-key-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.api-key-wrapper input {
    flex: 1;
    max-width: 400px;
}

/* Test API Key Button */
.test-api-key {
    white-space: nowrap;
}
.test-api-key .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 4px;
    vertical-align: text-bottom;
}
.test-api-key.testing {
    opacity: 0.7;
    pointer-events: none;
}
.test-api-key .dashicons.spin {
    animation: spin 1s linear infinite;
}

/* Test API Result */
.test-api-result {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
}
.test-api-result:empty {
    display: none;
}
.test-api-result.success {
    background: #d4edda;
    color: #155724;
}
.test-api-result.error {
    background: #f8d7da;
    color: #721c24;
}
.test-api-result .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Model Select with Test Button */
.model-select-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.model-select-wrapper .model-select {
    flex: 0 1 400px;
    min-width: 200px;
}
.test-model {
    white-space: nowrap;
}
.test-model.testing {
    opacity: 0.7;
    pointer-events: none;
}
.test-model .dashicons.spin {
    animation: spin 1s linear infinite;
}

/* Test Model Result */
.test-model-result {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
    max-width: 100%;
    word-break: break-word;
}
.test-model-result:empty {
    display: none;
}
.test-model-result.success {
    background: #d4edda;
    color: #155724;
}
.test-model-result.error {
    background: #f8d7da;
    color: #721c24;
}
.test-model-result .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Form Rows */
.form-row {
    margin-bottom: 18px;
}
.form-row:last-child {
    margin-bottom: 0;
}
.form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #1d2327;
}
.form-row .description {
    margin-top: 6px;
    color: #757575;
    font-size: 12px;
}
.form-select {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
}

/* Setup Steps */
.setup-steps {
    padding-left: 20px;
    margin: 15px 0;
}
.setup-steps li {
    margin-bottom: 10px;
    color: #50575e;
}
.setup-steps a {
    color: #2271b1;
    font-weight: 500;
}

/* Info Tip */
.info-tip {
    background: #e7f5ff;
    border-left: 4px solid #2271b1;
    padding: 12px 15px;
    margin-top: 15px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border-radius: 0 4px 4px 0;
}
.info-tip .dashicons {
    color: #2271b1;
    margin-top: 2px;
}
.info-tip p {
    margin: 0;
    color: #1d2327;
}

/* Pricing Table */
.pricing-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}
.pricing-table th,
.pricing-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.pricing-table th {
    background: #f9f9f9;
    font-weight: 600;
    color: #1d2327;
}
.pricing-table code {
    background: #f0f0f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

/* Pricing Highlight */
.pricing-highlight {
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}
.free-credits-badge {
    background: #00a32a;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.pricing-highlight p {
    margin: 10px 0 0 0;
    color: #1d2327;
}

/* Cost Saving Tip */
.cost-saving-tip {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 0 4px 4px 0;
}
.cost-saving-tip .dashicons {
    color: #856404;
}

/* Features List */
.features-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.features-list li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #50575e;
}
.features-list .dashicons-yes-alt {
    color: #00a32a;
}

/* Pros/Cons */
.pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.pros h5, .cons h5 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #1d2327;
}
.pros ul, .cons ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.pros li, .cons li {
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.pros .dashicons-plus-alt2 {
    color: #00a32a;
}
.cons .dashicons-minus {
    color: #d63638;
}

/* Links Grid */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}
.link-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: #f9f9f9;
    border-radius: 6px;
    text-decoration: none;
    color: #2271b1;
    font-size: 13px;
    transition: all 0.2s ease;
}
.link-item:hover {
    background: #2271b1;
    color: #fff;
}
.link-item:hover .dashicons {
    color: #fff;
}

/* Image Settings Section */
.image-settings-section {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}
.section-title {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 15px;
    color: #1d2327;
    display: flex;
    align-items: center;
    gap: 8px;
}
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* General Settings */
.general-settings-section {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}
.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
    margin: 0;
}
.warning-option .warning-text {
    color: #d63638;
}
.input-with-suffix {
    display: flex;
    align-items: center;
    gap: 10px;
}
.small-input {
    width: 80px;
}
.suffix {
    color: #757575;
}

/* Submit Section */
.submit-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}
.button-large {
    padding: 8px 30px !important;
    font-size: 14px !important;
}

/* Highlight for text-rendering providers */
.highlight-text .text-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Image Settings Section - Enhanced */
.settings-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-bottom: 20px;
}
.setting-card {
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
}
.setting-card .form-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}
.setting-card .form-select {
    width: 100%;
    max-width: none;
    padding: 10px 14px;
    font-size: 13px;
}

/* Format Preview */
.format-preview {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    padding: 15px;
    background: #fff;
    border-radius: 6px;
}
.preview-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.3s ease;
}
.preview-box.landscape {
    width: 160px;
    height: 90px;
}
.preview-box.square {
    width: 100px;
    height: 100px;
}
.preview-box.portrait {
    width: 67px;
    height: 120px;
}

/* Specs Tables */
.format-specs, .quality-specs {
    margin-top: 15px;
}
.specs-table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
}
.specs-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
}
.specs-table td:first-child {
    color: #666;
    width: 40%;
}
.specs-table td:last-child {
    font-family: monospace;
    color: #2271b1;
    font-weight: 500;
}

/* Quality Indicator */
.quality-indicator {
    margin: 15px 0;
    padding: 15px;
    background: #fff;
    border-radius: 6px;
}
.quality-bar {
    height: 12px;
    background: linear-gradient(to right, #4CAF50, #FFEB3B, #FF5722);
    border-radius: 6px;
    position: relative;
}
.quality-bar .bar-fill {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 3px solid #333;
    border-radius: 50%;
    top: -4px;
    transition: left 0.3s ease;
}
.quality-bar.low .bar-fill { left: 10%; }
.quality-bar.medium .bar-fill { left: 45%; }
.quality-bar.high .bar-fill { left: 80%; }
.quality-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: #666;
}

/* Highlight Tip */
.info-tip.highlight-tip {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-left: 4px solid #ff9800;
    padding: 15px 20px;
}
.info-tip.highlight-tip .dashicons {
    color: #e65100;
    font-size: 24px;
    width: 24px;
    height: 24px;
}
.info-tip.highlight-tip p {
    margin: 0 0 5px 0;
}
.info-tip.highlight-tip p:last-child {
    margin: 0;
}

/* Cost Comparison */
.cost-comparison {
    margin-top: 20px;
    padding: 20px;
    background: #f0f6fc;
    border-radius: 8px;
    border: 1px solid #c3d9ed;
}
.cost-comparison h5 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #1d2327;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cost-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.cost-card {
    flex: 1;
    min-width: 100px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    position: relative;
}
.cost-card.cheapest {
    border-color: #00a32a;
    background: #f0fff4;
}
.cost-card .provider {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}
.cost-card .cost {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}
.cost-card .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #00a32a;
    color: #fff;
    font-size: 9px;
    padding: 3px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* SEO Tab */
.bw-seo-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.bw-seo-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
}

.bw-seo-status-pill.is-active {
    background: #e7f8ec;
    color: #0a6b2f;
    border: 1px solid #b9e8c7;
}

.bw-seo-status-pill.is-inactive {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #d1d5db;
}

.bw-seo-feature-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.bw-seo-feature-table th,
.bw-seo-feature-table td {
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    padding: 10px 8px;
    font-size: 13px;
    vertical-align: top;
}

.bw-seo-feature-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #4b5563;
}

.bw-seo-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
}

.bw-seo-badge.is-live {
    background: #dff7e5;
    color: #0f7a39;
}

.bw-seo-badge.is-planned {
    background: #eef2ff;
    color: #334155;
}

/* Responsive */
@media (max-width: 782px) {
    .botwriter-main-tabs {
        flex-direction: column;
    }
    .botwriter-main-tabs .main-tab {
        border-bottom: 1px solid #e5e5e5;
    }
    .botwriter-main-tabs .main-tab.main-tab-active {
        border-bottom: 1px solid #2271b1;
    }
    .pros-cons {
        grid-template-columns: 1fr;
    }
    .links-grid {
        grid-template-columns: 1fr;
    }
    .settings-grid-2col {
        grid-template-columns: 1fr;
    }
    .cost-cards {
        flex-direction: column;
    }
    .cost-card {
        min-width: auto;
    }

    .bw-seo-feature-table,
    .bw-seo-feature-table thead,
    .bw-seo-feature-table tbody,
    .bw-seo-feature-table tr,
    .bw-seo-feature-table th,
    .bw-seo-feature-table td {
        display: block;
        width: 100%;
    }

    .bw-seo-feature-table thead {
        display: none;
    }

    .bw-seo-feature-table tr {
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        margin-bottom: 10px;
        padding: 8px;
        background: #fff;
    }

    .bw-seo-feature-table td {
        border: none;
        padding: 6px 4px;
    }
}
/* Compression Slider - styled like quality bar */
.form-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 12px;
    background: linear-gradient(to right, #FF5722, #FFEB3B, #4CAF50);
    border-radius: 6px;
    outline: none;
    cursor: pointer;
}
.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: #fff;
    border: 3px solid #333;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}
.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}
.form-range::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: #fff;
    border: 3px solid #333;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}
.form-range::-moz-range-thumb:hover {
    transform: scale(1.1);
}
.form-range::-moz-range-track {
    height: 12px;
    background: linear-gradient(to right, #FF5722, #FFEB3B, #4CAF50);
    border-radius: 6px;
}
#compression_value {
    display: inline-block;
    min-width: 45px;
    padding: 4px 8px;
    background: #f0f0f1;
    border-radius: 4px;
    font-weight: 600;
    color: #2271b1;
    text-align: center;
    margin-left: 10px;
}