/**
 * Session UX Styles
 * 
 * Estilos para toast notifications, loading spinners e animações
 */

/* ============================================================================
   1. TOAST NOTIFICATION STYLES
   ============================================================================ */

.session-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.session-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 500;
    min-width: 320px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(400px) translateY(-20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
    animation-fill-mode: forwards;
}

.session-toast.show {
    opacity: 1;
    transform: translateX(0) translateY(0);
}

/* Variantes de cores */
.session-toast-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.session-toast-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.session-toast-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.session-toast-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.session-toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.session-toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.session-toast-message {
    flex: 1;
    line-height: 1.4;
}

.session-toast-close {
    background: none;
    border: none;
    padding: 4px;
    margin-left: 8px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.session-toast-close:hover {
    opacity: 1;
}

/* ============================================================================
   2. LOADING SPINNER STYLES
   ============================================================================ */

.session-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.session-loading-overlay.show {
    opacity: 1;
}

.session-loading-spinner {
    text-align: center;
    animation: fadeInScale 0.4s ease-out;
}

.session-loading-spinner .spinner-border {
    width: 50px;
    height: 50px;
    border-width: 4px;
}

.session-loading-spinner p {
    color: #6c757d;
    margin: 0;
    font-size: 16px;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================================================
   3. MODAL ANIMATIONS
   ============================================================================ */

/* Modal fade in/out */
.modal.fade {
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.fade.show {
    opacity: 1;
    transform: scale(1);
}

.modal-backdrop.fade {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop.fade.show {
    opacity: 0.5;
}

/* ============================================================================
   4. BUTTON & FORM ANIMATIONS
   ============================================================================ */

/* Botões com efeito hover e feedback */
.btn-session {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.btn-session:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-session:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Ripple effect */
.btn-session::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    pointer-events: none;
}

.btn-session:active::before {
    width: 300px;
    height: 300px;
}

/* ============================================================================
   5. FORM INPUTS ANIMATIONS
   ============================================================================ */

.form-control-session,
input[data-session-resume-input] {
    transition: all 0.3s ease;
    border-color: #dee2e6;
}

.form-control-session:focus,
input[data-session-resume-input]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    transform: translateY(-2px);
}

/* ============================================================================
   6. PAGE TRANSITION ANIMATIONS
   ============================================================================ */

[data-page-content] {
    animation: pageEnter 0.5s ease-out;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   7. RESPONSIVE ADJUSTMENTS
   ============================================================================ */

/* Mobile - Toast container */
@media (max-width: 576px) {
    .session-toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .session-toast {
        min-width: unset;
        max-width: unset;
        width: 100%;
        padding: 14px 12px;
        font-size: 14px;
    }

    .session-toast-message {
        font-size: 13px;
    }
}

/* Mobile - Modal otimizado */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 10px;
    }

    .modal-content {
        border-radius: 12px;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 1rem;
        gap: 0.5rem;
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 15px;
        min-height: 44px; /* Touch target size */
    }
}

/* Tablet - Ajustes intermediários */
@media (max-width: 768px) {
    .session-toast {
        min-width: 280px;
        max-width: 350px;
    }

    .session-toast-container {
        top: 15px;
        right: 15px;
    }
}

/* Desktop - Layout padrão */
@media (min-width: 769px) {
    .session-toast {
        min-width: 320px;
        max-width: 400px;
    }
}

/* ============================================================================
   8. QR CODE RESPONSIVO
   ============================================================================ */

.qr-code-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin: 15px 0;
}

.qr-code-container img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

@media (max-width: 576px) {
    .qr-code-container {
        padding: 15px;
        margin: 12px 0;
    }

    .qr-code-container img {
        max-width: 200px;
    }
}

/* ============================================================================
   9. UUID DISPLAY & COPY
   ============================================================================ */

.uuid-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    word-break: break-all;
}

.uuid-display .btn-copy {
    flex-shrink: 0;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

@media (max-width: 576px) {
    .uuid-display {
        flex-direction: column;
        align-items: flex-start;
    }

    .uuid-display .btn-copy {
        width: 100%;
        text-align: center;
    }
}

/* ============================================================================
   10. SKELETON LOADERS (Para pré-carregamento)
   ============================================================================ */

.skeleton {
    animation: skeleton-loading 1s infinite;
    background-color: #e9ecef;
}

@keyframes skeleton-loading {
    0%, 100% {
        background-color: #e9ecef;
    }
    50% {
        background-color: #f0f3f6;
    }
}

/* ============================================================================
   11. ACCESSIBILITY & FOCUS STATES
   ============================================================================ */

/* Outline visible para navegação por teclado */
.btn-session:focus-visible,
.form-control-session:focus-visible,
[data-session-resume-input]:focus-visible {
    outline: 2px solid #0056b3;
    outline-offset: 2px;
}

/* ============================================================================
   12. DARK MODE SUPPORT (Opcional)
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    .session-toast-success {
        background-color: #1e3a1f;
        color: #a6e9a6;
        border-left-color: #28a745;
    }

    .session-toast-danger {
        background-color: #3a1e1e;
        color: #f5a6a6;
        border-left-color: #dc3545;
    }

    .session-toast-info {
        background-color: #1e2f3a;
        color: #a6d9e9;
        border-left-color: #17a2b8;
    }

    .session-toast-warning {
        background-color: #3a321e;
        color: #f5e0a6;
        border-left-color: #ffc107;
    }

    .session-loading-overlay {
        background-color: rgba(30, 30, 30, 0.9);
    }

    .session-loading-spinner p {
        color: #adb5bd;
    }

    .uuid-display {
        background-color: #2d2d2d;
        color: #e9ecef;
    }
}

/* ============================================================================
   13. SMOOTH TRANSITIONS GLOBAL
   ============================================================================ */

* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

button,
a,
input,
select,
textarea {
    transition-property: all;
    transition-duration: 200ms;
}

/* Desabilitar transições automáticas para certos elementos */
.no-transition {
    transition: none !important;
}
