/**
 * Feedback e Confirmações - Estilos
 * Autor: Diego Bernardes Silva
 * Data: 17/10/2025
 */

/* ===================================
   LOADING OVERLAY
   =================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-content {
    text-align: center;
    padding: 2rem;
    background: var(--bs-dark);
    border-radius: 12px;
    border: 1px solid var(--bs-gray-700);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.loading-content .spinner-border {
    border-width: 4px;
}

/* ===================================
   TOAST CONTAINER
   =================================== */
#toastContainer {
    z-index: 9999;
    max-width: 350px;
}

#toastContainer .toast {
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
}

#toastContainer .toast-body {
    padding: 1rem;
    font-size: 0.95rem;
}

/* Animação de entrada dos toasts */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#toastContainer .toast.showing {
    animation: slideInRight 0.3s ease-out;
}

/* ===================================
   MODAIS DE CONFIRMAÇÃO
   =================================== */
#confirmModal .modal-content {
    border: 1px solid var(--bs-gray-700);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#confirmModal .modal-header {
    border-bottom: 1px solid var(--bs-gray-700);
    background: var(--bs-gray-900);
}

#confirmModal .modal-body {
    padding: 1.5rem;
    font-size: 1rem;
}

#confirmModal .modal-footer {
    border-top: 1px solid var(--bs-gray-700);
    background: var(--bs-gray-900);
    padding: 1rem;
}

/* ===================================
   ANIMAÇÕES DE FEEDBACK
   =================================== */
@keyframes successPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(25, 135, 84, 0);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(25, 135, 84, 0.4);
    }
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.animate-success {
    animation: successPulse 1s ease-out;
    border-color: var(--bs-success) !important;
}

.animate-error {
    animation: errorShake 0.5s ease-out;
    border-color: var(--bs-danger) !important;
}

/* ===================================
   LOADING BUTTON STATE
   =================================== */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::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 0.6s linear infinite;
}

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

/* ===================================
   CONFIRMAÇÃO INLINE
   =================================== */
.confirm-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bs-warning);
    color: var(--bs-dark);
    border-radius: 6px;
    animation: slideInRight 0.3s ease-out;
}

.confirm-inline .btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* ===================================
   PROGRESS BAR
   =================================== */
.progress-uploading {
    height: 4px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9998;
    background: transparent;
}

.progress-uploading .progress-bar {
    background: linear-gradient(90deg, #0d6efd 0%, #0dcaf0 100%);
    animation: progressAnimation 2s ease-in-out infinite;
}

@keyframes progressAnimation {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

/* ===================================
   TOOLTIPS MELHORADOS
   =================================== */
.tooltip-custom {
    position: relative;
    cursor: help;
}

.tooltip-custom::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bs-dark);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    font-size: 0.875rem;
    border: 1px solid var(--bs-gray-700);
}

.tooltip-custom:hover::after {
    opacity: 1;
}

/* ===================================
   ESTADO DE SUCESSO/ERRO EM INPUTS
   =================================== */
.form-control.success {
    border-color: var(--bs-success);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' 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: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.form-control.error {
    border-color: var(--bs-danger);
    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: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

/* ===================================
   MOBILE ADAPTATIONS
   =================================== */
@media (max-width: 768px) {
    #toastContainer {
        bottom: 70px !important; /* Acima de possíveis FABs */
        padding: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    #toastContainer .toast {
        min-width: 280px;
        font-size: 0.9rem;
    }
    
    .loading-content {
        padding: 1.5rem;
    }
    
    #confirmModal .modal-dialog {
        margin: 1rem;
    }
    
    #confirmModal .modal-footer {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }
    
    #confirmModal .modal-footer .btn {
        width: 100%;
    }
}

/* ===================================
   ACCESSIBILITY
   =================================== */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ===================================
   SKELETON LOADING (Opcional)
   =================================== */
.skeleton {
    background: linear-gradient(90deg, var(--bs-gray-800) 25%, var(--bs-gray-700) 50%, var(--bs-gray-800) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-title {
    height: 2em;
    width: 50%;
    margin-bottom: 1em;
}

.skeleton-card {
    height: 200px;
    border-radius: 8px;
}

