/**
 * Cloudflare Integration Admin Styles for BotFend Anti-Bot Firewall
 *
 * @package BotFend\Assets\CSS
 * @since 4.9.0
 */

/* Status Dashboard Grid */
.botfend-cf-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

/* Card Styles */
.botfend-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.botfend-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Rule Cards */
.botfend-rule-card {
    transition: all 0.2s ease;
}

.botfend-rule-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Rule Badges */
.botfend-rule-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #2271b1;
    color: #fff;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.botfend-rule-badge.challenge {
    background: #f0ad4e;
}

.botfend-rule-badge.js-challenge {
    background: #5bc0de;
}

.botfend-rule-badge.managed-challenge {
    background: #9b59b6;
}

.botfend-rule-badge.block {
    background: #dc3232;
}

/* Health Status Colors */
.botfend-health-good {
    color: #46b450;
    font-weight: 500;
}

.botfend-health-warning {
    color: #f0ad4e;
    font-weight: 500;
}

.botfend-health-error {
    color: #dc3232;
    font-weight: 500;
}

/* Credential Input Styling */
.botfend-credential-input {
    font-family: monospace;
    letter-spacing: 0.5px;
}

/* IP Whitelist Textarea */
.botfend-ip-whitelist {
    font-family: monospace;
    min-height: 100px;
}

/* Remove IP Button */
.botfend-remove-ip {
    cursor: pointer;
    text-decoration: none;
}

.botfend-remove-ip:hover {
    text-decoration: underline;
}

/* Action Status Messages */
#botfend-cf-action-status {
    margin-top: 10px;
    font-weight: 500;
    min-height: 20px;
}

/* Test Result Styling */
#botfend-cf-test-result {
    margin-left: 10px;
    font-weight: 500;
}

/* Mobile Responsive Table */
.botfend-mobile-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.botfend-mobile-table table {
    min-width: 600px;
    width: 100%;
}

/* Form Table Improvements */
.form-table th {
    font-weight: 500;
}

/* Button Icons */
.button .dashicons,
.button-primary .dashicons,
.button-secondary .dashicons {
    vertical-align: middle;
    margin-top: -2px;
    margin-right: 5px;
}

/* Credential Section Grouping */
#cf-key-section,
#cf-token-section {
    background: #f9f9f9;
}

#cf-key-section th,
#cf-token-section th,
#cf-key-row th,
#cf-token-row th {
    padding-top: 15px;
}

/* Responsive Adjustments */
@media screen and (max-width: 768px) {
    .botfend-cf-status-grid {
        grid-template-columns: 1fr;
    }

    .botfend-mobile-table {
        margin: 0 -15px;
        padding: 0 15px;
    }

    .botfend-mobile-table table {
        margin: 0;
    }

    .botfend-mobile-table th,
    .botfend-mobile-table td {
        white-space: nowrap;
    }

    .form-table td {
        padding: 10px 0;
    }

    .button .dashicons {
        margin-right: 3px;
    }
}

/* Small screen adjustments */
@media screen and (max-width: 480px) {
    .botfend-card {
        padding: 15px;
    }

    .botfend-rule-badge {
        font-size: 9px;
        padding: 1px 6px;
    }

    .botfend-card h3 {
        font-size: 16px;
    }
}

/* Loading State */
.botfend-cf-loading {
    opacity: 0.6;
    pointer-events: none;
}

.botfend-cf-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><circle cx="12" cy="12" r="10" fill="none" stroke="%23333" stroke-width="2" stroke-dasharray="31.4 31.4" stroke-linecap="round"><animateTransform attributeName="transform" type="rotate" from="0 12 12" to="360 12 12" dur="1s" repeatCount="indefinite"/></circle></svg>') no-repeat center;
    background-size: contain;
    vertical-align: middle;
}

/* Tooltip/Hover Effects */
.botfend-rule-card code {
    background: #f0f0f1;
    padding: 2px 6px;
    border-radius: 3px;
}

/* Expired IP Styling */
td .expired-badge {
    color: #dc3232;
    font-size: 11px;
    margin-left: 5px;
}

/* Notice Enhancements */
.notice p {
    margin: 12px 0;
}

/* Action Buttons Container */
.botfend-cf-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* Delete Rule Button */
.botfend-delete-rule {
    border-color: #dc3232 !important;
    color: #dc3232 !important;
}

.botfend-delete-rule:hover {
    background: #dc3232 !important;
    color: #fff !important;
    border-color: #dc3232 !important;
}