/* BotFend Block List :  Reuse all styles from logs page */
/* Modern Design (CSS A) Applied — All Functionality Preserved */

:root {
    --botfend-primary: #3b82f6;
    --botfend-border: #e2e8f0;
    --botfend-bg-light: #f8fafc;
    --botfend-radius: 12px;
    --botfend-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --botfend-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.botfend-wrap {
    max-width: 1400px;
    margin-top: 15px;
}

.botfend-header-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
    gap: 15px;
}

.botfend-page-title {
    margin: 0 !important;
    display: flex;
    align-items: center;
}

.botfend-card {
    background: #ffffff;
    border: 1px solid var(--botfend-border);
    border-radius: var(--botfend-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--botfend-shadow-sm);
    transition: all 0.2s ease;
}

.botfend-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: #cbd5e1;
}

.botfend-mb-20 { margin-bottom: 20px; }

.botfend-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.botfend-card-title {
    margin: 0;
    font-size: 1.2rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.botfend-card-description {
    margin: 0 0 20px 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

/* Statistics card */
.botfend-statistics-card {
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border-left: 4px solid var(--botfend-primary);
}

.botfend-statistics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.botfend-statistic-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.botfend-statistic-icon {
    width: 48px;
    height: 48px;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 12px;
    color: var(--botfend-primary);
    box-shadow: var(--botfend-shadow-sm);
}

.botfend-statistic-content {
    display: flex;
    flex-direction: column;
}

.botfend-statistic-number {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.botfend-statistic-label {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* Filter Form */
.botfend-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.botfend-filter-group {
    display: flex;
    flex-direction: column;
}

.botfend-filter-label {
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: #1e293b;
}

.botfend-filter-input,
.botfend-filter-select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    width: 100%;
    font-size: 13px;
    line-height: 1.5;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.botfend-filter-input:focus,
.botfend-filter-select:focus {
    border-color: var(--botfend-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.botfend-filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 16px;
}

/* Table Toolbar */
.botfend-table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 15px;
}

.botfend-bulk-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.botfend-log-stats {
    font-size: 13px;
    color: #64748b;
}

/* Empty State */
.botfend-empty-state {
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    color: #64748b;
}

.botfend-empty-state .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #94a3b8;
    margin-bottom: 15px;
}

/* Table Responsive with Horizontal Scroll */
.botfend-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    margin-bottom: 0;
}

/* Ensure table maintains minimum width for horizontal scroll */
.botfend-blocklist-table {
    min-width: 900px;
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.botfend-blocklist-table th,
.botfend-blocklist-table td {
    padding: 12px 8px;
    vertical-align: middle;
}

.botfend-blocklist-table th {
    font-weight: 600;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid #e2e8f0;
}

/* Column widths */
.botfend-col-select {
    width: 40px;
    min-width: 40px;
}

.botfend-col-ip {
    min-width: 180px;
}

.botfend-col-country {
    min-width: 80px;
}

.botfend-col-type {
    min-width: 130px;
}

.botfend-col-score {
    min-width: 70px;
}

.botfend-col-expires {
    min-width: 150px;
}

.botfend-col-actions {
    min-width: 180px;
}

/* IP cell */
.botfend-ip-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.botfend-ip-address {
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 8px;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    color: #1e293b;
    word-break: break-all;
    display: inline-block;
    width: fit-content;
}

.botfend-cidr-badge {
    background: var(--botfend-primary);
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    margin-left: 5px;
    display: inline-block;
}

.botfend-perpetual-badge {
    background: #f59e0b;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    margin-left: 5px;
    display: inline-block;
    font-weight: 500;
    text-transform: uppercase;
}

.botfend-ip-reason {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
    max-width: 300px;
}

/* Country cell */
.botfend-country-cell {
    display: inline-flex;
    align-items: center;
}

.botfend-country-flag {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.botfend-unknown {
    color: #94a3b8;
    font-style: italic;
}

/* Type badge */
.botfend-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.botfend-type-manual {
    background: #f0fdf4;
    color: #059669;
    border: 1px solid #bbf7d0;
}

.botfend-type-auto_block {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.botfend-type-iphub_block {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.botfend-type-abuseipdb_block {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.botfend-type-honeypot {
    background: #f5f3ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.botfend-type-brute_force {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.botfend-type-404_attack {
    background: #f5f3ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.botfend-type-advanced_404_block {
    background: #f5f3ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.botfend-type-permanent_manual {
    background: #dc2626;
    color: #ffffff;
    border: 1px solid #b91c1c;
}

.botfend-type-perpetual_offender {
    background: #f59e0b;
    color: #ffffff;
    border: 1px solid #d97706;
}

/* Score badge */
.botfend-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--score-color);
    color: #ffffff;
    font-weight: bold;
    font-size: 13px;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

/* Expiry cell */
.botfend-expiry-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.botfend-permanent {
    color: #dc2626;
    font-weight: 500;
}

.botfend-created-at {
    font-size: 11px;
    color: #94a3b8;
}

/* Action buttons */
.botfend-action-buttons {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.botfend-action-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    height: 28px;
    font-size: 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.botfend-action-unblock {
    background: #f0fdf4;
    color: #059669;
    border-color: #bbf7d0;
}

.botfend-action-unblock:hover {
    background: #bbf7d0;
    color: #047857;
}

.botfend-action-logs {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.botfend-action-logs:hover {
    background: #bfdbfe;
    color: #1d4ed8;
}

.botfend-action-permanent {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

.botfend-action-permanent:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #b91c1c;
}

.botfend-action-info {
    background: #f8fafc;
    color: #94a3b8;
    border-color: #e2e8f0;
    min-width: 28px;
    padding: 4px;
}

.botfend-action-info:hover {
    background: #e2e8f0;
    color: #475569;
}

.botfend-badge-permanent {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #f8fafc;
    border-radius: 8px;
    color: #10b981;
    cursor: default;
}

.botfend-badge-permanent .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.botfend-action-text {
    display: inline;
}

/* Bulk action bar */
.botfend-bulk-action-bar {
    position: sticky;
    top: 32px;
    z-index: 100;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    padding: 16px 24px;
    margin: 0 0 20px 0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.25);
    animation: botfendFadeIn 0.3s ease;
}

.botfend-bulk-action-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.botfend-bulk-action-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.botfend-bulk-action-info .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.botfend-bulk-action-text {
    font-size: 16px;
    font-weight: 500;
}

#botfend-selected-count {
    font-weight: 700;
    color: #fde68a;
}

.botfend-bulk-action-buttons {
    display: flex;
    gap: 10px;
}

.botfend-bulk-action-button {
    background: #ffffff;
    color: #3b82f6;
    border: none;
    font-weight: 500;
    padding: 8px 16px;
    height: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
}

.botfend-bulk-action-button:hover {
    background: #eff6ff;
    color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.botfend-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
}

.botfend-checkbox-label {
    font-size: 13px;
    color: #64748b;
    margin-left: 6px;
    vertical-align: middle;
}

.botfend-table-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.botfend-select-all {
    display: flex;
    align-items: center;
}

/* Quick block form */
.botfend-quick-block-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: flex-end;
}

.botfend-quick-block-input-group {
    flex: 1;
}

.botfend-input-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #1e293b;
    font-size: 13px;
}

.botfend-quick-block-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.botfend-quick-block-input:focus {
    border-color: var(--botfend-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.botfend-input-description {
    margin: 6px 0 0 0;
    font-size: 12px;
    color: #64748b;
}

.botfend-quick-block-actions {
    margin-bottom: 0;
}

.botfend-quick-block-button {
    min-height: 38px;
    padding: 0 24px;
    font-weight: 500;
    border-radius: 10px;
}

/* Modal styles */
.botfend-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.botfend-modal-backdrop {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.botfend-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: rankwell-modalIn 0.2s ease;
}

@keyframes rankwell-modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.botfend-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 16px 16px 0 0;
}

.botfend-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #1e293b;
}

.botfend-modal-close-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    border-radius: 8px;
}

.botfend-modal-close-icon:hover {
    background: #f1f5f9;
    color: #dc2626;
}

.botfend-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.botfend-details-grid {
    display: grid;
    gap: 16px;
}

.botfend-detail-item {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.botfend-detail-label {
    font-weight: 600;
    color: #1e293b;
    font-size: 13px;
    min-width: 100px;
    flex-shrink: 0;
}

.botfend-detail-value {
    flex: 1;
    font-size: 13px;
    color: #475569;
    word-break: break-word;
    line-height: 1.5;
}

.botfend-detail-section {
    grid-column: 1 / -1;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #eff6ff;
}

.botfend-detail-section-title {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================================
   DETECTION FACTORS UI (UPDATED TO MATCH JAVASCRIPT)
   ========================================================= */
.botfend-factors-container {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.botfend-factors-list {
    display: grid;
    gap: 12px;
    list-style: none !important;
    padding: 0;
    margin: 0;
}

.botfend-factor-item {
    padding: 14px;
    background: #ffffff;
    border-radius: 10px;
    border-left: 4px solid #3b82f6;
    border-top: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: var(--botfend-shadow-sm);
    transition: all 0.2s ease;
}

.botfend-factor-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Severity Indicators mapped to the JavaScript */
.botfend-factor-item.severity-critical {
    border-left-color: #dc2626;
    background: #fef2f2;
}

.botfend-factor-item.severity-warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.botfend-factor-item.severity-info {
    border-left-color: #3b82f6;
    background: #eff6ff;
}

/* Inner elements generated by JavaScript */
.factor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.factor-type {
    text-transform: capitalize;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.factor-time {
    font-size: 11px;
    color: #94a3b8;
}

.factor-description {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 8px;
}

.factor-score {
    display: inline-block;
    background: #fef2f2;
    color: #dc2626;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.botfend-no-factors {
    padding: 20px;
    text-align: center;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 8px;
}
/* ========================================================= */

.botfend-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
}

.botfend-modal-actions {
    display: flex;
    gap: 10px;
}

#botfend-modal-unblock,
#botfend-modal-logs {
    flex: 1;
    justify-content: center;
}

/* Admin Notices */
#botfend-admin-notices {
    margin: 20px 0;
}

.botfend-notice {
    margin: 0 0 10px 0 !important;
    border-left-color: #3b82f6 !important;
    animation: botfendNoticeFadeIn 0.3s ease;
}

.botfend-notice.notice-success {
    border-left-color: #10b981 !important;
}

.botfend-notice.notice-error {
    border-left-color: #ef4444 !important;
}

.botfend-notice.notice-warning {
    border-left-color: #f59e0b !important;
}

/* Summary stats */
.botfend-summary-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* URL placeholder for missing URLs */
.botfend-url-placeholder {
    color: #94a3b8;
    font-style: italic;
}

/* Animations */
@keyframes botfendNoticeFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes botfendFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile Responsive */
@media screen and (max-width: 782px) {
    .botfend-filter-grid {
        grid-template-columns: 1fr;
    }

    .botfend-quick-block-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .botfend-quick-block-actions {
        margin-bottom: 0;
    }

    .botfend-quick-block-button {
        width: 100%;
    }

    .botfend-bulk-action-bar {
        top: 46px;
        border-radius: 0;
        margin: -20px -20px 20px -20px;
        width: calc(100% + 40px);
    }

    .botfend-bulk-action-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .botfend-bulk-action-buttons {
        width: 100%;
    }

    .botfend-bulk-action-button {
        flex: 1;
        justify-content: center;
    }

    .botfend-action-text {
        display: none;
    }

    .botfend-action-button {
        min-width: 32px;
        padding: 4px 8px;
        justify-content: center;
    }

    .botfend-modal-content {
        max-width: calc(100vw - 40px);
    }

    .botfend-detail-label {
        min-width: 100px;
    }
}

@media screen and (max-width: 600px) {
    .botfend-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .botfend-statistics-grid {
        grid-template-columns: 1fr;
    }

    .botfend-statistic-item {
        justify-content: flex-start;
    }

    .botfend-filter-actions {
        flex-direction: column;
    }

    .botfend-filter-actions .button {
        width: 100%;
        justify-content: center;
    }

    .botfend-bulk-action-buttons {
        flex-direction: column;
    }

    .botfend-modal-actions {
        flex-direction: column;
    }

    .botfend-detail-item {
        flex-direction: column;
        gap: 4px;
    }

    .botfend-detail-label {
        min-width: auto;
    }
}