/**
 * PB4Block Engine — In-House Zero-Dependency CAPTCHA Styling
 *
 * @package PB4Host_Security
 */

.pb4block-widget {
    display: block;
    margin: 14px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
}

.pb4block-widget * {
    box-sizing: border-box;
}

.pb4block-card {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 12px 14px;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s, box-shadow 0.2s;
    position: relative;
}

.pb4block-card:hover {
    border-color: #9ca3af;
}

.pb4block-card.pb4block-verified {
    border-color: #10b981;
    background: #f0fdf4;
}

.pb4block-card.pb4block-error {
    border-color: #ef4444;
    animation: pb4b-shake 0.4s ease-in-out;
}

@keyframes pb4b-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* Header & Branding */
.pb4block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
}

.pb4block-brand {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #374151;
    font-weight: 600;
    font-size: 11.5px;
}

.pb4block-brand svg {
    width: 14px;
    height: 14px;
    color: #2563eb;
}

.pb4block-mode-toggle {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
    text-decoration: underline;
}

.pb4block-mode-toggle:hover {
    color: #1d4ed8;
}

/* Interactive Checkbox Mode */
.pb4block-checkbox-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    cursor: pointer;
    user-select: none;
}

.pb4block-check-box {
    width: 28px;
    height: 28px;
    border: 2px solid #9ca3af;
    border-radius: 6px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    position: relative;
}

.pb4block-checkbox-row:hover .pb4block-check-box {
    border-color: #2563eb;
}

.pb4block-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: pb4b-spin 0.7s linear infinite;
    display: none;
}

@keyframes pb4b-spin {
    to { transform: rotate(360deg); }
}

.pb4block-check-icon {
    width: 18px;
    height: 18px;
    color: #10b981;
    display: none;
}

.pb4block-check-label {
    font-size: 13.5px;
    font-weight: 500;
    color: #1f2937;
    flex: 1;
}

/* Interactive Slider Mode */
.pb4block-slider-wrap {
    position: relative;
    height: 42px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 21px;
    overflow: hidden;
    user-select: none;
}

.pb4block-slider-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: #bfdbfe;
    transition: width 0.05s ease-out;
}

.pb4block-slider-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
    font-weight: 600;
    color: #6b7280;
    pointer-events: none;
}

.pb4block-slider-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: grab;
    touch-action: none;
    transition: background-color 0.2s;
    z-index: 2;
}

.pb4block-slider-thumb:active {
    cursor: grabbing;
    background: #1d4ed8;
}

/* Visual SVG & Math Mode */
.pb4block-visual-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pb4block-svg-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pb4block-svg-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 52px;
}

.pb4block-refresh-btn {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #4b5563;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.2s;
}

.pb4block-refresh-btn:hover {
    background: #f3f4f6;
    color: #111827;
    transform: rotate(45deg);
}

.pb4block-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pb4block-input-row input.pb4block-input {
    width: 100%;
    height: 36px;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    font-weight: 600;
    color: #111827;
}

.pb4block-input-row input.pb4block-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Status message */
.pb4block-status-msg {
    margin-top: 6px;
    font-size: 11px;
    color: #6b7280;
    line-height: 1.3;
}

.pb4block-status-msg.pb4block-msg-error {
    color: #dc2626;
    font-weight: 600;
}

.pb4block-status-msg.pb4block-msg-success {
    color: #059669;
    font-weight: 600;
}

/* Off-screen Honeypot Trap */
.pb4b-hp-field,
.pb4b-hp-field input,
.pb4b-hp-field label {
    display: none !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -99999px !important;
    height: 0 !important;
    width: 0 !important;
    z-index: -1 !important;
    pointer-events: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

/* Hard constraints to prevent unstyled SVG expansion */
.pb4block-brand svg,
svg.pb4block-brand-svg {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.pb4block-check-icon {
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    color: #10b981 !important;
    display: none;
    flex-shrink: 0 !important;
}
