.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 30% 70%, rgba(220, 38, 38, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(185, 28, 28, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(15, 15, 15, 0.9) 100%);
    backdrop-filter: blur(20px) saturate(150%);
    z-index: 1;
    animation: backdropFadeIn 0.4s ease-out;
    cursor: not-allowed;
}

@keyframes backdropFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(20px) saturate(150%);
    }
}

.modal-content {
    position: relative;
    background: 
        linear-gradient(135deg, 
            rgba(26, 26, 26, 0.95) 0%,
            rgba(38, 38, 38, 0.9) 50%,
            rgba(26, 26, 26, 0.95) 100%);
    border: 1px solid transparent;
    background-clip: padding-box;
    border-radius: 32px;
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    margin: 0 auto;
    box-shadow: 
        0 40px 80px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    z-index: 2;
    backdrop-filter: blur(40px) saturate(180%);
    transform: scale(0.8) translateY(60px) rotateX(15deg);
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow: hidden;
    position: relative;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    border-radius: 32px;
    z-index: 1;
    pointer-events: none;
}

.modal-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(220, 38, 38, 0.6) 20%, 
        rgba(220, 38, 38, 1) 50%, 
        rgba(220, 38, 38, 0.6) 80%, 
        transparent 100%);
    box-shadow: 
        0 0 20px rgba(220, 38, 38, 0.5),
        0 0 40px rgba(220, 38, 38, 0.3);
    z-index: 2;
    animation: neonPulse 2s ease-in-out infinite alternate;
}

@keyframes neonPulse {
    from {
        opacity: 0.6;
        transform: scaleX(0.8);
    }
    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

.modal.show .modal-content {
    transform: scale(1) translateY(0) rotateX(0deg);
}

.modal-header {
    position: relative;
    padding: 2.5rem 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 3;
}

.modal-header h2 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, 
        #ffffff 0%,
        #f0f0f0 50%,
        #dc2626 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    text-align: center;
    letter-spacing: -0.03em;
    line-height: 1.1;
    position: relative;
}

.modal-header h2::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 4rem;
    height: 4rem;
    background: 
        radial-gradient(circle, 
            rgba(220, 38, 38, 0.2) 0%,
            rgba(220, 38, 38, 0.05) 50%,
            transparent 70%);
    border-radius: 50%;
    z-index: -1;
}

.modal-body {
    padding: 2rem;
    text-align: center;
    position: relative;
    z-index: 3;
}

.modal-body::before {
    content: '';
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    background: 
        radial-gradient(circle at center, 
            rgba(255, 255, 255, 0.02) 0%,
            transparent 70%);
    border-radius: 20px;
    z-index: -1;
}

.modal-body p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.modal-body a {
    color: #dc2626;
    text-decoration: none;
    font-weight: 700;
    position: relative;
    background: linear-gradient(45deg, #dc2626, #b91c1c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.modal-body a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #dc2626, #b91c1c, #dc2626);
    border-radius: 1px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

.modal-body a:hover {
    transform: translateY(-1px);
    text-shadow: 0 0 20px rgba(220, 38, 38, 0.3);
}

.modal-body a:hover::after {
    width: 100%;
}

.terms-warning {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    color: #fbbf24;
    font-size: 0.9rem;
    font-weight: 500;
}

.terms-warning svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.modal-footer {
    padding: 2rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    z-index: 3;
}

.modal-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.2) 50%, 
        transparent 100%);
}

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 140px;
    backdrop-filter: blur(20px);
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.2) 50%, 
        transparent 100%);
    transition: left 0.6s ease;
    z-index: -1;
}

.btn:hover::before {
    left: 100%;
}

.btn svg {
    margin-right: 0.5rem;
    transition: transform 0.3s ease;
}

.btn:hover svg {
    transform: scale(1.1);
}

.btn-primary {
    background: 
        linear-gradient(135deg, 
            rgba(220, 38, 38, 0.9) 0%,
            rgba(185, 28, 28, 1) 50%,
            rgba(153, 27, 27, 0.9) 100%);
    color: white;
    border: 1px solid rgba(220, 38, 38, 0.5);
    box-shadow: 
        0 8px 32px rgba(220, 38, 38, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    position: relative;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(45deg, 
        rgba(220, 38, 38, 0.8),
        rgba(185, 28, 28, 0.6),
        rgba(220, 38, 38, 0.8));
    border-radius: 16px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(220, 38, 38, 0.5),
        0 0 40px rgba(220, 38, 38, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.btn-primary:hover::after {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-secondary {
    background: 
        linear-gradient(135deg, 
            rgba(55, 65, 81, 0.4) 0%,
            rgba(75, 85, 99, 0.3) 50%,
            rgba(55, 65, 81, 0.4) 100%);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: 
        linear-gradient(135deg, 
            rgba(75, 85, 99, 0.6) 0%,
            rgba(100, 116, 139, 0.5) 50%,
            rgba(75, 85, 99, 0.6) 100%);
    border-color: rgba(255, 255, 255, 0.25);
    color: white;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 16px 48px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-secondary:active {
    transform: translateY(-1px) scale(0.98);
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.6) translateY(100px) rotateX(30deg);
        filter: blur(10px);
    }
    50% {
        opacity: 0.8;
        transform: scale(0.9) translateY(20px) rotateX(10deg);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0deg);
        filter: blur(0px);
    }
}

.modal.entering .modal-content {
    animation: modalSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn.loading {
    pointer-events: none;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

body[data-modal-active="true"] * {
    pointer-events: none !important;
}

body[data-modal-active="true"] .modal,
body[data-modal-active="true"] .modal * {
    pointer-events: auto !important;
}

.blocking-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    pointer-events: none;
}

.notification-container {
    position: fixed;
    top: 100px;
    right: 1.5rem;
    z-index: 20000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}

.modern-notification {
    background: linear-gradient(135deg, 
        rgba(26, 26, 26, 0.95) 0%,
        rgba(38, 38, 38, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(24px) saturate(180%);
    color: white;
    min-width: 320px;
    max-width: 450px;
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    transform: translateX(100%) scale(0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.modern-notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 100%);
    pointer-events: none;
}

.modern-notification.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.modern-notification.leaving {
    opacity: 0;
    transform: translateX(100%) scale(0.8);
}

.modern-notification-success {
    border-left: 4px solid #10b981;
    background: linear-gradient(135deg, 
        rgba(16, 185, 129, 0.1) 0%,
        rgba(5, 150, 105, 0.05) 100%);
}

.modern-notification-error {
    border-left: 4px solid #ef4444;
    background: linear-gradient(135deg, 
        rgba(239, 68, 68, 0.1) 0%,
        rgba(220, 38, 38, 0.05) 100%);
}

.modern-notification-warning {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, 
        rgba(245, 158, 11, 0.1) 0%,
        rgba(217, 119, 6, 0.05) 100%);
}

.modern-notification-info {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.1) 0%,
        rgba(37, 99, 235, 0.05) 100%);
}

.notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-content {
    flex: 1;
}

.notification-message {
    font-size: 0.95rem;
    line-height: 1.5;
    font-weight: 500;
}

.notification-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.2;
}

.modal.leaving {
    opacity: 0;
    visibility: hidden;
}

.modal.leaving .modal-content {
    transform: scale(0.8) translateY(60px) rotateX(15deg);
}

.modal-content:hover {
    box-shadow: 
        0 50px 100px rgba(0, 0, 0, 0.9),
        0 0 0 1px rgba(255, 255, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 60px rgba(220, 38, 38, 0.1);
}

@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        margin: 1rem;
        border-radius: 24px;
    }
    
    .modal-header {
        padding: 2rem 1.5rem 1rem;
    }
    
    .modal-header h2 {
        font-size: 1.75rem;
    }
    
    .modal-body {
        padding: 1.5rem;
        font-size: 1rem;
    }
    
    .modal-footer {
        padding: 1.5rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn {
        width: 100%;
        padding: 1.25rem 2rem;
    }
    
    .notification-container {
        top: 80px;
        right: 1rem;
        left: 1rem;
    }

    .modern-notification {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .modal-content {
        max-width: 98%;
        margin: 0.5rem;
        border-radius: 20px;
    }
    
    .modal-header {
        padding: 1.5rem 1rem 0.75rem;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    .modal-body {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    .modal-footer {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 1rem 1.5rem;
    }
}

@media (prefers-contrast: high) {
    .modal-content {
        background: #000000;
        border: 2px solid #ffffff;
    }
    
    .btn-primary {
        background: #dc2626;
        border: 2px solid #ffffff;
    }
    
    .btn-secondary {
        background: #374151;
        border: 2px solid #ffffff;
    }
}

@media (prefers-reduced-motion: reduce) {
    .modal-content,
    .btn,
    .modal-close,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}