/**
 * BotFend Anti-Bot Firewall - Admin Logs Styles
 * Modern Design (CSS A) Applied — All Functionality Preserved
 */

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

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

/* Section Summary styles (extracted from Logs.php) */
.botfend-section-summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    user-select: none;
    color: #1e293b;
    display: list-item;
    padding: 16px 20px;
    margin: -20px -20px 20px -20px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-bottom: 1px solid #e2e8f0;
    border-radius: 10px 10px 0 0;
    transition: all 0.2s ease;
}

.botfend-section-summary:hover {
    color: #3b82f6;
    background: #f8fafc;
}

.botfend-section-summary .dashicons {
    vertical-align: middle;
    margin-right: 5px;
    margin-top: -3px;
}

.botfend-card details:not([open]) > .botfend-section-summary {
    margin-bottom: -20px;
    border-bottom: none;
    border-radius: 10px;
}

.botfend-card[style*="padding: 0"] .botfend-section-summary {
    margin: 0;
}

.botfend-section-content {
    animation: botfendFadeIn 0.3s ease;
}

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

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

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

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

/* Buttons */
.botfend-btn-danger {
    color: #dc2626 !important;
    border-color: #dc2626 !important;
}

.botfend-btn-danger:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
}

.botfend-btn-success {
    color: #059669 !important;
    border-color: #059669 !important;
}

.botfend-btn-success:hover {
    background: #059669 !important;
    color: #ffffff !important;
}

/* Cards */
.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;
}

/* Smart Aggregation Notice */
.botfend-smart-agg-notice {
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #bfdbfe;
    border-left: 4px solid var(--botfend-primary);
    border-radius: var(--botfend-radius);
    padding: 16px 20px;
    margin: 0 0 20px 0;
}

.botfend-agg-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--botfend-primary);
    margin-bottom: 10px;
    font-size: 14px;
}

.botfend-smart-agg-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: #64748b;
}

.botfend-smart-agg-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.botfend-smart-agg-stat strong {
    color: #1e293b;
}

/* Badges */
.botfend-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 12px;
    vertical-align: middle;
}

.botfend-badge-info {
    background: #eff6ff;
    color: var(--botfend-primary);
    border: 1px solid #bfdbfe;
}

/* 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 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    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: 20px;
}

.botfend-logs-table {
    min-width: 800px;
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

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

.botfend-col-time {
    width: 160px;
    min-width: 160px;
}

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

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

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

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

.botfend-col-details {
    width: 60px;
    min-width: 60px;
}

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

.botfend-time-cell {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
}

/* IP & Location Blocks */
.botfend-ip-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

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

.botfend-blocked-icon {
    color: #ef4444;
    font-size: 16px;
    width: 16px;
    height: 16px;
}

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

/* Score & Status Action Pills */
.botfend-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--score-color);
    color: white;
    font-weight: bold;
    font-size: 13px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.botfend-action-label {
    display: inline-block;
    background-color: color-mix(in srgb, var(--action-color) 12%, transparent);
    color: var(--action-color);
    border: 1px solid color-mix(in srgb, var(--action-color) 40%, transparent);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Details Dropdown */
.botfend-details-dropdown {
    position: relative;
    display: inline-block;
}

.botfend-details-toggle {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    padding: 0 6px !important;
    min-height: 28px !important;
    line-height: 26px !important;
    border-radius: 6px !important;
}

.botfend-details-toggle:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}

.botfend-details-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 5px);
    z-index: 1000;
    width: 380px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    text-align: left;
}

.botfend-details-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 13px;
}

.botfend-detail-item {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
}

.botfend-detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.botfend-detail-label {
    font-weight: 600;
    color: #64748b;
    min-width: 70px;
    flex-shrink: 0;
}

.botfend-detail-value {
    color: #1e293b;
    word-break: break-word;
}

.badge-method {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    display: inline-block;
}

.code-path {
    font-family: monospace;
    color: #3b82f6;
    word-break: break-all;
}

.botfend-actions-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: #f8fafc;
    padding: 12px;
    border-radius: 10px;
    margin: -5px;
}

.botfend-action-button {
    font-size: 12px !important;
    padding: 4px 8px !important;
    height: auto !important;
    line-height: 1.4 !important;
    border-radius: 6px !important;
}

/* Pagination */
.botfend-pagination-wrapper {
    display: flex;
    justify-content: flex-end;
    padding: 20px 0;
}

.botfend-pagination-links .page-numbers {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 8px;
    text-decoration: none;
    margin-left: 5px;
    color: #3b82f6;
    transition: all 0.2s ease;
}

.botfend-pagination-links .page-numbers:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.botfend-pagination-links .page-numbers.current {
    background: linear-gradient(135deg, #3b82f6 0%, #2271b1 100%);
    color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

/* Modal Styling */
.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.6);
    backdrop-filter: blur(3px);
}

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

@keyframes botfendModalIn {
    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: 6px;
    transition: all 0.2s ease;
}

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

.botfend-modal-body {
    padding: 0;
    overflow-y: auto;
    background: #1e1e1e;
    border-radius: 0 0 16px 16px;
}

.botfend-json-view pre {
    margin: 0;
    padding: 20px;
    color: #d4d4d4;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}

.clearing-progress {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    padding: 24px 32px;
    border-radius: 12px;
    box-shadow: var(--botfend-shadow-md);
    z-index: 100001;
    text-align: center;
}

.clearing-progress h3 {
    margin-top: 0;
}

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

    .botfend-table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .botfend-bulk-actions {
        justify-content: center;
    }

    .botfend-details-content {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90vw;
        max-width: 400px;
        max-height: 80vh;
        overflow-y: auto;
        z-index: 99999;
    }

    .botfend-details-toggle {
        padding: 4px 8px !important;
    }

    .botfend-action-label {
        font-size: 11px;
        padding: 3px 8px;
    }

    .botfend-score-badge {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .botfend-ip-address {
        font-size: 12px;
        padding: 3px 6px;
    }

    .botfend-logs-table th,
    .botfend-logs-table td {
        padding: 10px 6px;
    }
}

@media screen and (max-width: 480px) {
    .botfend-header-area {
        flex-direction: column;
        align-items: flex-start;
    }

    .botfend-header-actions {
        width: 100%;
        justify-content: stretch;
    }

    .botfend-header-actions .button {
        flex: 1;
        text-align: center;
    }

    .botfend-logs-table {
        min-width: 700px;
    }
}

/* Refresh bar */
.botfend-refresh-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #bfdbfe;
    border-radius: 10px;
}

@media (max-width: 480px) {
    .botfend-refresh-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .botfend-refresh-bar .button {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* ============================================
   TOAST NOTIFICATIONS — Modern Design
   ============================================ */
.botfend-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: 12px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateX(400px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
}

.botfend-toast.show {
    transform: translateX(0);
}

.botfend-toast.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.botfend-toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.botfend-toast.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.botfend-toast .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.botfend-toast.success .dashicons:before {
    content: "\f147";
}

.botfend-toast.error .dashicons:before {
    content: "\f158";
}

.botfend-toast.warning .dashicons:before {
    content: "\f534";
}

/* Spin animation for refresh icons */
.dashicons-update-spin {
    animation: botfend-spin 1s infinite linear;
    display: inline-block;
}

@keyframes botfend-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}