/*
 * Press & Hold CAPTCHA - Frontend Styles
 * Dynamic values (primary color, button height) are injected via CSS custom
 * properties on the .phc-container element through inline style in PHP.
 */

.phc-container {
    /* Defaults overridden by inline style from PHP */
    --phc-primary: #4CAF50;
    --phc-primary-light: #5CBF60;
    --phc-height: 50px;

    margin: 20px 0;
    width: 100%;
    max-width: 400px;
}

.phc-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.phc-button-wrapper {
    position: relative;
    width: 100%;
    height: var(--phc-height);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
}

.phc-button {
    position: relative;
    width: 100%;
    height: 100%;
    border: none;
    background: #e0e0e0;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    z-index: 2;
    outline: none;
}

.phc-button:active {
    transform: scale(0.98);
}

.phc-button.phc-holding {
    background: transparent;
    color: #fff;
}

.phc-button.phc-completed {
    background: var(--phc-primary);
    color: #fff;
    cursor: default;
}

.phc-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--phc-primary) 0%, var(--phc-primary-light) 100%);
    transition: width 0.05s linear;
    z-index: 1;
}

.phc-error {
    display: none;
    margin-top: 8px;
    padding: 10px;
    background: #ffebee;
    border-left: 4px solid #f44336;
    color: #c62828;
    font-size: 13px;
    border-radius: 4px;
}

.phc-error.phc-show {
    display: block;
    animation: phc-shake 0.5s;
}

.phc-success-icon {
    display: none;
    margin-left: 8px;
    animation: phc-checkmark 0.5s ease;
}

.phc-button.phc-completed .phc-success-icon {
    display: inline-block;
}

.phc-honeypot {
    position: absolute !important;
    /* left: -9999px !important; */
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

@keyframes phc-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes phc-checkmark {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Responsive */
@media (max-width: 768px) {
    .phc-container {
        max-width: 100%;
    }

    .phc-button {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .phc-button-wrapper {
        height: calc(var(--phc-height) - 5px);
    }

    .phc-button {
        font-size: 13px;
    }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    .phc-button:active {
        transform: scale(0.95);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .phc-label {
        color: #eee;
    }

    .phc-button {
        background: #444;
        color: #ccc;
    }

    .phc-error {
        background: #4a1a1a;
        color: #ff8a80;
    }
}
