/* SyncRanker Admin General Styling */
.syncranker-seo-meta-box,
.syncranker-grid {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #202124;
}

/* Admin Settings Page */
.syncranker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 20px;
}
.syncranker-card {
    background: #fff;
    padding: 30px;
    border: 1px solid #ccd0d4;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,.05);
}
.syncranker-card h2 {
    font-size: 1.2em;
    margin-top: 0;
    padding-bottom: .5em;
    border-bottom: 1px solid #eee;
}
.form-table th {
    width: 200px;
}
.input-wrapper {
    position: relative;
}
.input-wrapper .toggle-visibility {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #666;
}
.api-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
}
.api-status-badge.ready {
    background-color: #dcfce7;
    color: #166534;
}
.api-status-badge.not-ready {
    background-color: #fee2e2;
    color: #991b1b;
}

/* SyncRanker SEO Meta Box Specific Styling */
.syncranker-seo-meta-box {
    margin: -6px -12px -12px;
    padding: 0;
}

.syncranker-seo-meta-box .field-group {
    margin: 0;
    padding: 16px 12px;
    border-bottom: 1px solid #eee;
}
.syncranker-seo-meta-box .field-group:last-child {
    border-bottom: none;
}

.syncranker-seo-meta-box .label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.syncranker-seo-meta-box .label-row-secondary {
    margin-top: 8px;
}

.syncranker-seo-meta-box label {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
}

.syncranker-seo-meta-box .widefat {
    width: 100%;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 0;
}
.syncranker-seo-meta-box .widefat:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}
.syncranker-seo-meta-box textarea.widefat {
    min-height: 100px;
    resize: vertical;
}
.syncranker-seo-meta-box textarea.schema-field {
    min-height: 140px;
    font-family: monospace;
    font-size: 13px;
    background: #f9f9f9;
}
.syncranker-seo-meta-box .description {
    margin: 8px 0 0;
    font-size: 12px;
    color: #646970;
}

/* Yoast Style Variable Pill Buttons Above Input */
.sr-variable-pills {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.sr-pill-btn {
    background: #f0f4ff !important;
    color: #3b82f6 !important;
    border: 1px solid #bfdbfe !important;
    border-radius: 6px !important;
    padding: 3px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

.sr-pill-btn:hover {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
}

/* Pixel-Perfect Overlay & Cursor Alignment Fix */
.sr-hybrid-input-wrapper {
    position: relative;
    width: 100%;
    min-height: 40px;
}

.sr-visual-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 12px !important;
    display: block !important;
    pointer-events: none !important;
    font-size: 14px !important;
    font-family: inherit !important;
    line-height: 1.4 !important;
    white-space: pre-wrap !important;
    z-index: 1;
    overflow: hidden;
    color: #202124;
}

.sr-hybrid-input {
    position: relative;
    z-index: 2;
    padding: 8px 12px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    line-height: 1.4 !important;
    background: transparent !important;
    color: transparent !important;
    caret-color: #111827 !important;
    letter-spacing: normal !important;
}

.sr-pill-tag {
    background: #e0e7ff !important;
    color: #3730a3 !important;
    border: 1px solid #c7d2fe !important;
    border-radius: 6px !important;
    padding: 1px 6px !important; /* Compact padding to match raw text vector width */
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    margin: 0 1px !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
}

/* Tagged Input Container (Pills Inside Box) */
.sr-tag-input-container {
    width: 100%;
    min-height: 40px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    padding: 6px 10px;
    background: #fff;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    cursor: text !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    box-sizing: border-box;
}

.sr-tag-input-container:focus,
.sr-tag-input-container:focus-within {
    border-color: #2271b1 !important;
    box-shadow: 0 0 0 1px #2271b1 !important;
}

/* Inline Pill Badges Inside Container */
.sr-pill-tag {
    background: #e0e7ff !important;
    color: #3730a3 !important;
    border: 1px solid #c7d2fe !important;
    border-radius: 6px !important;
    padding: 2px 8px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    display: inline-flex !important;
    align-items: center !important;
    cursor: default !important;
    margin: 0 2px !important;
    white-space: nowrap !important;
}

/* AI Button */
.syncranker-seo-meta-box .ai-button {
    background: #f8f4ff;
    border: 1px solid #d8b4fe;
    color: #5b21b6;
    border-radius: 999px;
    font-size: 12px;
    padding: 4px 12px;
    cursor: not-allowed;
    opacity: 0.8;
    font-weight: 500;
}

/* SERP Preview Wrapper */
.serp-preview-wrapper {
    background: #f0f0f1;
    padding: 12px;
    border-bottom: 1px solid #ddd;
}

.sr-tab-btn {
    background: #f3f4f6 !important; 
    border: 1px solid #d1d5db !important; 
    border-radius: 6px !important; 
    padding: 6px 14px !important; 
    cursor: pointer !important; 
    font-weight: 500 !important; 
    color: #374151 !important; 
    transition: all 0.2s ease !important;
}

.sr-tab-btn:hover {
    background: #e0e0e0 !important;
}

/* Active Golden/Amber Tab Highlight */
.sr-tab-btn.active {
    background: #fffbeb !important; 
    border: 2px solid #f59e0b !important; 
    color: #b45309 !important; 
    font-weight: bold !important; 
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.15) !important;
}

#sr-preview-card {
    line-height: 1.4;
    overflow: hidden;
    font-size: 14px;
}

/* Desktop Preview Box */
#sr-preview-card.sr-preview-desktop {
    max-width: 620px !important; 
    width: 100% !important; 
    margin-top: 12px !important; 
    border: 1px solid #dadce0 !important; 
    border-radius: 8px !important; 
    padding: 16px !important; 
    background: #fff !important; 
    transition: all 0.25s ease !important;
}

/* Mobile Frame Preview Box */
#sr-preview-card.sr-preview-mobile {
    max-width: 375px !important; 
    width: 100% !important; 
    margin: 12px auto 0 auto !important; 
    border: 2px solid #e5e7eb !important; 
    border-radius: 20px !important; 
    padding: 16px !important; 
    background: #fff !important; 
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1) !important; 
    transition: all 0.25s ease !important;
}

.serp-snippet .serp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.serp-snippet .serp-favicon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
}
.serp-snippet .serp-site-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.serp-snippet .serp-site-name {
    font-size: 14px;
    color: #202124;
}
.serp-snippet .serp-url {
    font-size: 12px;
    color: #4d5156;
}

.serp-snippet .serp-title {
    font-size: 20px;
    font-weight: 400;
    color: #1a0dab;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.serp-snippet .serp-desc {
    color: #4d5156;
    margin: 4px 0 0;
    line-height: 1.57;
    word-wrap: break-word;
}

/* Analysis Checklist (SERP Preview) */
.serp-analysis {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    font-size: 12px;
    color: #444;
}
.analysis-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.analysis-item .dashicons {
    font-size: 16px;
}
.analysis-item.valid {
    color: #006400;
}
.analysis-item.invalid {
    color: #d63638;
}

/* Character Counters & Progress Bars */
.char-counter-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}
.char-count {
    font-size: 12px;
    color: #50575e;
}
.char-warning-badge {
    background-color: #fee2e2;
    color: #991b1b;
    font-weight: bold;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
}
.progress-bar-container {
    height: 4px;
    background-color: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}
.progress-bar {
    height: 100%;
    width: 0;
    background-color: #4caf50;
    transition: width 0.2s ease-in-out;
    border-radius: 2px;
}
.progress-bar.orange {
    background-color: #ff9800;
}
.progress-bar.red {
    background-color: #f44336;
}

/* SEO Analyzer Dashboard */
.sr-analyzer-dash {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-top: 15px;
}
.score-badge-wrapper {
    text-align: center;
}
#sr-seo-score {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    background: #9ca3af;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    line-height: 1.1;
    transition: background-color 0.3s;
}
#sr-seo-score.bad {
    background: #ef4444;
}
#sr-seo-score.ok {
    background: #f59e0b;
}
#sr-seo-score.good {
    background: #22c55e;
}
#sr-seo-score span {
    font-size: 12px;
    font-weight: normal;
    opacity: 0.8;
}
#sr-seo-analysis-results {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    font-size: 13px;
}
.analysis-result-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.analysis-result-item .icon {
    font-size: 18px;
}
.analysis-result-item.pass .icon {
    color: #22c55e;
}
.analysis-result-item.fail .icon {
    color: #ef4444;
}

/* Dashboard Widget Styling */
#syncranker_dashboard_widget .inside {
    margin: 0;
    padding: 0;
}
.sr-widget-section {
    padding: 12px;
    border-bottom: 1px solid #eee;
}
.sr-widget-section:last-child {
    border-bottom: none;
}
.sr-widget-section h4 {
    margin: 0 0 12px;
    font-size: 14px;
}
.sr-progress-bar-multi {
    display: flex;
    width: 100%;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background-color: #f0f0f1;
}
.sr-progress-segment {
    height: 100%;
}
.sr-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
    font-size: 12px;
}
.sr-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.sr-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.sr-widget-section .rss-excerpt {
    font-size: 13px;
    color: #555;
}
.sr-fallback-links {
    margin: 0;
    padding: 0;
    list-style: none;
}
.sr-fallback-links li a {
    display: block;
    padding: 6px 0;
}

/* Visual SEO Score Indicators (Phase 3) */
.sr-score-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle;
}
.sr-score-red {
    background-color: #dc3232;
}
.sr-score-orange {
    background-color: #ffb900;
}
.sr-score-green {
    background-color: #46b450;
}
.sr-score-blue {
    background-color: #007cba;
    box-shadow: 0 0 8px 2px rgba(0, 124, 186, 0.8);
    border: 1px solid #fff;
} /* The illuminating effect */

.column-syncranker_score {
    width: 95px;
    text-align: center;
}
.sr-seo-col-header {
    font-weight: 600;
}
.sr-score-val {
    display: inline-block;
    vertical-align: middle;
    font-weight: 600;
    font-size: 13px;
    margin-left: 5px;
}

/* WordPress Admin Top Bar SEO Score Indicator */
#wpadminbar #wp-admin-bar-syncranker_seo_score .ab-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    height: 32px;
}
#wpadminbar #wp-admin-bar-syncranker_seo_score .sr-score-dot {
    margin: 0;
    flex-shrink: 0;
}
#wpadminbar #wp-admin-bar-syncranker_seo_score .sr-score-text {
    line-height: normal;
    font-weight: 500;
}