/**
 * @author       Zbigniew Stanejko <info@prestashop.cc>
 * @copyright    © 2012-2026 Zbigniew Stanejko, PrestaPremium. All rights reserved.
 * @license      This program is not free software. You may not sell or distribute it.
 * @link         https://prestapremium.com
 * ----------------------------------------------
 * @file         pprecaptcha.css
 * @updated      2026-03-17
 * @description  Styles for local reCAPTCHA component.
 * version       1.1.0
 * ----------------------------------------------
 */

/* ============================================================================
   PP RECAPTCHA - Universal Component Styles
   ========================================================================== */

/* Main container */
.pprecaptcha-container {
    margin: 20px 0;
    position: relative;
}

/* Wrapper for reCAPTCHA widget */
.pprecaptcha-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 78px; /* v2 checkbox default height */
    position: relative;
}

/* reCAPTCHA widget base styles */
.pprecaptcha-widget {
    margin: 0 auto;
}

/* v2 Checkbox specific */
.pprecaptcha-widget[data-version="v2_checkbox"] {
    transform-origin: center;
}

/* v2 Invisible - hidden by default */
.pprecaptcha-widget[data-version="v2_invisible"] {
    display: none;
}

/* v3 - completely hidden */
.pprecaptcha-token[data-version="v3"] {
    display: none !important;
}

/* Error message container */
.pprecaptcha-error {
    display: none;
    margin-top: 8px;
    padding: 10px 15px;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    font-size: 14px;
    line-height: 1.5;
    animation: pprecaptcha-fadeIn 0.3s ease-in-out;
}

.pprecaptcha-error.show,
.pprecaptcha-error:not(:empty) {
    display: block;
}

/* Error icon */
.pprecaptcha-error::before {
    content: "⚠️ ";
    font-size: 16px;
    margin-right: 6px;
}

/* Loading state */
.pprecaptcha-wrapper.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: pprecaptcha-spin 1s linear infinite;
}

/* Loading spinner animation */
@keyframes pprecaptcha-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fade in animation */
@keyframes pprecaptcha-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   RESPONSIVE STYLES
   ========================================================================== */

/* Mobile optimization */
@media (max-width: 480px) {
    .pprecaptcha-container {
        margin: 15px 0;
    }
    
    .pprecaptcha-wrapper {
        min-height: 78px;
    }
    
    /* Scale down reCAPTCHA on very small screens */
    .pprecaptcha-widget[data-version="v2_checkbox"] {
        transform: scale(0.9);
        transform-origin: 0 0;
    }
    
    .pprecaptcha-error {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .pprecaptcha-container {
        margin: 18px 0;
    }
}

/* Desktop */
@media (min-width: 769px) {
    .pprecaptcha-container {
        margin: 20px 0;
    }
}

/* ============================================================================
   THEME INTEGRATION
   ========================================================================== */

/* Light theme (default) */
.pprecaptcha-container[data-theme="light"] .pprecaptcha-wrapper {
    background-color: transparent;
}

/* Dark theme support */
.pprecaptcha-container[data-theme="dark"] .pprecaptcha-wrapper {
    background-color: #1a1a1a;
    border-radius: 8px;
    padding: 10px;
}

.pprecaptcha-container[data-theme="dark"] .pprecaptcha-error {
    background-color: #2d1f1f;
    border-color: #7f1d1d;
    color: #fca5a5;
}

/* ============================================================================
   ACCESSIBILITY
   ========================================================================== */

/* Focus state for accessibility */
.pprecaptcha-widget:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pprecaptcha-error {
        border-width: 2px;
        font-weight: 600;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .pprecaptcha-error,
    .pprecaptcha-wrapper.loading::after {
        animation: none;
    }
    
    .pprecaptcha-error {
        opacity: 1;
        transform: none;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ========================================================================== */

/* Center alignment */
.pprecaptcha-center {
    text-align: center;
}

/* Compact mode - less spacing */
.pprecaptcha-compact {
    margin: 10px 0;
}

.pprecaptcha-compact .pprecaptcha-wrapper {
    min-height: 60px;
}

.pprecaptcha-compact .pprecaptcha-error {
    margin-top: 5px;
    padding: 6px 10px;
    font-size: 12px;
}

/* Hidden state */
.pprecaptcha-hidden {
    display: none !important;
}

/* Disabled state */
.pprecaptcha-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* ============================================================================
   INTEGRATION WITH FORMS
   ========================================================================== */

/* When inside a form group */
.form-group .pprecaptcha-container {
    margin-top: 15px;
    margin-bottom: 15px;
}

/* Bootstrap integration */
.form-group.has-error .pprecaptcha-container {
    animation: pprecaptcha-shake 0.5s ease-in-out;
}

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

/* ============================================================================
   PRESTASHOP SPECIFIC
   ========================================================================== */

/* PrestaShop modal integration */
.modal-body .pprecaptcha-container {
    margin: 15px 0;
}

/* PrestaShop checkout integration */
#checkout .pprecaptcha-container {
    margin: 15px 0;
    padding: 15px;
    background-color: #f9fafb;
    border-radius: 8px;
}

/* End of CSS file */
