/**
 * @package     Joomla.Plugin
 * @subpackage  Captcha.mathcaptcha
 *
 * @copyright   (C) 2025 Weinvierterl - www.weinvierterl.at
 * @license     GNU General Public License version 2 or later
 */

/* Basis-Styling für alle MathCaptcha-Instanzen */
.mathcaptcha-container {
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    max-width: 400px;
    background-color: #f0f8ff; /* Leichtes Blau */
    border: 1px solid #b0c4de;
}

.mathcaptcha-question {
    display: block;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 12px;
    padding: 0 0 8px 0;
    color: #4682b4; /* Stahlblau */
    font-family: 'Arial', sans-serif;
    border-bottom: 1px solid rgba(176, 196, 222, 0.5);
}

.mathcaptcha-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
    width: 100%;
}

.mathcaptcha-container input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #b0c4de;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.8);
}

.mathcaptcha-container input[type="text"]:focus {
    outline: none;
    border-color: #4682b4;
    box-shadow: 0 0 8px rgba(70, 130, 180, 0.4);
    background-color: #ffffff;
}

/* Aktiver Zustand */
.mathcaptcha-active {
    box-shadow: 0 4px 12px rgba(70, 130, 180, 0.2) !important;
}

/* Input validierungsstatus */
.mathcaptcha-invalid,
input.invalid {
    border-color: #e74c3c !important;
    background-color: rgba(251, 236, 236, 0.8) !important;
}

/* Fehlertext Styling */
.invalid-feedback {
    color: #e74c3c;
    font-size: 14px;
    display: none;
    margin-bottom: 8px;
}

.invalid-feedback.show {
    display: block;
}

/* Formularfehler */
.mathcaptcha-form-error {
    color: #e74c3c;
    background-color: #fef4f4;
    border: 1px solid #e74c3c;
    border-radius: 4px;
    padding: 10px 15px;
    margin-bottom: 20px;
    font-size: 15px;
}

/* Reload-Button Styling */
.mathcaptcha-reload-btn {
    background-color: rgba(70, 130, 180, 0.1);
    border: none;
    cursor: pointer;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
    color: #4682b4;
    min-width: 36px;
    height: 36px;
}

.mathcaptcha-reload-btn:hover {
    background-color: rgba(70, 130, 180, 0.2);
}

.mathcaptcha-reload-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.5s ease-in-out;
}

/* Animation für Reload-Button */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.mathcaptcha-reload-icon.rotating {
    animation: spin 0.5s ease-in-out;
}

/* Styling für barrierefreie Elemente */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Responsive Verhalten */
@media (max-width: 480px) {
    .mathcaptcha-container {
        max-width: 100%;
    }
}

/* VirtueMart spezifische Styles */
.vm-registration-page .mathcaptcha-container,
.vm-cart-page .mathcaptcha-container {
    margin: 15px auto;
    max-width: 100%;
}

/* Dark Mode Unterstützung */
@media (prefers-color-scheme: dark) {
    .mathcaptcha-container:not(.mathcaptcha-style-light):not(.mathcaptcha-style-custom):not(.mathcaptcha-style-default) {
        background-color: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .mathcaptcha-container:not(.mathcaptcha-style-light):not(.mathcaptcha-style-custom):not(.mathcaptcha-style-default) .mathcaptcha-question {
        color: #3498db;
        border-bottom-color: rgba(52, 73, 94, 0.6);
    }
    
    .mathcaptcha-container:not(.mathcaptcha-style-light):not(.mathcaptcha-style-custom):not(.mathcaptcha-style-default) input[type="text"] {
        background-color: rgba(44, 62, 80, 0.7);
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .mathcaptcha-container:not(.mathcaptcha-style-light):not(.mathcaptcha-style-custom):not(.mathcaptcha-style-default) input[type="text"]:focus {
        border-color: #3498db;
        box-shadow: 0 0 8px rgba(52, 152, 219, 0.4);
        background-color: rgba(44, 62, 80, 0.9);
    }
    
    .mathcaptcha-container:not(.mathcaptcha-style-light):not(.mathcaptcha-style-custom):not(.mathcaptcha-style-default) .mathcaptcha-reload-btn {
        background-color: rgba(52, 152, 219, 0.1);
        color: #3498db;
    }
    
    .mathcaptcha-container:not(.mathcaptcha-style-light):not(.mathcaptcha-style-custom):not(.mathcaptcha-style-default) .mathcaptcha-reload-btn:hover {
        background-color: rgba(52, 152, 219, 0.2);
    }
    
    .invalid-feedback {
        color: #f75353;
    }
}