/**
 * CuiveMedia SEO-Check Tool Styles
 */

/* Layout */
.seo-check-page {
    padding: 2rem 0;
    min-height: 100vh;
}

.seo-check-container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    align-items: start;
}

.seo-check-main {
    min-width: 0;
}

.seo-check-sidebar {
    position: sticky;
    top: 100px;
}

/* Header */
.seo-header {
    text-align: center;
    margin-bottom: 2rem;
}

.seo-header-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.seo-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
    margin-bottom: 0.5rem;
}

.seo-header .lead {
    font-size: 1.1rem;
    color: var(--text-secondary, #6b7280);
    max-width: 600px;
    margin: 0 auto;
}

/* Form */
.seo-form {
    max-width: 700px;
    margin: 0 auto 2rem;
}

.seo-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--card-bg, #fff);
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 16px;
    padding: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.seo-input-wrapper:focus-within {
    border-color: #6366f1;
    box-shadow: 0 4px 30px rgba(99, 102, 241, 0.15);
}

.seo-input-wrapper .input-icon {
    padding: 0 1rem;
    color: var(--text-secondary, #9ca3af);
    font-size: 1.2rem;
}

.seo-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    padding: 12px 0;
    color: var(--text-primary, #1f2937);
    outline: none;
}

.seo-input::placeholder {
    color: var(--text-secondary, #9ca3af);
}

.seo-submit-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.seo-submit-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.seo-form-hint {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-secondary, #9ca3af);
    font-size: 0.9rem;
}

.seo-form-hint i {
    margin-right: 0.5rem;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 3rem;
}

.loading-animation {
    margin-bottom: 2rem;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    border: 4px solid var(--border-color, #e5e7eb);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-progress {
    max-width: 300px;
    margin: 0 auto;
    height: 6px;
    background: var(--border-color, #e5e7eb);
    border-radius: 3px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    animation: loading-progress 4s ease-in-out infinite;
}

@keyframes loading-progress {
    0% { width: 0; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.loading-state h3 {
    font-size: 1.5rem;
    color: var(--text-primary, #1f2937);
    margin-bottom: 0.5rem;
}

.loading-state p {
    color: var(--text-secondary, #6b7280);
}

.loading-steps {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--text-secondary, #9ca3af);
    transition: all 0.3s ease;
}

.loading-step.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
}

.loading-step.done {
    background: #22c55e;
    color: #fff;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 3rem;
}

.error-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: #fef2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #ef4444;
}

.error-state h3 {
    color: #ef4444;
    margin-bottom: 0.5rem;
}

.error-state p {
    color: var(--text-secondary, #6b7280);
    margin-bottom: 1.5rem;
}

/* Results Section */
.results-section {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Score Overview */
.score-overview {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: var(--card-bg, #fff);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.score-circle-container {
    text-align: center;
}

.score-circle {
    position: relative;
    width: 150px;
    height: 150px;
}

.score-circle svg {
    transform: rotate(-90deg);
}

.score-circle .score-bg {
    fill: none;
    stroke: var(--border-color, #e5e7eb);
    stroke-width: 8;
}

.score-circle .score-progress {
    fill: none;
    stroke: #22c55e;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1.5s ease;
}

.score-circle .score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

.score-label {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary, #6b7280);
}

.score-info {
    flex: 1;
}

.score-info h2 {
    font-size: 1.5rem;
    color: var(--text-primary, #1f2937);
    margin-bottom: 0.5rem;
}

.score-info p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.score-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Result Cards */
.result-card {
    background: var(--card-bg, #fff);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.result-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary, #f9fafb);
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.result-card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-card-header h3 i {
    color: #6366f1;
}

.result-card-body {
    padding: 1.5rem;
}

/* SERP Preview */
.serp-preview {
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-family: Arial, sans-serif;
    max-width: 600px;
}

.serp-favicon {
    width: 28px;
    height: 28px;
    background: #f1f3f4;
    border-radius: 50%;
    margin-bottom: 4px;
}

.serp-url {
    font-size: 12px;
    color: #202124;
    margin-bottom: 4px;
}

.serp-title {
    font-size: 20px;
    color: #1a0dab;
    margin-bottom: 6px;
    line-height: 1.3;
}

.serp-description {
    font-size: 14px;
    color: #4d5156;
    line-height: 1.58;
}

.serp-metrics {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.serp-metric {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.serp-metric .label {
    color: var(--text-secondary, #6b7280);
    min-width: 120px;
}

.serp-metric .value {
    font-weight: 600;
    color: var(--text-primary, #1f2937);
}

.serp-metric .status {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-success {
    background: #dcfce7;
    color: #166534;
}

.status-warning {
    background: #fef3c7;
    color: #92400e;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Category Scores */
.category-scores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.category-score-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--card-bg, #fff);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.category-icon {
    width: 45px;
    height: 45px;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6366f1;
    font-size: 1.1rem;
}

.category-info {
    flex: 1;
}

.category-name {
    font-size: 0.85rem;
    color: var(--text-secondary, #6b7280);
}

.category-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.category-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color, #e5e7eb);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.category-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s ease;
}

/* Core Web Vitals */
.cwv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.cwv-card {
    text-align: center;
    padding: 1.25rem;
    border-radius: 12px;
    border: 2px solid;
    background: var(--card-bg, #fff);
}

.cwv-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.cwv-label {
    font-size: 0.8rem;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.cwv-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

.cwv-status.status-good {
    background: #dcfce7;
    color: #166534;
}

.cwv-status.status-needs-improvement {
    background: #fef3c7;
    color: #92400e;
}

.cwv-status.status-poor {
    background: #fee2e2;
    color: #991b1b;
}

/* Findings */
.findings-filter {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

.findings-list {
    max-height: 400px;
    overflow-y: auto;
}

.finding-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color, #f3f4f6);
}

.finding-item:last-child {
    border-bottom: none;
}

.finding-item i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.finding-category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6366f1;
    background: #eef2ff;
    padding: 2px 8px;
    border-radius: 4px;
}

.finding-message {
    flex: 1;
    color: var(--text-primary, #374151);
    font-size: 0.9rem;
}

/* Keywords */
.keywords-section h4 {
    font-size: 1rem;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 1rem;
}

.keywords-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.keyword-tag {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #4338ca;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.keyword-tag:hover {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    transform: scale(1.05);
}

.keyword-tag small {
    opacity: 0.7;
}

.bigrams-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bigram-tag {
    display: inline-block;
    padding: 6px 14px;
    background: var(--bg-secondary, #f3f4f6);
    color: var(--text-primary, #374151);
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Recommendations */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recommendation-item {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    border-left: 4px solid;
}

.recommendation-item.rec-critical {
    background: #fef2f2;
    border-color: #ef4444;
}

.recommendation-item.rec-high {
    background: #fff7ed;
    border-color: #f97316;
}

.recommendation-item.rec-medium {
    background: #fffbeb;
    border-color: #fbbf24;
}

.rec-priority {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 0.5rem;
}

.rec-critical .rec-priority { color: #991b1b; }
.rec-high .rec-priority { color: #9a3412; }
.rec-medium .rec-priority { color: #92400e; }

.rec-category {
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
}

.rec-text {
    margin: 0.5rem 0 0;
    color: var(--text-primary, #374151);
    font-size: 0.95rem;
}

/* Sidebar */
.sidebar-ad {
    margin-bottom: 1.5rem;
}

.sidebar-card {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.sidebar-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: var(--text-primary, #374151);
    font-size: 0.9rem;
}

.related-tool-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    color: var(--text-primary, #374151);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}

.related-tool-link:hover {
    background: var(--bg-secondary, #f3f4f6);
    color: #6366f1;
}

.related-tool-link i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 8px;
    color: #6366f1;
}

.pro-tip {
    background: linear-gradient(135deg, #fef3c7, #fef9c3);
    border: 1px solid #fde68a;
}

.pro-tip p {
    margin: 0;
    font-size: 0.9rem;
    color: #92400e;
}

/* Ad Container */
.ad-container {
    background: var(--bg-secondary, #f9fafb);
    border-radius: 8px;
    padding: 1rem;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Info Section */
.info-section {
    background: var(--card-bg, #fff);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.info-section h2 {
    font-size: 1.5rem;
    color: var(--text-primary, #1f2937);
    margin-bottom: 1rem;
}

.info-section h3 {
    font-size: 1.25rem;
    color: var(--text-primary, #1f2937);
    margin: 1.5rem 0 0.75rem;
}

.info-section p,
.info-section li {
    color: var(--text-secondary, #6b7280);
    line-height: 1.7;
}

.info-section ul {
    padding-left: 1.25rem;
}

.info-section li {
    margin-bottom: 0.5rem;
}

/* Accordion */
.accordion-item {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px !important;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.accordion-button {
    font-weight: 600;
    color: var(--text-primary, #1f2937);
}

.accordion-button:not(.collapsed) {
    background: var(--bg-secondary, #f3f4f6);
    color: #6366f1;
}

.accordion-body {
    color: var(--text-secondary, #6b7280);
}

/* Responsive */
@media (max-width: 1024px) {
    .seo-check-container {
        grid-template-columns: 1fr;
    }

    .seo-check-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .seo-header h1 {
        font-size: 1.75rem;
    }

    .seo-input-wrapper {
        flex-direction: column;
        padding: 12px;
    }

    .seo-input-wrapper .input-icon {
        display: none;
    }

    .seo-input {
        width: 100%;
        text-align: center;
        margin-bottom: 12px;
    }

    .seo-submit-btn {
        width: 100%;
        justify-content: center;
    }

    .score-overview {
        flex-direction: column;
        text-align: center;
    }

    .score-actions {
        justify-content: center;
    }

    .category-scores {
        grid-template-columns: 1fr;
    }

    .cwv-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Dark Mode */
[data-theme="dark"] .seo-input-wrapper {
    background: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .serp-preview {
    background: #1f2937;
    border-color: #374151;
}

[data-theme="dark"] .serp-url {
    color: #9ca3af;
}

[data-theme="dark"] .serp-title {
    color: #818cf8;
}

[data-theme="dark"] .serp-description {
    color: #d1d5db;
}

[data-theme="dark"] .keyword-tag {
    background: linear-gradient(135deg, #312e81, #3730a3);
    color: #c7d2fe;
}

[data-theme="dark"] .bigram-tag {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ============================================
   Backlinks Section
   ============================================ */
.backlinks-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.backlink-stat {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.backlink-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.backlink-stat-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
}

.backlink-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
    line-height: 1.2;
}

.backlink-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary, #6b7280);
    margin-top: 0.25rem;
}

/* Backlinks List */
.backlinks-list-container {
    border-top: 1px solid var(--border-color, #e5e7eb);
    padding-top: 1rem;
}

.backlinks-list-container h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
}

.backlinks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.backlink-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.backlink-item:hover {
    background: var(--border-color, #e5e7eb);
}

.backlink-domain {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    font-size: 0.9rem;
}

.backlink-domain i {
    color: #6366f1;
    font-size: 0.75rem;
}

.backlink-url {
    font-size: 0.8rem;
    color: var(--text-secondary, #6b7280);
    text-decoration: none;
    word-break: break-all;
    transition: color 0.2s ease;
}

.backlink-url:hover {
    color: #6366f1;
    text-decoration: underline;
}

/* Backlinks Note */
.backlinks-note {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #eff6ff;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #1e40af;
}

.backlinks-note i {
    margin-top: 2px;
    flex-shrink: 0;
}

/* Responsive Backlinks */
@media (max-width: 768px) {
    .backlinks-overview {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .backlink-stat {
        padding: 1rem;
    }

    .backlink-stat-value {
        font-size: 1.5rem;
    }
}

/* Dark Mode Backlinks */
[data-theme="dark"] .backlink-stat {
    background: var(--bg-secondary, #374151);
}

[data-theme="dark"] .backlink-item {
    background: var(--bg-secondary, #374151);
}

[data-theme="dark"] .backlink-item:hover {
    background: #4b5563;
}

[data-theme="dark"] .backlinks-note {
    background: #1e3a5f;
    color: #93c5fd;
}
