/**
 * InstaRank Gutenberg Panel Styles
 *
 * @package InstaRank
 * @since 1.4.0
 */

/* Character Counter */
.instarank-char-counter {
    margin-top: 8px;
    font-size: 12px;

    .count {
        display: inline-block;
        font-weight: 600;
        margin-bottom: 4px;
    }

    .bar {
        height: 4px;
        background: #f0f0f0;
        border-radius: 2px;
        overflow: hidden;
        margin-bottom: 4px;

        .fill {
            height: 100%;
            background: #00a32a;
            transition: all 0.3s ease;
        }
    }

    .warning,
    .hint {
        display: block;
        font-size: 11px;
        margin-top: 4px;
    }

    .warning {
        color: #d63638;
    }

    .hint {
        color: #757575;
    }

    &.status-empty {
        .count {
            color: #d63638;
        }

        .fill {
            background: #d63638;
        }
    }

    &.status-short {
        .count {
            color: #dba617;
        }

        .fill {
            background: #dba617;
        }
    }

    &.status-good {
        .count {
            color: #00a32a;
        }

        .fill {
            background: #00a32a;
        }
    }

    &.status-too-long {
        .count {
            color: #d63638;
        }

        .fill {
            background: #d63638;
        }
    }
}

/* SERP Preview */
.instarank-serp-preview {
    padding: 16px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    margin-bottom: 16px;

    .serp-container {
        font-family: Arial, sans-serif;
    }

    .serp-url {
        font-size: 14px;
        color: #5f6368;
        margin-bottom: 4px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .serp-title {
        font-size: 20px;
        color: #1a0dab;
        font-weight: 400;
        line-height: 1.3;
        margin-bottom: 4px;
        cursor: pointer;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;

        &:hover {
            text-decoration: underline;
        }
    }

    .serp-description {
        font-size: 14px;
        color: #4d5156;
        line-height: 1.58;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}

/* Focus Keyword Analysis */
.instarank-keyword-analysis {
    margin-top: 12px;
    padding: 12px;
    background: #f6f7f7;
    border-radius: 4px;

    .score-badge {
        display: inline-block;
        padding: 4px 12px;
        border-radius: 12px;
        font-weight: 600;
        font-size: 14px;
        margin-bottom: 12px;

        &.score-0,
        &.score-1 {
            background: #ffebee;
            color: #d32f2f;
        }

        &.score-2 {
            background: #fff8e1;
            color: #f57c00;
        }

        &.score-3,
        &.score-4 {
            background: #e8f5e9;
            color: #388e3c;
        }
    }

    .checks-list {
        list-style: none;
        margin: 0;
        padding: 0;

        li {
            display: flex;
            align-items: center;
            margin-bottom: 8px;
            font-size: 13px;

            .dashicons {
                margin-right: 8px;
                font-size: 16px;
            }

            &.check-pass {
                color: #00a32a;

                .dashicons {
                    color: #00a32a;
                }
            }

            &.check-fail {
                color: #757575;

                .dashicons {
                    color: #d63638;
                }
            }
        }
    }
}

/* Tabs */
.instarank-tabs {
    .components-tab-panel__tabs {
        margin-bottom: 16px;
    }

    .components-button {
        &.is-active {
            border-bottom: 2px solid #2271b1;
            color: #2271b1;
        }
    }
}

/* Panel Body Overrides */
.edit-post-sidebar .components-panel__body.is-opened {
    &:has(.instarank-serp-preview) {
        padding-bottom: 16px;
    }
}

/* Footer Actions */
.instarank-panel-footer {
    padding: 16px;
    border-top: 1px solid #dcdcde;
    display: flex;
    flex-direction: column;
    gap: 8px;

    a {
        font-size: 13px;
    }
}

/* Notices */
.components-notice {
    margin-bottom: 16px;

    .components-button {
        margin-top: 8px;
    }
}

/* Mobile Responsiveness */
@media (max-width: 782px) {
    .instarank-serp-preview {
        .serp-title {
            font-size: 18px;
        }

        .serp-description {
            font-size: 13px;
        }
    }
}

/* Dark Mode Support */
.is-dark-theme {
    .instarank-serp-preview {
        background: #1e1e1e;
        border-color: #3c434a;

        .serp-url {
            color: #9ca3af;
        }

        .serp-title {
            color: #8ab4f8;
        }

        .serp-description {
            color: #bdc1c6;
        }
    }

    .instarank-keyword-analysis {
        background: #1e1e1e;
    }

    .instarank-panel-footer {
        border-top-color: #3c434a;
    }
}
