/* public/assets/css/validation-enhancements.css */

/* ==================== Field State Styles ==================== */
.form-control:focus,
.form-select:focus {
    border-color: #ff6b00;
    box-shadow: 0 0 0 0.25rem rgba(255, 107, 0, 0.15);
}

.form-control.is-valid:focus,
.form-select.is-valid:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.15);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.15);
}

/* ==================== Validation Icons ==================== */
.form-control.is-valid,
.form-select.is-valid {
    padding-left: calc(1.5em + 0.75rem);
    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.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid,
.form-select.is-invalid {
    padding-left: calc(1.5em + 0.75rem);
    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 stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* ==================== Validation Hints ==================== */
.validation-hint {
    display: none;
    padding: 10px 15px;
    margin-top: 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
    transition: all 0.3s ease;
}

.hint-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    border-left: 4px solid #1976d2;
    box-shadow: 0 2px 4px rgba(21, 101, 192, 0.1);
}

.hint-error {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #ffffff;
    border-left: 4px solid #d32f2f;
    box-shadow: 0 2px 4px rgba(198, 40, 40, 0.1);
}

.hint-success {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
    border-left: 4px solid #388e3c;
    box-shadow: 0 2px 4px rgba(46, 125, 50, 0.1);
}

.validation-hint i {
    margin-left: 8px;
    font-size: 14px;
}

/* ==================== Validation Summary ==================== */
.validation-summary {
    position: sticky;
    top: 80px;
    z-index: 100;
    margin-bottom: 25px;
    animation: slideDown 0.4s ease;
    border-radius: 8px;
    border: none;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

.validation-summary .alert-heading {
    font-weight: 700;
    color: #b71c1c;
    margin-bottom: 15px;
}

.validation-summary ul {
    list-style: none;
    padding-right: 0;
    margin-bottom: 0;
}

.validation-summary li {
    padding: 10px 15px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    border-right: 3px solid #dc3545;
    transition: all 0.3s ease;
}

.validation-summary li:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateX(-5px);
}

.validation-summary li:last-child {
    margin-bottom: 0;
}

.validation-summary strong {
    color: #b71c1c;
    font-weight: 600;
}

/* ==================== Progress Indicators ==================== */
.field-progress {
    height: 4px;
    background: rgba(224, 224, 224, 0.5);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.field-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff6b00, #ff8533, #ffa366);
    background-size: 200% 100%;
    animation: progressGradient 2s ease infinite;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(255, 107, 0, 0.5);
}

@keyframes progressGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ==================== Step Progress Enhancement ==================== */
.step-item {
    position: relative;
}

.step-item .field-progress {
    position: absolute;
    bottom: -10px;
    left: 10%;
    right: 10%;
    width: 80%;
}

/* ==================== Toast Notifications ==================== */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-radius: 8px;
    border: none;
}

.toast-notification.fade-out {
    animation: slideOutRight 0.3s ease;
}

.toast-notification.alert-success {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    color: white;
    border-left: 5px solid #2e7d32;
}

.toast-notification.alert-danger {
    background: linear-gradient(135deg, #f44336 0%, #ef5350 100%);
    color: white;
    border-left: 5px solid #ffffff;
}

@keyframes slideInRight {
    from {
        transform: translateX(450px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(450px);
        opacity: 0;
    }
}

/* ==================== Button Animations ==================== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}

.shake {
    animation: shake 0.6s cubic-bezier(.36,.07,.19,.97) both;
}


/* ==================== Loading States ==================== */
.btn-step:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

.btn-step:disabled .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== Field Focus Enhancements ==================== */
.form-control:focus,
.form-select:focus,
textarea:focus {
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

/* ==================== Animated Labels ==================== */
.form-label {
    transition: all 0.3s ease;
    font-weight: 500;
}

.form-control:focus + .form-label,
.form-select:focus + .form-label {
    color: #ff6b00;
    font-weight: 600;
}

/* ==================== Required Field Indicator ==================== */
.text-danger {
    color: #dc3545 !important;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ==================== Validation Transitions ==================== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==================== Select2 Validation States ==================== */
.select2-container--bootstrap-5 .select2-selection.is-valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.15);
}

.select2-container--bootstrap-5 .select2-selection.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.15);
}

/* ==================== Mobile Responsive ==================== */
@media (max-width: 768px) {
    .validation-hint {
        font-size: 12px;
        padding: 8px 12px;
    }

    .validation-summary {
        position: relative;
        top: 0;
    }

    .toast-notification {
        min-width: 280px;
        right: 10px;
        left: 10px;
    }

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

/* ==================== Print Styles ==================== */
@media print {
    .validation-hint,
    .validation-summary,
    .toast-notification {
        display: none !important;
    }
}

/* ==================== Dark Mode Support (Optional) ==================== */
@media (prefers-color-scheme: dark) {
    .validation-hint {
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }

    .hint-info {
        background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
        color: #90cdf4;
    }

    .hint-error {
        background: linear-gradient(135deg, #742a2a 0%, #9b2c2c 100%);
        color: #feb2b2;
    }

    .hint-success {
        background: linear-gradient(135deg, #22543d 0%, #2f855a 100%);
        color: #9ae6b4;
    }
}
