/**
 * Enhanced Form Styles - Validation & Anti-Spam
 *
 * @package     com_roomavailabilitycalendar
 * @copyright   Copyright (C) 2024 Your Name. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

/* ==========================================================================
   PHONE INPUT WITH COUNTRY SELECTOR
   ========================================================================== */

.phone-input-container {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.country-select {
    flex: 0 0 140px;
    min-width: 140px;
    font-size: 14px;
    border-radius: 4px 0 0 4px;
    border-right: none;
}

.phone-input {
    flex: 1;
    border-radius: 0 4px 4px 0;
    border-left: none;
}

.phone-input:focus {
    border-left: 1px solid #337ab7;
}

.country-select:focus + .phone-input {
    border-left: 1px solid #337ab7;
}

/* Mobile responsiveness for phone input */
@media (max-width: 480px) {
    .phone-input-container {
        flex-direction: column;
        gap: 5px;
    }

    .country-select,
    .phone-input {
        flex: none;
        border-radius: 4px;
        border: 1px solid #ddd;
    }
}

/* ==========================================================================
   VALIDATION FEEDBACK STYLES
   ========================================================================== */

/* Valid field styling */
.form-control.is-valid {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

.form-control.is-valid:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.3);
}

/* Invalid field styling */
.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

.form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.3);
}

/* Validation feedback messages */
.validation-feedback {
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.4;
}

.invalid-feedback {
    color: #dc3545;
}

.valid-feedback {
    color: #28a745;
}

/* Validation icons */
.form-control.is-valid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.94-.94 2.94 2.94L7.66 7.27 6.72 6.33 3.78 3.39 1.84 5.33z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 35px;
}

.form-control.is-invalid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.25 5.25 1.5 1.5m0-1.5-1.5 1.5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 35px;
}

/* ==========================================================================
   FORM SECURITY INDICATORS
   ========================================================================== */

.form-security-info {
    margin-top: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-left: 4px solid #17a2b8;
    border-radius: 0 4px 4px 0;
    font-size: 12px;
    color: #6c757d;
}

.form-security-info::before {
    content: "🔒";
    margin-right: 5px;
}

/* Honeypot field (should be invisible) */
input[name="website"] {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    tab-index: -1 !important;
}

/* ==========================================================================
   ENHANCED FIELD LABELS WITH REQUIREMENTS
   ========================================================================== */

.field-requirements {
    font-size: 11px;
    color: #6c757d;
    margin-top: 2px;
    font-style: italic;
}

.field-requirements.valid {
    color: #28a745;
}

.field-requirements.invalid {
    color: #dc3545;
}

/* Required field indicator */
.required-field::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* ==========================================================================
   FORM PROGRESS INDICATOR
   ========================================================================== */

.form-progress {
    margin-bottom: 20px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    height: 4px;
}

.form-progress-bar {
    height: 100%;
    background-color: #28a745;
    transition: width 0.3s ease;
}

/* ==========================================================================
   EMAIL DOMAIN SUGGESTIONS
   ========================================================================== */

.email-suggestions {
    margin-top: 5px;
    padding: 8px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    font-size: 12px;
    display: none;
}

.email-suggestions.show {
    display: block;
}

.email-suggestion {
    color: #856404;
    cursor: pointer;
    text-decoration: underline;
}

.email-suggestion:hover {
    color: #533f03;
}

/* ==========================================================================
   FORM ANTI-SPAM VISUAL FEEDBACK
   ========================================================================== */

.spam-detected {
    background-color: #f8d7da !important;
    border-color: #f5c6cb !important;
    color: #721c24 !important;
}

.form-timing-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 15px;
    color: #856404;
    font-size: 13px;
    display: none;
}

.form-timing-warning.show {
    display: block;
}

/* ==========================================================================
   LOADING STATES FOR VALIDATION
   ========================================================================== */

.field-validating {
    position: relative;
}

.field-validating::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #337ab7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ==========================================================================
   FORM STRENGTH INDICATORS
   ========================================================================== */

.form-strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.strength-indicator {
    height: 4px;
    flex: 1;
    background-color: #e9ecef;
    border-radius: 2px;
    transition: background-color 0.3s ease;
}

.strength-indicator.weak {
    background-color: #dc3545;
}

.strength-indicator.medium {
    background-color: #ffc107;
}

.strength-indicator.strong {
    background-color: #28a745;
}

/* ==========================================================================
   COUNTRY FLAGS AND FORMATTING
   ========================================================================== */

.country-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.country-flag {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.country-name {
    flex: 1;
}

.country-code {
    font-size: 11px;
    color: #6c757d;
    font-family: monospace;
}

/* ==========================================================================
   ENHANCED BUTTON STATES
   ========================================================================== */

.btn.submitting {
    position: relative;
    color: transparent !important;
}

.btn.submitting::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn.submitting:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

/* ==========================================================================
   FORM ERROR SUMMARY
   ========================================================================== */

.form-errors {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    display: none;
}

.form-errors.show {
    display: block;
}

.form-errors-title {
    font-weight: bold;
    color: #721c24;
    margin-bottom: 8px;
}

.form-errors-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.form-errors-list li {
    color: #721c24;
    margin-bottom: 4px;
    position: relative;
    padding-left: 16px;
}

.form-errors-list li::before {
    content: "⚠️";
    position: absolute;
    left: 0;
    font-size: 12px;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control.is-valid {
        border-width: 3px;
    }

    .form-control.is-invalid {
        border-width: 3px;
    }

    .validation-feedback {
        font-weight: bold;
    }
}

/* Focus enhancements for better accessibility */
.form-control:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.country-select:focus {
    outline: 2px solid #337ab7;
    outline-offset: 2px;
}

/* Screen reader announcements */
.sr-announce {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */

@media (max-width: 768px) {
    .form-errors {
        margin: 10px;
        padding: 10px;
    }

    .validation-feedback {
        font-size: 11px;
    }

    .field-requirements {
        font-size: 10px;
    }

    .form-security-info {
        margin: 10px;
        padding: 8px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .form-control.is-valid,
    .form-control.is-invalid {
        padding-right: 15px;
        background-size: 14px;
        background-position: right 8px center;
    }

    .strength-indicator {
        height: 3px;
    }

    .form-progress {
        height: 3px;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .form-errors,
    .validation-feedback,
    .form-security-info,
    .field-requirements {
        display: none !important;
    }

    .form-control {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        background-image: none !important;
    }
}
/* ==========================================================================
   ID NUMBER FIELD STYLING
   Dodaj ovo NA KRAJ postojećeg form-validation.css fajla
   ========================================================================== */

#idNumberSection .form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#idNumberSection .form-label small {
    font-weight: 400;
    font-style: italic;
}

/* Help text info box */
.form-text.text-info {
    color: #0d6efd !important;
    background-color: #cfe2ff;
    padding: 0.5rem;
    border-radius: 0.25rem;
    border-left: 3px solid #0d6efd;
}

.form-text.text-info i {
    margin-right: 0.25rem;
}

/* Validation message containers */
.validation-message {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.375rem 0.5rem;
    border-radius: 0.25rem;
    margin-top: 0.25rem;
    display: none;
}

.validation-message.error {
    color: #dc3545;
    background-color: #f8d7da;
    border-left: 3px solid #dc3545;
    display: block;
}

.validation-message.warning {
    color: #856404;
    background-color: #fff3cd;
    border-left: 3px solid #ffc107;
    display: block;
}

.validation-message.success {
    color: #155724;
    background-color: #d4edda;
    border-left: 3px solid #28a745;
    display: block;
}

/* Responsive adjustments for validation messages */
@media (max-width: 768px) {
    .validation-message {
        font-size: 0.8rem;
        padding: 0.25rem 0.375rem;
    }

    .form-text.text-info {
        font-size: 0.85rem;
        padding: 0.375rem;
    }
}
