/* Wisewand Plugin Admin Styles */

.wisewand-admin {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Dashboard Layout */
.wisewand-dashboard {
    margin-top: 20px;
}

.wisewand-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.wisewand-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.wisewand-card h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #1d2327;
    border-bottom: 1px solid #f0f0f1;
    padding-bottom: 10px;
}

/* Status Grid */
.wisewand-status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.wisewand-status-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
}

.wisewand-status-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
}

.wisewand-status-icon.success {
    background-color: #00a32a;
}

.wisewand-status-icon.error {
    background-color: #d63638;
}

.wisewand-status-label {
    font-size: 14px;
    color: #50575e;
}

/* Endpoints */
.wisewand-endpoints {
    space-y: 15px;
}

.wisewand-endpoint {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e2e4e7;
    border-radius: 4px;
}

.wisewand-endpoint strong {
    display: inline-block;
    width: 60px;
    color: #2271b1;
    font-family: monospace;
    font-size: 12px;
}

.wisewand-endpoint code {
    background: #fff;
    border: 1px solid #ddd;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    margin: 0 8px;
}

.wisewand-endpoint-desc {
    display: block;
    font-size: 12px;
    color: #646970;
    margin-top: 5px;
}

/* Actions */
.wisewand-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.wisewand-actions .button {
    min-width: 120px;
}

/* Info Table */
.wisewand-info-table {
    width: 100%;
    border-collapse: collapse;
}

.wisewand-info-table td {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f1;
    font-size: 14px;
}

.wisewand-info-table td:first-child {
    font-weight: 600;
    color: #1d2327;
    width: 40%;
}

.wisewand-info-table td:last-child {
    color: #50575e;
}

/* Plugin Badges */
.wisewand-plugin-badge {
    display: inline-block;
    background: #2271b1;
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    margin-right: 5px;
    margin-bottom: 3px;
}

/* Form Sections */
.wisewand-form-section {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    margin-bottom: 20px;
    padding: 20px;
}

.wisewand-form-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #1d2327;
    border-bottom: 1px solid #f0f0f1;
    padding-bottom: 10px;
}

.wisewand-form-section .form-table {
    margin: 0;
}

.wisewand-form-section .form-table th {
    width: 200px;
    padding: 15px 10px 15px 0;
    vertical-align: top;
}

.wisewand-form-section .form-table td {
    padding: 15px 0;
}

/* Notices */
.wisewand-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 12px;
    color: #856404;
    font-size: 14px;
}

/* SEO Plugin Detection */
.wisewand-seo-plugins {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wisewand-plugin-detected {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #e8f5e8;
    border: 1px solid #c3e6c3;
    border-radius: 4px;
}

.wisewand-plugin-icon {
    width: 20px;
    height: 20px;
    background: #00a32a;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 12px;
    font-weight: bold;
}

.wisewand-plugin-version {
    margin-left: auto;
    font-size: 12px;
    color: #646970;
}

/* SEO Meta Mapping Table */
.wisewand-seo-mapping {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.wisewand-seo-mapping th,
.wisewand-seo-mapping td {
    padding: 10px;
    border: 1px solid #c3c4c7;
    text-align: left;
}

.wisewand-seo-mapping th {
    background: #f6f7f7;
    font-weight: 600;
}

.wisewand-seo-mapping input[type="text"] {
    width: 100%;
    max-width: 300px;
}

/* Loading States */
.wisewand-loading {
    opacity: 0.6;
    pointer-events: none;
}

.wisewand-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: wisewand-spin 1s linear infinite;
    margin-right: 8px;
}

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

/* Success/Error Messages */
.wisewand-message {
    padding: 10px 15px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

.wisewand-message.success {
    background: #d1f2eb;
    border: 1px solid #a3e4d7;
    color: #00695c;
}

.wisewand-message.error {
    background: #fadbd8;
    border: 1px solid #f1948a;
    color: #c0392b;
}

/* Pull Article Interface */
.wisewand-pull-form {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.wisewand-pull-form .form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.wisewand-pull-form input[type="text"] {
    flex: 1;
    max-width: 400px;
}

.wisewand-pull-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    display: none;
}

.wisewand-pull-status.pending {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.wisewand-pull-status.success {
    background: #d1f2eb;
    border: 1px solid #a3e4d7;
    color: #00695c;
}

.wisewand-pull-status.error {
    background: #fadbd8;
    border: 1px solid #f1948a;
    color: #c0392b;
}

/* Logs Interface */
.wisewand-logs-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
}

.wisewand-logs-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.wisewand-logs-actions {
    display: flex;
    gap: 10px;
}

.wisewand-logs-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
}

.wisewand-logs-table th,
.wisewand-logs-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f1;
    text-align: left;
}

.wisewand-logs-table th {
    background: #f6f7f7;
    font-weight: 600;
    color: #1d2327;
}

.wisewand-logs-table .log-level {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.wisewand-logs-table .log-level.info {
    background: #e3f2fd;
    color: #1976d2;
}

.wisewand-logs-table .log-level.warning {
    background: #fff3e0;
    color: #f57c00;
}

.wisewand-logs-table .log-level.error {
    background: #ffebee;
    color: #d32f2f;
}

.wisewand-logs-table .log-level.debug {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wisewand-cards {
        grid-template-columns: 1fr;
    }

    .wisewand-status-grid {
        grid-template-columns: 1fr;
    }

    .wisewand-actions {
        flex-direction: column;
    }

    .wisewand-logs-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .wisewand-logs-filters,
    .wisewand-logs-actions {
        justify-content: center;
    }
}

/* Accessibility */
.wisewand-admin .screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.wisewand-admin button:focus,
.wisewand-admin input:focus,
.wisewand-admin select:focus,
.wisewand-admin textarea:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Simplified Wisewand Articles Interface */
.wisewand-articles .tablenav {
    background: transparent;
    padding: 0;
    margin: 12px 0;
}

.wisewand-articles .tablenav .actions {
    padding: 0;
}

.wisewand-articles .tablenav form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

/* Clean status badges */
.wisewand-articles .status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Language badges */
.wisewand-articles .language-badge {
    display: inline-block;
    font-family: monospace;
    font-size: 12px;
    font-weight: 600;
    color: #2271b1;
    background: #f0f6fc;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #c9e4f6;
}

/* Row actions styling */
.wisewand-articles .row-actions {
    margin-top: 8px;
}

.wisewand-articles .row-actions span {
    margin-right: 10px;
}

.wisewand-articles .row-actions a {
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
}

.wisewand-articles .row-actions a:hover {
    color: #135e96;
}

/* Import success state */
.wisewand-articles tr.import-success {
    background-color: #f0f9f0;
}

.wisewand-articles tr.import-success .row-title {
    color: #00a32a;
}

/* Import column styling */
.wisewand-articles .column-import {
    width: 120px;
    text-align: center;
}

.wisewand-articles .import-actions {
    display: flex;
    justify-content: center;
    align-items: center;
}

.wisewand-articles .generating-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #dba617;
    font-size: 12px;
}

/* Language column styling */
.wisewand-articles .column-language {
    width: 120px;
}

/* Post Type column styling */
.wisewand-articles .column-post-type {
    width: 140px;
}

.wisewand-articles .post-type-select {
    width: 100%;
    font-size: 12px;
    margin-bottom: 2px;
}

.wisewand-articles .post-type-extra-controls select {
    width: 100%;
    font-size: 11px;
    margin-top: 4px;
}

.wisewand-articles .post-type-selector small {
    display: block;
    line-height: 1.2;
    margin-top: 2px;
}

.wisewand-articles .language-selector select {
    width: 100%;
    font-size: 12px;
    margin-bottom: 4px;
}

.wisewand-articles .language-selector small {
    display: block;
    line-height: 1.2;
}

/* Publish State column styling */
.wisewand-articles .column-publish-state {
    width: 100px;
}

.wisewand-articles .publish-state-select {
    width: 100%;
    font-size: 12px;
}

.wisewand-articles .publish-state-selector small {
    display: block;
    line-height: 1.2;
    margin-top: 2px;
}

/* Publish Date column styling */
.wisewand-articles .column-publish-date {
    width: 160px;
}

.wisewand-articles .publish-date-input {
    width: 100%;
    font-size: 11px;
    padding: 2px 4px;
}

.wisewand-articles .publish-date-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.wisewand-articles .publish-date-actions .button-link {
    font-size: 11px;
    padding: 0;
    text-decoration: none;
    color: #2271b1;
}

.wisewand-articles .publish-date-actions .button-link:hover {
    color: #135e96;
    text-decoration: underline;
}

/* Responsive improvements */
@media screen and (max-width: 1200px) {
    .wisewand-articles .column-publish-date {
        width: 140px;
    }

    .wisewand-articles .publish-date-input {
        font-size: 10px;
    }

    .wisewand-articles .publish-date-actions {
        flex-direction: column;
        gap: 2px;
    }
}

@media screen and (max-width: 782px) {
    .wisewand-articles .tablenav form {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .wisewand-articles .column-primary {
        width: auto;
    }

    /* Stack publish controls on mobile */
    .wisewand-articles .column-publish-state,
    .wisewand-articles .column-publish-date,
    .wisewand-articles .column-language {
        width: auto !important;
    }

    .wisewand-articles .publish-date-selector,
    .wisewand-articles .publish-state-selector,
    .wisewand-articles .language-selector {
        margin-bottom: 8px;
    }
}

.wisewand-filters-row {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.wisewand-filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.wisewand-filter-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #1d2327;
}

.wisewand-filter-actions {
    display: flex;
    gap: 10px;
    align-items: end;
}

.wisewand-articles-table-wrapper {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    margin-bottom: 20px;
}

.wisewand-articles-table-wrapper .wp-list-table {
    border: none;
    box-shadow: none;
}

.wisewand-article-row.status-success {
    background-color: #f0f9f0;
}

.wisewand-article-row.status-error {
    background-color: #fdf2f2;
}

.wisewand-article-row.status-running {
    background-color: #fff9e6;
}

.wisewand-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.wisewand-status.status-success {
    background: #d1f2eb;
    color: #00695c;
}

.wisewand-status.status-error {
    background: #fadbd8;
    color: #c0392b;
}

.wisewand-status.status-running {
    background: #fff3cd;
    color: #856404;
}

.wisewand-status.status-queued {
    background: #e3f2fd;
    color: #1976d2;
}

.wisewand-feature-badge {
    display: inline-block;
    background: #f1f3f4;
    color: #5f6368;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-right: 3px;
    margin-bottom: 2px;
}

.wisewand-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wisewand-actions .button {
    margin: 0;
}

.wisewand-error-message {
    color: #d32f2f;
    font-style: italic;
}

.wisewand-keyword {
    color: #646970;
    font-weight: normal;
}

.wisewand-subject {
    max-width: 200px;
    word-wrap: break-word;
}

.wisewand-features {
    max-width: 150px;
}

/* Unified Settings Page */
.wisewand-unified-settings .wisewand-settings-section {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    margin-bottom: 20px;
    padding: 20px;
}

.wisewand-unified-settings .wisewand-settings-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f1;
    color: #1d2327;
}

.wisewand-unified-settings .wisewand-settings-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Enhanced status badges for plugin detection */
.wisewand-status-badge.wisewand-status-info {
    background: #72aee6;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.wisewand-status-badge + small {
    margin-left: 8px;
    color: #646970;
    font-style: italic;
}

/* SEO Intelligence Error States */
.seo-error {
    background: #fdf2f2;
    border: 1px solid #f1948a;
    color: #c0392b;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
}

.seo-loading {
    text-align: center;
    padding: 20px;
    color: #646970;
}

.seo-loading .spinner {
    float: none;
    margin-right: 8px;
}

/* API Settings */
.wisewand-api-settings .wisewand-api-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.wisewand-key-info {
    margin-top: 5px;
    color: #646970;
}

.wisewand-key-info code {
    background: #f6f7f7;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 11px;
}

.wisewand-status-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.wisewand-status-badge.wisewand-status-success {
    background: #d1f2eb;
    color: #00695c;
}

.wisewand-status-badge.wisewand-status-warning {
    background: #fff3cd;
    color: #856404;
}

.wisewand-status-badge.wisewand-status-error {
    background: #fadbd8;
    color: #c0392b;
}

.wisewand-api-info {
    background: #f8f9fa;
    border: 1px solid #e2e4e7;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
}

.wisewand-api-info p {
    margin: 5px 0;
}

.wisewand-error {
    color: #d32f2f;
    font-weight: 500;
}

/* Pagination */
.wisewand-pagination {
    text-align: center;
    padding: 20px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-top: none;
    border-radius: 0 0 4px 4px;
}

.wisewand-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    text-decoration: none;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    color: #0073aa;
}

.wisewand-pagination .page-numbers:hover {
    background: #f6f7f7;
}

.wisewand-pagination .page-numbers.current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* No articles state */
.no-articles {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
    font-style: italic;
}

/* Dark mode support (WordPress 5.7+) */
@media (prefers-color-scheme: dark) {
    .wisewand-card {
        background: #1d2327;
        border-color: #3c434a;
        color: #f0f0f1;
    }

    .wisewand-card h2 {
        color: #f0f0f1;
        border-color: #3c434a;
    }

    .wisewand-endpoint {
        background: #2c3338;
        border-color: #3c434a;
    }

    .wisewand-endpoint code {
        background: #1d2327;
        border-color: #3c434a;
        color: #f0f0f1;
    }

    .wisewand-form-section {
        background: #1d2327;
        border-color: #3c434a;
        color: #f0f0f1;
    }

    .wisewand-form-section h2 {
        color: #f0f0f1;
        border-color: #3c434a;
    }

    .wisewand-filters {
        background: #1d2327;
        border-color: #3c434a;
        color: #f0f0f1;
    }

    .wisewand-articles-table-wrapper {
        background: #1d2327;
        border-color: #3c434a;
    }

    .wisewand-api-info {
        background: #2c3338;
        border-color: #3c434a;
        color: #f0f0f1;
    }
}