/* BotShield CAPTCHA Frontend Styles */

.botshield-captcha {
    margin: 15px 0 20px 0;
    max-width: 100%;
}

.botshield-captcha-challenge {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    position: relative;
    margin-bottom: 5px;
}

/* Helper Text */
.botshield-captcha-helper {
    font-size: 14px;
    color: #50575e;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.botshield-captcha-arithmetic .botshield-captcha-question {
    font-size: 24px; /* Increased font size */
    font-weight: 600;
    color: #1d2327;
    background: none;
    padding: 0;
    border: none;
    min-width: auto;
    text-align: left;
    display: block;
    margin-bottom: 4px;
}

/* Image CAPTCHA Container */
.botshield-captcha-image-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    vertical-align: middle;
    height: auto;
    min-height: 60px;
    margin-bottom: 8px;
}

.botshield-captcha-img {
    display: block;
    height: 100%;
    width: auto;
    object-fit: contain;
    min-width: 120px;
}

/* Refresh Button */
.botshield-captcha-refresh {
    background: #f6f7f7;
    border: none;
    color: #50575e;
    padding: 0 12px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.botshield-captcha-refresh:hover,
.botshield-captcha-refresh:focus {
    color: #2271b1;
    background: #f0f0f1;
    outline: none;
}

.botshield-captcha-refresh .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.botshield-captcha-refresh-link {
    font-size: 13px;
    margin: 5px 0 0 0;
}

.botshield-captcha-refresh-link a {
    text-decoration: none;
    color: #2271b1;
    border-bottom: 1px dashed #2271b1;
}

.botshield-captcha-refresh-link a:hover {
    color: #135e96;
    border-bottom-style: solid;
}

/* Inputs */
.botshield-captcha-input {
    padding: 8px 12px !important;
    border: 1px solid #8c8f94 !important;
    border-radius: 4px !important;
    font-size: 15px !important;
    line-height: normal !important;
    height: 40px !important;
    box-sizing: border-box !important;
    background: #fff !important;
    color: #2c3338 !important;
    margin: 0 !important;
    width: 100% !important; 
    max-width: 320px !important; /* Wider input */
    transition: all 0.2s ease !important;
}

.botshield-captcha-input::placeholder {
    color: #a0a0a0;
    opacity: 1;
}

.botshield-captcha-arithmetic .botshield-captcha-input {
    max-width: 320px !important; /* Match image input width */
    text-align: left; /* Left align for math too */
}

.botshield-captcha-input:focus {
    border-color: #2271b1 !important;
    box-shadow: 0 0 0 1px #2271b1 !important;
    outline: 2px solid transparent !important;
}

/* Loader */
.botshield-captcha-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: botshield-spin 1s linear infinite;
    position: absolute;
    right: 10px;
    top: 50%;
    margin-top: -8px;
    pointer-events: none;
}

.botshield-captcha-loading .botshield-captcha-loader {
    display: block;
}

.botshield-captcha-loading .dashicons {
    display: none; /* Hide refresh icon when loading */
}

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

/* Validation States */
.wpcf7-not-valid .botshield-captcha-input {
    border-color: #d63638 !important;
}

.wpcf7-not-valid + .wpcf7-not-valid-tip {
    margin-top: 5px;
    font-size: 13px;
}

/* Responsive */
@media screen and (max-width: 480px) {
    .botshield-captcha-challenge {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .botshield-captcha-input,
    .botshield-captcha-arithmetic .botshield-captcha-input {
        max-width: 100% !important;
    }
    
    .botshield-captcha-image-container {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }
}
/* Screen Reader Announcer */
.botshield-captcha-announcer {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Global Error Message */
.botshield-captcha-error {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #d63638;
    color: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 99999;
    max-width: 300px;
    display: none;
}
