/* 
   MeetreAI Premium Modal System
   Ultra-modern modals with glassmorphism, animations, and smart interactions
*/

/* ============================================
   Modal Overlay - Backdrop with blur effect
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: var(--space-xl);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show,
.modal-overlay.visible {
    display: flex;
    animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

.modal-overlay.hiding {
    animation: modalFadeOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

/* ============================================
   Modal Content - Main container
   ============================================ */
.modal-content,
.modal {
    position: relative;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: var(--radius-3xl, 24px);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 1px 2px 0 rgba(255, 255, 255, 0.1) inset;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.show .modal-content,
.modal-overlay.show .modal,
.modal-overlay.visible .modal-content,
.modal-overlay.visible .modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-overlay.hiding .modal-content,
.modal-overlay.hiding .modal {
    transform: scale(0.95) translateY(10px);
    opacity: 0;
}

/* Glassmorphism effect on hover */
.modal-content::before,
.modal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.12) 0%, transparent 50%);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 0;
}

.modal-content:hover::before,
.modal:hover::before {
    opacity: 1;
}

/* All children above the pseudo-element */
.modal-content > *,
.modal > * {
    position: relative;
    z-index: 1;
}

/* ============================================
   Modal Header - Title and close button
   ============================================ */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xl, 24px) var(--space-2xl, 32px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, transparent 100%);
    position: relative;
    overflow: hidden;
}

.modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(99, 102, 241, 0.6) 25%,
        rgba(139, 92, 246, 0.6) 50%,
        rgba(6, 182, 212, 0.6) 75%,
        transparent 100%
    );
    transform: scaleX(0);
    animation: headerShine 2s ease-in-out infinite;
}

@keyframes headerShine {
    0%, 100% {
        transform: scaleX(0);
        opacity: 0;
    }
    50% {
        transform: scaleX(1);
        opacity: 1;
    }
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm, 12px);
    letter-spacing: -0.02em;
}

.modal-title::before {
    content: attr(data-icon);
    font-size: 1.75rem;
    -webkit-text-fill-color: initial;
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-3px) rotate(-2deg);
    }
    50% {
        transform: translateY(-5px) rotate(2deg);
    }
    75% {
        transform: translateY(-3px) rotate(-1deg);
    }
}

/* ============================================
   Modal Close Button - Enhanced design
   ============================================ */
.modal-close {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg, 12px);
    border: none;
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary, #94a3b8);
    font-size: 1.5rem;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.modal-close::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    transform: rotate(90deg) scale(1.05);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.modal-close:hover::before {
    opacity: 1;
}

.modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

/* ============================================
   Modal Body - Content area
   ============================================ */
.modal-body {
    padding: var(--space-2xl, 32px);
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) rgba(15, 23, 42, 0.5);
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.5), rgba(139, 92, 246, 0.5));
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.7), rgba(139, 92, 246, 0.7));
}

/* ============================================
   Modal Footer - Action buttons
   ============================================ */
.modal-footer {
    display: flex;
    gap: var(--space-md, 16px);
    padding: var(--space-xl, 24px) var(--space-2xl, 32px);
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    background: linear-gradient(0deg, rgba(15, 23, 42, 0.5) 0%, transparent 100%);
    flex-wrap: wrap;
}

.modal-footer .btn {
    flex: 1;
    min-width: 120px;
}

/* ============================================
   Form Elements inside Modal
   ============================================ */
.modal-body .form-group {
    margin-bottom: var(--space-lg, 20px);
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-body .form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary, #cbd5e1);
    margin-bottom: var(--space-sm, 8px);
    letter-spacing: 0.02em;
}

.modal-body .form-input,
.modal-body input[type="text"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body textarea,
.modal-body select {
    width: 100%;
    padding: 14px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1.5px solid rgba(148, 163, 184, 0.15);
    border-radius: var(--radius-lg, 12px);
    color: var(--text-primary, #e2e8f0);
    font-size: 0.95rem;
    transition: all 0.25s ease;
    font-family: inherit;
}

.modal-body .form-input:focus,
.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 
        0 0 0 4px rgba(99, 102, 241, 0.1),
        0 4px 12px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

.modal-body .form-input::placeholder,
.modal-body input::placeholder,
.modal-body textarea::placeholder {
    color: var(--text-muted, #64748b);
}

/* ============================================
   Special Modal Variants
   ============================================ */

/* Success Modal */
.modal-content.modal-success,
.modal.modal-success {
    border-color: rgba(16, 185, 129, 0.3);
}

.modal-success .modal-header {
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.15) 0%, transparent 100%);
}

.modal-success .modal-title {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Warning Modal */
.modal-content.modal-warning,
.modal.modal-warning {
    border-color: rgba(251, 191, 36, 0.3);
}

.modal-warning .modal-header {
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.15) 0%, transparent 100%);
}

.modal-warning .modal-title {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Error Modal */
.modal-content.modal-error,
.modal.modal-error {
    border-color: rgba(239, 68, 68, 0.3);
}

.modal-error .modal-header {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.15) 0%, transparent 100%);
}

.modal-error .modal-title {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   QR Modal - Special styling
   ============================================ */
.qr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(16px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--space-xl);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qr-modal-overlay[style*="display: flex"],
.qr-modal-overlay[style*="display:flex"] {
    display: flex !important;
    animation: modalFadeIn 0.3s ease forwards;
}

.qr-modal,
.qr-modal-content {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 24px;
    padding: 32px;
    max-width: 520px;
    width: 92%;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(99, 102, 241, 0.1) inset;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.qr-modal-overlay[style*="display: flex"] .qr-modal-content,
.qr-modal-overlay[style*="display:flex"] .qr-modal-content,
.qr-modal-overlay[style*="display: flex"] .qr-modal,
.qr-modal-overlay[style*="display:flex"] .qr-modal {
    transform: scale(1);
    opacity: 1;
}

.qr-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.qr-modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

#qrCodeContainer {
    background: white;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: var(--space-xl) 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.qr-instructions {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.08));
    border-left: 3px solid #6366f1;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
}

.qr-instructions h3 {
    color: #e2e8f0;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.qr-instructions ul {
    margin: 0;
    padding-left: var(--space-lg);
    color: #94a3b8;
}

.qr-instructions li {
    margin-bottom: var(--space-xs);
    line-height: 1.6;
}

.qr-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.qr-action-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.qr-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.qr-action-btn:active {
    transform: translateY(0);
}

/* ============================================
   Filter Modal - Special styling
   ============================================ */
.filter-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: var(--space-xl);
}

.filter-modal[style*="display: flex"],
.filter-modal[style*="display:flex"] {
    display: flex !important;
    animation: modalFadeIn 0.3s ease forwards;
}

.filter-modal-content {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 24px;
    padding: 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.filter-modal[style*="display: flex"] .filter-modal-content,
.filter-modal[style*="display:flex"] .filter-modal-content {
    transform: scale(1);
    opacity: 1;
}

/* ============================================
   Quick Action Dialog
   ============================================ */
.quick-action-dialog {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease forwards;
}

.quick-action-dialog .dialog-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
}

.quick-action-dialog .dialog-content {
    position: relative;
    z-index: 1;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 24px;
    max-width: 600px;
    width: 92%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: dialogSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, transparent 100%);
}

.dialog-header h3 {
    font-size: 1.35rem;
    font-weight: 700;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.dialog-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dialog-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    transform: rotate(90deg) scale(1.05);
}

.dialog-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

.dialog-actions {
    display: flex;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    background: linear-gradient(0deg, rgba(15, 23, 42, 0.5) 0%, transparent 100%);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 640px) {
    .modal-overlay {
        padding: var(--space-md);
    }
    
    .modal-content,
    .modal {
        max-width: 100%;
        border-radius: var(--radius-2xl, 20px);
    }
    
    .modal-header {
        padding: var(--space-lg, 20px) var(--space-xl, 24px);
    }
    
    .modal-title {
        font-size: 1.25rem;
    }
    
    .modal-body {
        padding: var(--space-xl, 24px);
    }
    
    .modal-footer {
        padding: var(--space-lg, 20px) var(--space-xl, 24px);
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .qr-modal,
    .qr-modal-content {
        padding: 24px;
    }
    
    .filter-modal-content {
        padding: 24px;
    }
}

/* ============================================
   Accessibility
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal-content,
    .modal,
    .qr-modal-overlay,
    .qr-modal,
    .qr-modal-content,
    .filter-modal,
    .filter-modal-content,
    .quick-action-dialog,
    .dialog-content {
        animation: none;
        transition: none;
    }
    
    .modal-header::after {
        animation: none;
    }
    
    .modal-title::before {
        animation: none;
    }
}

/* Focus visible for keyboard navigation */
.modal-close:focus-visible,
.dialog-close:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.modal-body .form-input:focus-visible,
.modal-body input:focus-visible,
.modal-body textarea:focus-visible,
.modal-body select:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}


