/**
 * BotFend Anti-Bot Firewall Settings Page CSS
 * Modern Design (CSS A) Applied — All Functionality Preserved
 * Styles for collapsible sections, status dashboards, range sliders, and settings UI
 *
 * @since 4.6.0
 */

/* ============================================
   Status Dashboard
   ============================================ */

.botfend-status-dashboard {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border-left: 4px solid #3b82f6;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.botfend-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 15px;
}

.botfend-status-card {
    background: #ffffff;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

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

.botfend-status-enabled {
    color: #10b981;
    font-weight: 600;
}

.botfend-status-disabled {
    color: #ef4444;
    font-weight: 600;
}

.botfend-status-warning {
    color: #f59e0b;
    font-weight: 600;
}

.botfend-status-info {
    color: #3b82f6;
    font-weight: 600;
}

/* TOR Last Updated Date Formatting */
#botfend_tor_last_updated {
    color: #10b981 !important;
    font-weight: 600;
}


/* ============================================
   Collapsible Sections
   ============================================ */

.botfend-collapsible-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.2s ease;
}

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

.botfend-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.2s ease;
}

.botfend-section-header:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #f8fafc 100%);
}

.botfend-section-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    flex: 1;
    color: #1e293b;
}

.botfend-section-header .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.botfend-section-header .toggle-icon {
    color: #64748b;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.botfend-section-content {
    padding: 20px;
    border-top: none;
}

.botfend-section-content .form-table {
    margin-top: 0;
}

.botfend-section-content .form-table th {
    width: 200px;
}

.botfend-info-icon {
    color: #3b82f6;
    cursor: help;
    margin-left: auto;
    transition: color 0.2s ease;
}

.botfend-info-icon:hover {
    color: #2563eb;
}


/* ============================================
   Range Sliders
   ============================================ */

.botfend-range-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.botfend-range-wrapper input[type="range"] {
    flex: 1;
    min-width: 200px;
}

.botfend-range-wrapper output {
    min-width: 40px;
    font-weight: 600;
    background: #f8fafc;
    padding: 4px 10px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
    color: #1e293b;
}


/* ============================================
   Number Inputs
   ============================================ */

.botfend-number-input {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.botfend-number-input input[type="number"] {
    text-align: center;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 6px 10px;
}

.botfend-number-input input[type="number"]:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}


/* ============================================
   Select Dropdowns
   ============================================ */

.botfend-select-full {
    max-width: 400px;
}

.botfend-select-full select {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
}

.botfend-select-full select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}


/* ============================================
   Weight Rows (for detection pattern weights)
   ============================================ */

.botfend-weight-row {
    margin-bottom: 15px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.botfend-weight-row span {
    display: block;
    margin-bottom: 8px;
    color: #1e293b;
    font-weight: 500;
}

.botfend-weight-row .botfend-range-wrapper {
    margin-top: 5px;
}


/* ============================================
   Exemption Checkboxes
   ============================================ */

.botfend-exemption-checkbox {
    margin-bottom: 10px;
}

.botfend-exemption-checkbox label {
    display: block;
    margin-bottom: 5px;
}

.botfend-exemption-checkbox .description {
    margin-left: 28px;
}


/* ============================================
   Sortable Lists (for IP headers)
   ============================================ */

.botfend-sortable-list {
    background: #f8fafc;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.botfend-sortable-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 6px;
    cursor: move;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.botfend-sortable-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border-color: #cbd5e1;
}

.botfend-sortable-item:last-child {
    margin-bottom: 0;
}

.botfend-sortable-item .dashicons-menu {
    color: #94a3b8;
    cursor: grab;
}

.botfend-sortable-placeholder {
    background: #f1f5f9;
    border: 2px dashed #94a3b8;
    height: 40px;
    margin-bottom: 6px;
    border-radius: 8px;
}


/* ============================================
   Spin Animation
   ============================================ */

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

.spin {
    animation: spin 1s linear infinite;
}


/* ============================================
   Notice Styles
   ============================================ */

.botfend-settings-notice {
    margin: 20px 0;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
}

.botfend-settings-notice.success {
    background: #f0fdf4;
    border-left: 4px solid #10b981;
    color: #065f46;
}

.botfend-settings-notice.warning {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.botfend-settings-notice.error {
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

.botfend-settings-notice.info {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}


/* ============================================
   Sensitive Path Patterns Grid
   ============================================ */

.botfend-patterns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    background: #f8fafc;
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
}

.botfend-patterns-grid div {
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.botfend-patterns-grid code {
    background: #ffffff;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    border: 1px solid #e2e8f0;
}

.botfend-patterns-grid div:hover {
    background: #eff6ff;
}


/* ============================================
   Quick Actions Section
   ============================================ */

.botfend-quick-actions {
    margin: 20px 0;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.botfend-quick-actions h4 {
    margin: 0 0 10px 0;
    color: #1e293b;
}

.botfend-quick-actions .button {
    margin-right: 10px;
    transition: all 0.2s ease;
}

.botfend-quick-actions .button .dashicons {
    vertical-align: middle;
    margin-top: -2px;
}


/* ============================================
   TOR Statistics Cards
   ============================================ */

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

.botfend-stats-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

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

.botfend-stats-card .dashicons {
    font-size: 30px;
    width: 30px;
    height: 30px;
    color: #3b82f6;
}

.botfend-stats-card h4 {
    margin: 10px 0 5px;
    color: #1e293b;
}

.botfend-stats-card .stats-number {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}


/* ============================================
   Form Submit Container
   ============================================ */

.submit-container {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.botfend-unsaved-indicator {
    color: #92400e;
    background: #fffbeb;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid #fde68a;
}

.botfend-unsaved-indicator .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
}


/* ============================================
   Import Form
   ============================================ */

.botfend-import-form {
    margin-top: 15px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.botfend-import-form h4 {
    margin-top: 0;
    color: #1e293b;
}

.botfend-import-form input[type="file"] {
    width: 100%;
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}


/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 782px) {
    .botfend-section-header {
        padding: 12px 15px;
    }
    
    .botfend-section-content {
        padding: 15px;
    }
    
    .botfend-section-content .form-table th {
        width: 100%;
        padding-bottom: 0;
    }
    
    .botfend-range-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .botfend-range-wrapper input[type="range"] {
        width: 100%;
    }
    
    .botfend-status-grid {
        grid-template-columns: 1fr;
    }
    
    .botfend-patterns-grid {
        grid-template-columns: 1fr;
    }
    
    .botfend-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .botfend-quick-actions .button {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .submit-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .botfend-select-full {
        max-width: 100%;
    }
}


/* ============================================
   Utility Classes
   ============================================ */

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

.botfend-text-right {
    text-align: right;
}

.botfend-mt-10 {
    margin-top: 10px;
}

.botfend-mt-15 {
    margin-top: 15px;
}

.botfend-mt-20 {
    margin-top: 20px;
}

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

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

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


/* ============================================
   File Permission Inline Viewer Styles 
   ============================================ */

.botfend-permission-details-container {
    background: rgba(255, 255, 255, 0.7);
    padding: 12px 15px;
    border-radius: 8px;
}

.botfend-permission-file-list li {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #fecaca;
    font-size: 13px;
}

.botfend-permission-file-list li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.botfend-file-path {
    background: #ffffff;
    padding: 3px 8px;
    color: #ef4444;
    border: 1px solid #fecaca;
    border-radius: 6px;
    word-break: break-all;
    display: inline-block;
    margin-bottom: 4px;
}

.botfend-file-reason {
    color: #64748b;
    font-style: italic;
}

.botfend-badge-fixed {
    background: #10b981;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    font-style: normal;
}

/* File Permission Values Formatting (Badges) */
.botfend-file-perms {
    margin: 8px 0;
    font-size: 12px;
    font-family: Consolas, Monaco, monospace;
    display: flex;
    align-items: center;
    gap: 8px;
}

.botfend-perm-current {
    background: #fef2f2;
    color: #ef4444;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid #fecaca;
    font-weight: 600;
}

.botfend-perm-required {
    background: #f0fdf4;
    color: #10b981;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
    font-weight: 600;
}

.botfend-perm-arrow {
    color: #94a3b8;
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.botfend-file-meta {
    margin-top: 4px;
}

.botfend-code-block {
    background: #f8fafc;
    padding: 12px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* ============================================
   Toast Notifications (Settings Page)
   ============================================ */

.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 10px 25px 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: #10b981;
}

.botfend-toast.error {
    background: #ef4444;
}

.botfend-toast.warning {
    background: #f59e0b;
}

.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";
}