/**
 * Crypto Rug Pull Checker
 * Version: 18.0.3
 */
:root {
    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --bg-level2: #f1f5f9;
    --border-color: #e2e8f0;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-light: #9ca3af;
    --primary-color: #fe497e;
    --primary-hover: #e13d6d;
    --risk-good: #22c55e;
    --risk-medium: #f9b116;
    --risk-major: #ef4444;
    --buy-color: #22c55e;
    --sell-color: #ef4444;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --border-radius: 16px;
    --skeleton-bg: #e2e8f0;
}

#crps-wrapper.dark-mode {
    --bg-main: #111827;
    --bg-card: #1f2936;
    --bg-input: #293442;
    --bg-level2: #374151;
    --border-color: #4b5563;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-light: #6b7280;
    --buy-color: #4ade80;
    --sell-color: #f87171;
    --skeleton-bg: #374151;
}

/* **UPDATED RULE BELOW** */
#crps-wrapper {
    background-color: transparent;
    font-family: 'Inter', sans-serif;
    padding: 0;
    color: var(--text-primary);
}

.crps-main-container {
    max-width: 960px;
    margin: auto;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.crps-section-container {
    padding: 1.5rem 2rem;
}

.crps-header-section {
    text-align: center;
    padding: 2rem 2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.crps-main-title {
    font-size: 1.75rem;
    font-weight: 900;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.crps-main-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

.crps-config-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    align-items: flex-end;
}

.crps-input-item label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.5rem;
}

.crps-input-item input,
.crps-input-item select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    transition: border-color .2s, box-shadow .2s;
}

.crps-input-item input:focus,
.crps-input-item select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(254, 73, 126, 0.2);
    outline: none;
}

.crps-input-item select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right .5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.crps-action-buttons {
    margin-top: 1.5rem;
}

.crps-action-buttons button {
    width: 100%;
    background: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.875rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.crps-action-buttons button:hover {
    background: var(--primary-hover);
}

.crps-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 0.5em;
    vertical-align: -0.125em;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.crps-error-message {
    background-color: rgba(239, 68, 68, 0.1);
    color: #f87171;
    padding: 1rem;
    margin: 0 2rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --- Embed Button --- */
.crps-embed-button-container {
    text-align: center;
    padding: 1rem 2rem 2rem;
}

.crps-embed-button {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: .6rem 1.2rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}

.crps-embed-button:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

.crps-embed-button:disabled {
    color: var(--text-light);
    border-color: var(--border-color);
    cursor: not-allowed;
}

/* --- Modals (Search & Embed) --- */
.crps-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 24, 39, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s .3s, opacity .3s;
}

.crps-modal.show {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s, opacity .3s;
}

.crps-modal-content {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.crps-modal-close {
    color: var(--text-light);
    font-size: 32px;
    font-weight: 700;
    position: absolute;
    top: 15px;
    right: 25px;
    cursor: pointer;
    transition: color .2s;
}

.crps-modal-close:hover {
    color: var(--text-primary);
}

.crps-modal-content h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.crps-modal-content p {
    color: var(--text-secondary);
    text-align: center;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

.crps-modal-content textarea {
    width: 100%;
    height: 200px;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    font-family: 'Roboto Mono', monospace;
    resize: vertical;
    color: var(--text-primary);
}

.crps-copy-button {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
    padding: .75rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    margin-top: 1rem;
    transition: background .2s;
}

.crps-copy-button:hover {
    background-color: var(--primary-hover);
}


/* --- Search Results --- */
#crps-search-results-list {
    max-height: 40vh;
    overflow-y: auto;
    margin: 0 -1rem;
    padding: 0 .5rem;
}

.crps-search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color .2s;
}

.crps-search-result-item:last-child {
    border-bottom: none;
}

.crps-search-result-item:hover {
    background-color: var(--bg-level2);
    border-radius: 8px;
}

.crps-search-result-info {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.crps-search-result-name {
    font-weight: 600;
    color: var(--text-primary);
}

.crps-search-result-chain {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background-color: var(--bg-level2);
    padding: .2rem .5rem;
    border-radius: 6px;
    align-self: flex-start;
    margin-top: .25rem;
}

.crps-search-result-address {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: 'Roboto Mono', monospace;
}

.crps-search-result-select {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background .2s;
}

.crps-search-result-select:hover {
    background-color: var(--primary-hover);
}

/* --- Results --- */
.crps-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--bg-level2);
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.crps-token-info {
    flex: 1;
}

.crps-token-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.crps-token-info .symbol {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1rem;
}

/* Share Button */
.crps-header-actions {
    display: flex;
    gap: 0.5rem;
}

.crps-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.crps-share-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(254, 73, 126, 0.05);
}

.crps-share-btn svg {
    width: 14px;
    height: 14px;
}

/* Risk Meter Gauge */
.crps-risk-meter-wrapper {
    position: relative;
}

.crps-risk-meter-container {
    position: relative;
    width: 160px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    cursor: help;
}

.crps-risk-meter {
    position: relative;
    width: 100%;
    height: 100%;
}

.crps-risk-meter-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 160px 160px 0 0;
    background: var(--border-color);
    z-index: 1;
}

.crps-risk-meter-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 160px 160px 0 0;
    background: var(--risk-good);
    z-index: 2;
    transform-origin: bottom center;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(0deg);
}

.crps-risk-meter-cover {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 65px;
    background: var(--bg-level2);
    border-radius: 130px 130px 0 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 0.5rem;
}

.crps-risk-score-value {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
}

.crps-risk-score-value.good {
    color: var(--risk-good);
}

.crps-risk-score-value.medium {
    color: var(--risk-medium);
}

.crps-risk-score-value.major,
.crps-risk-score-value.critical {
    color: var(--risk-major);
}

.crps-risk-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* Risk Tooltip */
.crps-risk-meter-wrapper {
    position: relative;
}

.crps-risk-tooltip {
    position: absolute;
    bottom: calc(100% + 20px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-primary);
    color: var(--bg-card);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.crps-risk-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.crps-risk-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--text-primary);
}

.crps-risk-tooltip .tooltip-item {
    padding: 0.25rem 0;
    text-align: center;
}

.crps-risk-tooltip .tooltip-item:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* News List */
.crps-news-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.crps-news-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.crps-news-item:last-child {
    border-bottom: none;
}

.crps-news-item a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.crps-news-item a:hover {
    color: var(--primary-color);
}

.crps-news-source {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tabs */
.crps-tabs {
    display: flex;
    flex-wrap: nowrap;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.crps-tabs::-webkit-scrollbar {
    display: none;
}

.crps-tab-link {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 1rem 0.5rem;
    cursor: pointer;
    margin-right: 1.5rem;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: color .2s, border-color .2s;
}

.crps-tab-link:hover {
    color: var(--primary-color);
}

.crps-tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.crps-tab-content {
    display: none;
    padding: 1.5rem 2rem;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.crps-tab-content.active {
    display: block;
}

.crps-no-data,
.crps-spinner-container {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem 0;
}

/* Overview Tab */
.crps-overview-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.crps-key-findings h4,
.crps-ai-summary h4 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.findings-list {
    list-style: none;
    padding: 0;
}

.findings-list li {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-primary);
}

.findings-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    font-size: 1.5rem;
    line-height: 1;
}

.findings-list li.finding-good::before {
    color: var(--risk-good);
}

.findings-list li.finding-medium::before {
    color: var(--risk-medium);
}

.findings-list li.finding-bad::before {
    color: var(--risk-major);
}

.crps-ai-summary {
    padding: 1.5rem;
    background: var(--bg-level2);
    border-radius: 8px;
}

/* Market Tab */
.crps-market-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.crps-market-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
}

.crps-stat-item {
    background: var(--bg-level2);
    padding: 1rem;
    border-radius: 8px;
}

.crps-stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.crps-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-all;
}

.crps-stat-sublabel {
    font-size: 0.75rem;
    color: var(--text-light);
}

.fng-widget .fng-value {
    font-size: 1.5rem;
    font-weight: 900;
}

.fng-widget .fng-class {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.crps-chart-container-wrapper {
    position: relative;
}

.crps-chart-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    gap: 5px;
    background: var(--bg-card);
    padding: 5px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.crps-chart-controls button {
    background: var(--bg-level2);
    border: none;
    padding: 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-secondary);
    font-weight: 600;
}

.crps-chart-controls button.active {
    background: var(--primary-color);
    color: white;
}

.crps-chart-container {
    height: 350px;
    position: relative;
}

/* Holders Tab */
.crps-holder-analysis-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.crps-holder-chart-container {
    height: 180px;
}

/* Audit Tab */
.crps-audit-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.crps-audit-item {
    background-color: var(--bg-level2);
    padding: 1rem;
    border-radius: 8px;
}

.crps-audit-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.crps-audit-item-header .icon {
    font-size: 1.25rem;
    line-height: 1;
}

.crps-audit-item.pass .crps-audit-item-header {
    color: var(--buy-color);
}

.crps-audit-item.fail .crps-audit-item-header {
    color: var(--sell-color);
}

.crps-audit-item-info {
    margin: 0.5rem 0 0 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.crps-source-code-button {
    display: none !important;
}

/* Tables (Holders, Exchanges, TXs) */
.crps-detail-table-wrapper {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th,
td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    color: var(--text-secondary);
}

tr:last-child td {
    border-bottom: none;
}

th {
    font-weight: 600;
    color: var(--text-light);
    background: var(--bg-level2);
}

td a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

td a:hover {
    text-decoration: underline;
}

.crps-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 99px;
    background: var(--bg-level2);
    color: var(--text-secondary);
}

.crps-status.locked {
    color: var(--buy-color);
}

.crps-status.unlocked {
    color: var(--sell-color);
}

.crps-txn-type {
    font-weight: 600;
    text-transform: capitalize;
}

.txn-buy .crps-txn-type {
    color: var(--buy-color);
}

.txn-sell .crps-txn-type {
    color: var(--sell-color);
}

/* Skeleton Loader */
.crps-skeleton {
    background-color: var(--skeleton-bg);
    border-radius: 4px;
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.crps-skeleton-text {
    display: inline-block;
    height: 1em;
    margin-bottom: 0.25em;
}

.crps-skeleton-header .crps-skeleton-text {
    height: 1.5rem;
}

.crps-skeleton-chart {
    width: 100%;
    height: 350px;
}

.crps-skeleton-table {
    width: 100%;
    height: 200px;
}

.crps-tab-content .crps-skeleton-text {
    width: 90%;
    margin-top: 0.5rem;
}

.crps-tab-content .crps-skeleton-text:last-child {
    width: 70%;
}

@media(max-width: 768px) {
    #crps-wrapper {
        padding: 1rem 0.5rem;
    }

    .crps-section-container,
    .crps-header-section,
    .crps-results-header,
    .crps-tab-content {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .crps-config-grid,
    .crps-holder-analysis-grid {
        grid-template-columns: 1fr;
    }

    .crps-results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .crps-tab-link {
        margin-right: 1rem;
        font-size: 0.9rem;
    }
}

/* AI Narrative Styling */
.narrative-content .narrative-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2rem 0 1rem 0;
    /* Increased top margin for better separation */
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.narrative-content .narrative-header:first-of-type {
    margin-top: 0;
}

.narrative-content p {
    margin-bottom: 1.25rem;
    /* Increased paragraph spacing */
    line-height: 1.6;
    color: var(--text-secondary);
}

#crps-wrapper.dark-mode .narrative-content p {
    color: #d1d5db;
    /* A lighter gray for dark mode */
}

.narrative-content ul {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0 1.5rem 0;
}

.narrative-content li {
    padding-left: 1.25rem;
    position: relative;
    margin-bottom: 0.75rem;
    /* Increased list item spacing */
    color: var(--text-secondary);
}

.narrative-content li::before {
    content: '•';
    color: var(--primary-color);
    position: absolute;
    left: 0;
    top: 0;
}

.narrative-content strong {
    font-weight: 600;
    color: var(--text-primary);
}