/**
 * Bot Detector Admin Styles
 */

/* Dashboard Layout */ 

/* Ensure proper WordPress admin integration */
.rocketship-seo-settings.rocketship-bot-detector-dashboard {
    background: #f1f1f1;
    padding: 0;
}

.rocketship-seo-settings.rocketship-bot-detector-dashboard > h1 {
    background: #fff;
    margin: 0 0 20px 0;
    padding: 20px;
    border-bottom: 1px solid #c3c4c7;
}

.rocketship-bot-detector-dashboard h1 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rocketship-bot-detector-dashboard h1::before {
    content: "🤖";
    font-size: 32px;
}

/* Filters */
.bot-detector-filters {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
}

.bot-detector-filters form {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.bot-detector-filters label {
    font-weight: 600;
    margin-right: 5px;
}

.bot-detector-filters input[type="date"] {
    padding: 6px 8px;
    border: 1px solid #8c8f94;
    border-radius: 3px;
}

/* Stats Cards */
.bot-detector-stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stats-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stats-card h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-number {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
    color: #1d2327;
}

.stats-card.bot-visits .stats-number {
    color: #dc3232;
}

.stats-card.human-visits .stats-number {
    color: #46b450;
}

.stats-percentage {
    font-size: 12px;
    color: #646970;
    font-weight: 600;
    background: #f6f7f7;
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
}

/* Charts Section */
.bot-detector-charts {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 20px;
}

.chart-container h3 {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #1d2327;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

.chart-container canvas {
    max-height: 400px;
}

/* Tables Section */
.bot-detector-tables {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.table-container {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 20px;
}

.table-container h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #1d2327;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

.table-container .wp-list-table {
    border: none;
    box-shadow: none;
}

.table-container .wp-list-table th,
.table-container .wp-list-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #f0f0f1;
}

.table-container .wp-list-table th {
    background: #f6f7f7;
    font-weight: 600;
    color: #1d2327;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 40px;
    color: #646970;
}

.loading::before {
    content: "⟳";
    animation: spin 1s linear infinite;
    font-size: 24px;
    display: block;
    margin-bottom: 10px;
}

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

/* Bot Indicators */
.bot-indicator {
    background: #dc3232;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.human-indicator {
    background: #46b450;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Settings Section */
.bot-detector-settings {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.bot-detector-settings h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #1d2327;
}

.bot-detector-settings .form-table th {
    width: 200px;
    padding-left: 0;
}

/* Performance Info */
.bot-detector-info {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 20px;
}

.bot-detector-info h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #1d2327;
}

.bot-detector-info p {
    margin: 8px 0;
    color: #646970;
}

/* Metabox Styles */
.rocketship-bot-detector-metabox {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.bot-stats-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e1e1;
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-item strong {
    display: block;
    font-size: 24px;
    line-height: 1;
    margin-bottom: 4px;
    color: #1d2327;
}

.bot-stat strong {
    color: #dc3232;
}

.human-stat strong {
    color: #46b450;
}

.stat-item span {
    display: block;
    font-size: 12px;
    color: #646970;
    margin-bottom: 2px;
}

.stat-item small {
    display: block;
    font-size: 11px;
    color: #999;
    font-weight: 600;
}

.bot-stats-progress {
    margin-bottom: 20px;
}

.progress-bar {
    height: 20px;
    background: #f1f1f1;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    margin-bottom: 8px;
}

.bot-visits-bar {
    background: #dc3232;
    height: 100%;
    transition: width 0.3s ease;
}

.human-visits-bar {
    background: #46b450;
    height: 100%;
    transition: width 0.3s ease;
}

.progress-legend {
    display: flex;
    gap: 15px;
    font-size: 12px;
}

.color-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: middle;
}

.bot-color {
    background: #dc3232;
}

.human-color {
    background: #46b450;
}

.top-bots-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #1d2327;
}

.top-bots-list {
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 15px;
}

.bot-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e1e1e1;
    font-size: 12px;
}

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

.bot-name {
    font-weight: 600;
    color: #1d2327;
    flex: 1;
}

.bot-type {
    color: #646970;
    text-transform: capitalize;
    margin: 0 10px;
    font-size: 11px;
}

.bot-visits {
    color: #0073aa;
    font-weight: 600;
}

.mini-chart-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #1d2327;
}

.metabox-actions {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e1e1e1;
}

.no-data-state {
    text-align: center;
    padding: 30px 15px;
    color: #646970;
}

.no-data-state p {
    margin: 0 0 8px 0;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .bot-detector-charts {
        grid-template-columns: 1fr;
    }
    
    .bot-detector-tables {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .bot-detector-stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bot-stats-summary {
        flex-direction: column;
        gap: 10px;
    }
    
    .bot-detector-filters form {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

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

/* Accessibility */
.stats-card:focus {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
}

.button:focus {
    box-shadow: 0 0 0 2px #2271b1;
}

/* Print Styles */
@media print {
    .bot-detector-filters,
    .metabox-actions,
    .bot-detector-settings {
        display: none;
    }
    
    .bot-detector-charts,
    .bot-detector-tables {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        page-break-inside: avoid;
    }
}

/* Dark Mode Support (WordPress 5.7+) */
@media (prefers-color-scheme: dark) {
    .stats-card {
        background: #1d2327;
        border-color: #3c434a;
    }
    
    .stats-card h3 {
        color: #c3c4c7;
    }
    
    .stats-number {
        color: #f0f0f1;
    }
    
    .chart-container,
    .table-container,
    .bot-detector-settings,
    .bot-detector-info {
        background: #1d2327;
        border-color: #3c434a;
    }
    
    .chart-container h3,
    .table-container h3 {
        color: #f0f0f1;
        border-bottom-color: #3c434a;
    }
}

/* WordPress Admin Integration */
.rocketship-bot-detector-dashboard .postbox {
    margin-bottom: 20px;
}

.rocketship-bot-detector-dashboard .postbox .inside {
    padding: 20px;
}

/* Bot Categories Section */
.bot-categories-section {
    margin: 0;
}

.bot-categories-section .inside {
    padding: 20px !important;
}

.bot-categories-section h2 {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: #1d2327;
    padding-left: 10px;
    border-left: 4px solid #2271b1;
}

.bot-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.bot-category-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.bot-category-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.bot-category-card.zero-visits {
    opacity: 0.6;
    background: #f9f9f9;
}

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

.category-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: #1d2327;
}

.category-visits {
    font-size: 1.2em;
    font-weight: bold;
    color: #2271b1;
}

.category-description {
    color: #646970;
    margin: 8px 0 15px 0;
    font-size: 0.9em;
    line-height: 1.4;
}

.category-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-item {
    font-size: 0.85em;
    color: #50575e;
}

.stat-item strong {
    color: #1d2327;
    font-weight: 600;
}

/* Dark Mode Support for Bot Categories */
@media (prefers-color-scheme: dark) {
    .bot-categories-section h2 {
        color: #f0f0f1;
    }
    
    .bot-category-card {
        background: #1d2327;
        border-color: #3c434a;
        color: #f0f0f1;
    }
    
    .bot-category-card.zero-visits {
        background: #2c3338;
    }
    
    .category-header h3 {
        color: #f0f0f1;
    }
    
    .category-description {
        color: #a7aaad;
    }
    
    .stat-item {
        color: #a7aaad;
    }
    
    .stat-item strong {
        color: #f0f0f1;
    }
}

/* Responsive Design for Bot Categories */
@media (max-width: 768px) {
    .bot-categories-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .category-stats {
        gap: 15px;
    }
}

/* Beautiful Admin Grid Layout (like IndexNow) */
.rocketship-admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}

.rocketship-admin-card {
    background: white;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
}

.rocketship-admin-card.full-width {
    grid-column: 1 / -1;
}

.rocketship-admin-card h2 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #23282d;
    font-size: 1.3em;
    font-weight: 600;
}

.rocketship-admin-card p {
    margin-bottom: 15px;
    color: #646970;
    font-size: 14px;
    line-height: 1.5;
}

/* Table Controls & Pagination */
.table-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f1;
    font-size: 13px;
}

.per-page-selector {
    padding: 6px 10px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
}

.table-container {
    margin-bottom: 0;
}

/* Beautiful WordPress-style Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f1;
    font-size: 14px;
    line-height: 1.5;
}

.data-table th {
    background: #f6f7f7;
    font-weight: 600;
    color: #1d2327;
    border-bottom: 1px solid #c3c4c7;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table .number {
    text-align: right;
    font-weight: 600;
    color: #0073aa;
    font-variant-numeric: tabular-nums;
}

/* Beautiful Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.success {
    background: #d1ecf1;
    color: #0c5460;
}

.status-badge.error {
    background: #f8d7da;
    color: #721c24;
}

.data-table .bot-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bot-type.ai_agents { background: #ffe6e6; color: #d63384; }
.bot-type.search_engines { background: #e6f7f7; color: #0f5132; }
.bot-type.social_media_bots { background: #e6f2ff; color: #0a58ca; }
.bot-type.seo_analytics_bots { background: #e8f5e8; color: #146c43; }
.bot-type.security_bots { background: #fff3cd; color: #b08800; }
.bot-type.generic_bots { background: #f8e6ff; color: #6f42c1; }
.bot-type.unknown_bots { background: #f0f0f0; color: #495057; }

.url-column {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Beautiful Pagination */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
    font-size: 14px;
}

.pagination-info {
    color: #646970;
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.pagination-ellipsis {
    padding: 0 8px;
    color: #646970;
    font-weight: 600;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #c3c4c7;
    background: #fff;
    color: #0073aa;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover {
    background: #f8f9fa;
    border-color: #8c8f94;
    color: #005a87;
}

.pagination-btn:disabled,
.pagination-btn.disabled {
    background: #f6f7f7;
    color: #a7aaad;
    cursor: not-allowed;
    border-color: #dcdcde;
}

.pagination-btn.current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
    font-weight: 600;
}

.pagination-btn.current:hover {
    background: #005a87;
    border-color: #005a87;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
    font-style: italic;
}

.no-data {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
}

/* Dark Mode Support for Tables */
@media (prefers-color-scheme: dark) {
    .data-table {
        background: #1d2327;
        border-color: #3c434a;
    }
    
    .data-table th {
        background: #2c3338;
        color: #f0f0f1;
        border-bottom-color: #3c434a;
    }
    
    .data-table td {
        color: #f0f0f1;
        border-bottom-color: #3c434a;
    }
    
    .data-table tr:hover {
        background: #2c3338;
    }
    
    .pagination-btn {
        background: #2c3338;
        border-color: #3c434a;
        color: #f0f0f1;
    }
    
    .pagination-btn:hover {
        background: #3c434a;
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .rocketship-admin-card {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .rocketship-admin-card {
        padding: 12px;
    }
    
    .rocketship-admin-card h2 {
        font-size: 1.2em;
    }
    
    .data-table {
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
    
    .data-table th {
        font-size: 12px;
    }
    
    .table-controls {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .pagination-container {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .pagination-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .pagination-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 36px;
    }
}

@media (max-width: 480px) {
    .data-table th,
    .data-table td {
        padding: 8px 6px;
        font-size: 12px;
    }
    
    .url-column {
        max-width: 120px;
    }
} 

/* Clickable Category Cards */
.clickable-category,
.clickable-post-category {
    transition: all 0.2s ease;
}

.clickable-category:hover,
.clickable-post-category:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
    border-color: #2271b1 !important;
}

.clickable-category:active,
.clickable-post-category:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}

/* Category Details Modal */
.category-details-modal .modal-content {
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
}

.category-details-modal .category-bots-table {
    margin-top: 20px;
}

.category-details-modal .modal-content h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
    color: #1d2327;
}

.category-details-modal .close-modal:hover {
    background: #f0f0f0;
    border-radius: 50%;
}

.category-details-modal .wp-list-table th {
    background: #f9f9f9;
    border: 1px solid #c3c4c7;
}

.category-details-modal .wp-list-table td {
    border: 1px solid #c3c4c7;
} 