/* Crawler Exposer - Bot Analytics Dashboard */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: #15151f;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --accent-primary: #ef4444;
    --accent-secondary: #f97316;
    --accent-success: #22c55e;
    --accent-warning: #eab308;
    --accent-info: #3b82f6;
    --border-color: #2a2a3a;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.header-center {
    text-align: center;
}

.header-center h1 {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.header-center h1 i {
    color: var(--accent-primary);
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.back-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: #dc2626;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat.warning {
    border-color: var(--accent-warning);
    background: rgba(234, 179, 8, 0.1);
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat.warning .stat-value {
    color: var(--accent-warning);
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: var(--bg-secondary);
    padding: 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tab-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* Tab Content */
.tab-content {
    margin-bottom: 20px;
}

.tab-panel {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
}

.tab-panel.active {
    display: block;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h2 i {
    color: var(--accent-primary);
}

.panel-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-success);
    font-size: 0.85rem;
}

.pulse {
    width: 10px;
    height: 10px;
    background: var(--accent-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Visits List */
.visits-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 600px;
    overflow-y: auto;
}

.visit-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.visit-item:hover {
    border-color: var(--accent-primary);
}

.visit-item.honeypot {
    border-left: 3px solid var(--accent-warning);
}

.visit-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.visit-info {
    min-width: 0;
}

.visit-path {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: var(--accent-info);
    word-break: break-all;
}

.visit-ip {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.visit-method {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.visit-method.get {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-success);
}

.visit-method.post {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-info);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-search_engine {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.badge-ai {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.badge-social {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.badge-seo {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
}

.badge-scanner {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-scraper {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

.badge-monitor {
    background: rgba(6, 182, 212, 0.2);
    color: #06b6d4;
}

.badge-bot {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

.badge-browser {
    background: rgba(255, 255, 255, 0.1);
    color: #9ca3af;
}

.badge-unknown {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

/* Crawler Grid */
.crawler-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.crawler-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 20px;
    transition: all 0.2s;
}

.crawler-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.crawler-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.crawler-name {
    font-weight: 600;
    font-size: 1rem;
}

.crawler-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.crawler-stat {
    text-align: center;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.crawler-stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.crawler-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.crawler-last-seen {
    margin-top: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* IP List */
.ip-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ip-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 20px;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.ip-address {
    font-family: 'Fira Code', monospace;
    font-weight: 600;
}

/* IP Lookup Links */
.ip-link {
    color: var(--accent-info);
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px dashed transparent;
}

.ip-link:hover {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.visit-ip .ip-link {
    color: var(--text-secondary);
}

.visit-ip .ip-link:hover {
    color: var(--accent-info);
    border-bottom-color: var(--accent-info);
}

.ip-stat {
    text-align: center;
}

.ip-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-info);
}

.ip-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.ip-honeypot {
    color: var(--accent-warning);
}

/* Paths Chart */
.paths-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.path-bar {
    display: flex;
    align-items: center;
    gap: 15px;
}

.path-name {
    flex: 0 0 200px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--accent-info);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.path-bar-container {
    flex: 1;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.path-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.path-count {
    flex: 0 0 60px;
    text-align: right;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Legend */
.legend-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 20px;
}

.legend-section h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-section h3 i {
    color: var(--accent-primary);
}

/* Crawler Types Grid */
.crawler-types-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.crawler-type-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.crawler-type-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-color);
}

.type-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.type-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.type-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Type-specific colors */
.type-search_engine .type-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}
.type-search_engine:hover {
    border-color: rgba(34, 197, 94, 0.4);
}

.type-ai .type-icon {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}
.type-ai:hover {
    border-color: rgba(168, 85, 247, 0.4);
}

.type-social .type-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}
.type-social:hover {
    border-color: rgba(59, 130, 246, 0.4);
}

.type-seo .type-icon {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}
.type-seo:hover {
    border-color: rgba(249, 115, 22, 0.4);
}

.type-scanner .type-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.type-scanner:hover {
    border-color: rgba(239, 68, 68, 0.4);
}

.type-scraper .type-icon {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}
.type-scraper:hover {
    border-color: rgba(234, 179, 8, 0.4);
}

.type-monitor .type-icon {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
}
.type-monitor:hover {
    border-color: rgba(6, 182, 212, 0.4);
}

.type-bot .type-icon {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
}
.type-bot:hover {
    border-color: rgba(107, 114, 128, 0.4);
}

/* Crawler Types Grid - Tablet */
@media (max-width: 1100px) {
    .crawler-types-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Info Section */
.info-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.info-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-section h3 i {
    color: var(--accent-primary);
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.info-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
}

.info-card i {
    font-size: 2rem;
    color: var(--accent-primary);
    margin-bottom: 10px;
}

.info-card h4 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.info-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-links {
    margin-top: 10px;
}

.footer-links a {
    color: var(--accent-primary);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-left, .header-right {
        width: 100%;
        justify-content: center;
    }

    .back-btn span {
        display: none;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .tab-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .tab-btn {
        min-width: 100px;
        font-size: 0.8rem;
    }

    .visit-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .ip-item {
        grid-template-columns: 1fr 1fr;
    }

    .path-name {
        flex: 0 0 100px;
        font-size: 0.75rem;
    }

    .crawler-grid {
        grid-template-columns: 1fr;
    }

    .crawler-types-grid {
        grid-template-columns: 1fr;
    }

    .crawler-type-card {
        padding: 12px;
    }

    .type-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .stats-bar {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* ============================================
   API Documentation Section
   ============================================ */

.api-section {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 30px;
    margin-top: 30px;
}

.api-section h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.api-intro {
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.api-endpoints {
    display: grid;
    gap: 15px;
    margin-bottom: 25px;
}

.api-endpoint {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

.api-method {
    background: #10b981;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: monospace;
}

.api-url {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    flex: 1;
    min-width: 200px;
}

.api-endpoint p {
    width: 100%;
    margin: 8px 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.api-endpoint p code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8rem;
    color: var(--accent-secondary);
}

.api-examples {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 20px;
}

.api-examples h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1rem;
}

.code-block {
    margin-bottom: 12px;
    padding: 12px;
    background: #1a1a2e;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.code-block:last-child {
    margin-bottom: 0;
}

.code-label {
    display: block;
    color: #888;
    font-size: 0.75rem;
    margin-bottom: 6px;
}

.code-block code {
    color: #10b981;
    font-size: 0.85rem;
    word-break: break-all;
}

.api-docs-link {
    text-align: center;
    margin-top: 20px;
}

.api-docs-link .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 768px) {
    .api-endpoint {
        flex-direction: column;
        gap: 8px;
    }

    .api-url {
        width: 100%;
    }

    .code-block code {
        font-size: 0.75rem;
    }
}

/* ============================================
   P2P Community Section
   ============================================ */

.p2p-section {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #10b981;
    border-radius: var(--radius);
    padding: 30px;
    margin-top: 30px;
}

.p2p-section h3 {
    color: #10b981;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.p2p-intro {
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.p2p-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.p2p-step {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-sm);
}

.step-number {
    width: 36px;
    height: 36px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content h4 {
    color: var(--text-primary);
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.step-content p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.step-content code {
    display: inline-block;
    background: var(--bg-tertiary);
    color: #10b981;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.p2p-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.p2p-stat {
    text-align: center;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.p2p-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #10b981;
}

.p2p-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.p2p-cta {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.p2p-cta .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 768px) {
    .p2p-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .p2p-steps {
        grid-template-columns: 1fr;
    }
}
