/**
 * Enhanced Admin styles for Content Performance Analyzer with Content Analysis
 *
 * @package ContentPerformanceAnalyzer
 * @since 1.0.0
 */

/* General Styles */

/* Search Box Styles */
.cpanalyzer-search-box {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
}

.cpanalyzer-search-box form div {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cpanalyzer-search-box label {
    min-width: 120px;
    font-weight: 600;
    color: #1d2327;
}

.cpanalyzer-search-box input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 6px 10px;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    font-size: 14px;
}

.cpanalyzer-search-box input[type="text"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.cpanalyzer-search-box .button {
    height: auto;
    padding: 6px 12px;
    font-size: 14px;
}

/* Responsive search box */
@media (max-width: 768px) {
    .cpanalyzer-search-box form div {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cpanalyzer-search-box label {
        min-width: auto;
    }
    
    .cpanalyzer-search-box input[type="text"] {
        min-width: auto;
    }
}

.cpanalyzer-legend {
    margin: 15px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.cpanalyzer-legend p {
    margin: 0 0 10px 0;
}

.cpanalyzer-legend-item {
    display: inline-block;
    margin-right: 20px;
    padding: 5px 10px;
    background: #fff;
    border-radius: 3px;
    font-size: 13px;
    cursor: help;
    font-weight: 500;
    border: 1px solid #ccd0d4;
    color: #000;
}

.cpanalyzer-legend-item:hover {
    background: #f0f0f1;
}

/* Content Analysis Summary */
.cpanalyzer-content-summary {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.cpanalyzer-content-summary h3 {
    margin-top: 0;
    color: #1d2327;
    font-size: 18px;
}

.cpanalyzer-content-summary ul {
    margin: 10px 0;
    padding-left: 20px;
}

.cpanalyzer-content-summary li {
    margin-bottom: 5px;
    font-size: 14px;
}

/* Enhanced Table Styles */
#cpanalyzer-insights-table {
    margin-top: 20px;
    border-collapse: collapse;
    font-size: 13px;
}

#cpanalyzer-insights-table th {
    background: #f6f7f7;
    cursor: pointer;
    padding: 12px 6px;
    font-weight: 600;
    position: relative;
    user-select: none;
    text-align: center;
    min-width: 80px;
}

#cpanalyzer-insights-table th:first-child,
#cpanalyzer-insights-table th:nth-child(2),
#cpanalyzer-insights-table th:nth-child(3) {
    text-align: left;
    min-width: 120px;
}

#cpanalyzer-insights-table th:hover {
    background: #e8e8e8;
}

#cpanalyzer-insights-table th.sort-asc::after {
    content: " ↑";
    color: #0073aa;
}

#cpanalyzer-insights-table th.sort-desc::after {
    content: " ↓";
    color: #0073aa;
}

#cpanalyzer-insights-table td {
    padding: 10px 6px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f1;
}

#cpanalyzer-insights-table td:first-child,
#cpanalyzer-insights-table td:nth-child(2),
#cpanalyzer-insights-table td:nth-child(3) {
    text-align: left;
}

.hidden-cpa-row,
.cpanalyzer-hidden-row {
    display: none !important;
}

.cpanalyzer-row {
    transition: all 0.3s ease;
}

.cpanalyzer-row:hover {
    background-color: #f6f7f7;
}

/* Priority Indicators */
.cpanalyzer-priority-high {
    color: #d63638;
    font-weight: bold;
}

.cpanalyzer-priority-medium {
    color: #dba617;
    font-weight: bold;
}

.cpanalyzer-priority-low {
    color: #00a32a;
    font-weight: bold;
}

/* Content Issues Column */
.cpanalyzer-content-issues {
    font-size: 11px;
    color: #666;
    max-width: 120px;
    word-wrap: break-word;
}

.cpanalyzer-content-issues:hover {
    color: #333;
}

/* Enhanced Flag Colors */
.cpanalyzer-flag-decay {
    color: #d63638;
    font-weight: 600;
}

.cpanalyzer-flag-seo {
    color: #dba617;
    font-weight: 600;
}

.cpanalyzer-flag-conversion {
    color: #00a32a;
    font-weight: 600;
}

.cpanalyzer-flag-content-analyzed {
    color: #0073aa;
    font-size: 12px;
}

/* Keyword Suggestions */
.cpanalyzer-keyword-primary {
    font-weight: 600;
    color: #0073aa;
}

.cpanalyzer-keyword-suggested {
    font-size: 11px;
    color: #666;
    font-style: italic;
}

/* Performance Indicators */
.cpanalyzer-performance-good {
    color: #00a32a;
}

.cpanalyzer-performance-warning {
    color: #dba617;
}

.cpanalyzer-performance-poor {
    color: #d63638;
}

/* Content Analysis Badges */
.cpanalyzer-content-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 3px;
    margin-right: 4px;
    font-weight: 500;
}

.cpanalyzer-content-badge-error {
    background: #d63638;
    color: #fff;
}

.cpanalyzer-content-badge-warning {
    background: #dba617;
    color: #fff;
}

.cpanalyzer-content-badge-success {
    background: #00a32a;
    color: #fff;
}

.cpanalyzer-content-badge-info {
    background: #0073aa;
    color: #fff;
}

/* Pagination */
.cpanalyzer-pagination {
    margin: 20px 0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.cpanalyzer-pagination .button,
.cpanalyzer-pagination button {
    margin-right: 10px;
}

/* Export Actions */
.cpanalyzer-export-actions {
    margin: 15px 0;
    text-align: right;
}

#cpanalyzer-export-csv {
    background: #00a32a;
    border-color: #00a32a;
    color: #fff;
}

#cpanalyzer-export-csv:hover {
    background: #008a20;
    border-color: #008a20;
}

.cpanalyzer-export {
    display: flex;
    gap: 10px;
}

.cpanalyzer-export button {
    margin: 0;
}

/* Actions */
.cpanalyzer-actions,
.cpanalyzer-actions-top {
    margin: 20px 0;
    padding: 15px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
}

.cpanalyzer-retry-button {
    background: #e0910a !important;
    border-color: #e0910a !important;
    color: #fff !important;
    margin-right: 15px;
}

.cpanalyzer-retry-button:hover {
    background: #c7820a !important;
    border-color: #c7820a !important;
}

.cpanalyzer-retry-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cpanalyzer-retry-message {
    margin-left: 10px;
    font-weight: bold;
    font-size: 14px;
}

/* Settings Page */
.form-table th {
    width: 200px;
}

.form-table input[type="text"],
.form-table input[type="password"] {
    width: 400px;
}

.cpanalyzer-settings-help {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.cpanalyzer-settings-help h2 {
    margin-top: 0;
    color: #1d2327;
}

.cpanalyzer-settings-help h3 {
    color: #1d2327;
    margin-top: 25px;
}

.cpanalyzer-settings-help ol {
    padding-left: 20px;
}

.cpanalyzer-settings-help li {
    margin-bottom: 8px;
}

.cpanalyzer-settings-help code {
    word-break: break-all;
    background: #f0f0f1;
    padding: 2px 5px;
    border-radius: 3px;
}

/* Field Validation */
.cpanalyzer-field-error {
    color: #d63638;
    font-size: 13px;
    margin-top: 5px;
    font-weight: 500;
    display: block;
}

/* Enhanced Tooltips */
.cpanalyzer-tooltip {
    position: absolute;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    max-width: 300px;
    z-index: 9999;
    display: none;
    word-wrap: break-word;
    line-height: 1.4;
}

.cpanalyzer-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid transparent;
    border-top-color: #333;
}

/* Status Messages */
.cpanalyzer-status-message {
    margin: 10px 0;
    padding: 10px 15px;
    border-left: 4px solid #0073aa;
    background: #f7f7f7;
}

.cpanalyzer-wrap .notice p,
.cpanalyzer-notice p {
    margin: 0.5em 0;
}

/* Content Analysis Progress */
.cpanalyzer-analysis-progress {
    margin: 15px 0;
    padding: 10px;
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
}

.cpanalyzer-analysis-progress .progress-bar {
    width: 100%;
    height: 20px;
    background: #f0f0f1;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.cpanalyzer-analysis-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #005a87);
    transition: width 0.3s ease;
}

/* Content Quality Indicators */
.cpanalyzer-quality-score {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 5px;
}

.cpanalyzer-quality-excellent {
    background: #00a32a;
    color: #fff;
}

.cpanalyzer-quality-good {
    background: #46b450;
    color: #fff;
}

.cpanalyzer-quality-fair {
    background: #dba617;
    color: #fff;
}

.cpanalyzer-quality-poor {
    background: #d63638;
    color: #fff;
}

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

/* Focus States */
.button:focus,
input:focus,
select:focus,
textarea:focus {
    box-shadow: 0 0 0 2px #0073aa;
    outline: none;
}

.button,
.button:hover {
    text-decoration: none;
}

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

.cpanalyzer-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: cpanalyzer-spin 1s linear infinite;
}

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

/* Content Analysis Cards */
.cpanalyzer-content-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.cpanalyzer-content-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cpanalyzer-content-card h4 {
    margin: 0 0 10px 0;
    color: #1d2327;
    font-size: 14px;
}

.cpanalyzer-content-card .metric {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    font-size: 13px;
}

.cpanalyzer-content-card .metric-value {
    font-weight: 600;
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
    .cpanalyzer-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .cpanalyzer-pagination,
    .cpanalyzer-export {
        justify-content: center;
    }

    #cpanalyzer-insights-table {
        font-size: 12px;
    }

    .cpanalyzer-content-cards {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 782px) {
    #cpanalyzer-insights-table {
        font-size: 11px;
    }

    #cpanalyzer-insights-table th,
    #cpanalyzer-insights-table td {
        padding: 6px 3px;
    }

    .cpanalyzer-legend-item {
        display: block;
        margin: 5px 0;
        text-align: center;
    }

    .form-table input[type="text"],
    .form-table input[type="password"] {
        width: 100%;
        max-width: 400px;
    }

    .cpanalyzer-pagination {
        flex-direction: column;
        gap: 8px;
    }

    .cpanalyzer-pagination button {
        width: 100%;
    }

    .cpanalyzer-content-summary {
        padding: 15px;
    }

    /* Hide less important columns on mobile */
    #cpanalyzer-insights-table th:nth-child(5),
    #cpanalyzer-insights-table td:nth-child(5),
    #cpanalyzer-insights-table th:nth-child(8),
    #cpanalyzer-insights-table td:nth-child(8) {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    /* Hide more columns on very small screens */
    #cpanalyzer-insights-table th:nth-child(9),
    #cpanalyzer-insights-table td:nth-child(9),
    #cpanalyzer-insights-table th:nth-child(10),
    #cpanalyzer-insights-table td:nth-child(10) {
        display: none;
    }
}

/* Print Styles */
@media print {
    .cpanalyzer-actions,
    .cpanalyzer-pagination,
    .button {
        display: none !important;
    }

    #cpanalyzer-insights-table th,
    #cpanalyzer-insights-table td {
        border: 1px solid #000;
        padding: 5px;
    }

    .cpanalyzer-content-summary {
        page-break-inside: avoid;
    }
}

/* Dark mode support (for future WordPress versions) */
@media (prefers-color-scheme: dark) {
    .cpanalyzer-legend {
        background: #2c3338;
        border-color: #50575e;
        color: #f0f0f1;
    }

    .cpanalyzer-content-summary {
        background: #2c3338;
        border-color: #50575e;
        color: #f0f0f1;
    }

    .cpanalyzer-content-card {
        background: #2c3338;
        border-color: #50575e;
        color: #f0f0f1;
    }
}

/* Freemium Quota Display Styles */
.cpanalyzer-quota-header {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0 20px 0;
}

.cpanalyzer-quota-status {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.cpanalyzer-quota-item {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #1d2327;
}

.cpanalyzer-quota-item.cpanalyzer-quota-warning {
    background: #fff3cd;
    border-color: #ffecb5;
    color: #856404;
}

.cpanalyzer-quota-item.cpanalyzer-quota-used {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Limit Information Styles */
.cpanalyzer-limit-info {
    background: #e7f3ff;
    border: 1px solid #b3d4fc;
    border-radius: 4px;
    padding: 12px;
    margin: 10px 0;
}

.cpanalyzer-limit-info.cpanalyzer-limit-approaching {
    background: #fff3cd;
    border-color: #ffecb5;
}

.cpanalyzer-limit-info.cpanalyzer-limit-reached {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.cpanalyzer-limit-info p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

/* Responsive quota display */
@media (max-width: 768px) {
    .cpanalyzer-quota-status {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .cpanalyzer-quota-item {
        justify-content: center;
    }
}
/* ── Page picker lists (settings: PageSpeed page selection) ── */
.cpanalyzer-site-pages-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
    padding: 8px 12px;
    margin: 8px 0 12px;
}
.cpanalyzer-page-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px;
    border-bottom: 1px solid #f0f0f1;
    cursor: pointer;
}
.cpanalyzer-page-row:last-child { border-bottom: none; }
.cpanalyzer-page-row:hover { background: #f6f7f7; }
.cpanalyzer-page-title { font-weight: 500; }
.cpanalyzer-page-path { color: #646970; font-size: 12px; }
