/* ===========================
   STUNNING AUTHENTICATION MODAL
   Islamic-themed with mind-blowing animations
   =========================== */

/* Modal Overlay */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Animated Backdrop with Blur */
.auth-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: backdropFadeIn 0.4s ease-out;
}

@keyframes backdropFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

/* Modal Container */
.auth-modal-container {
    position: relative;
    z-index: 1;
    transform: scale(0.8) translateY(50px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-modal-overlay.show .auth-modal-container {
    transform: scale(1) translateY(0);
}

/* Modal Content */
.auth-modal-content {
    background: linear-gradient(145deg, #ffffff, #f8fffe);
    border-radius: 24px;
    max-width: 480px;
    width: 100%;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 25px 60px rgba(0, 0, 0, 0.3),
        0 10px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.6);
    /* Prevent content from being cut off on small screens */
    max-height: min(90vh, 720px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Islamic Pattern Background */
.auth-modal-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(135deg, #3a9d74, #2d7a5b);
    opacity: 0.1;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.3'%3E%3Cpath d='m30 0 15 8.66v17.32l-15 8.66-15-8.66V8.66L30 0zm0 5.77L18.85 12v12l11.15 6.43L41.15 24V12L30 5.77z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    animation: patternFloat 20s ease-in-out infinite;
}

@keyframes patternFloat {
    0%, 100% { transform: translateX(0) translateY(0) scale(1); }
    25% { transform: translateX(10px) translateY(-5px) scale(1.02); }
    50% { transform: translateX(-5px) translateY(10px) scale(0.98); }
    75% { transform: translateX(-10px) translateY(-5px) scale(1.01); }
}

/* Close Button */
.auth-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.auth-modal-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.auth-modal-close i {
    color: #666;
    font-size: 1.1rem;
}

/* Header Section */
.auth-modal-header {
    padding: 60px 40px 30px;
    text-align: center;
    position: relative;
}

.auth-modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #3a9d74, #2d7a5b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 8px 32px rgba(58, 157, 116, 0.4),
        0 4px 16px rgba(58, 157, 116, 0.2);
    animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 8px 32px rgba(58, 157, 116, 0.4), 0 4px 16px rgba(58, 157, 116, 0.2); }
    50% { transform: scale(1.05); box-shadow: 0 12px 40px rgba(58, 157, 116, 0.5), 0 6px 20px rgba(58, 157, 116, 0.3); }
}

.auth-modal-icon i {
    color: white;
    font-size: 2rem;
}

.auth-modal-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 15px;
    background: linear-gradient(135deg, #2c3e50, #3a9d74);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-modal-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.6;
}

/* Benefits Section */
.auth-benefits {
    padding: 0 40px 30px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: rgba(58, 157, 116, 0.05);
    border-radius: 12px;
    border-left: 4px solid #3a9d74;
    transition: all 0.3s ease;
    animation: benefitSlideIn 0.6s ease-out;
    animation-fill-mode: both;
}

.benefit-item:nth-child(1) { animation-delay: 0.1s; }
.benefit-item:nth-child(2) { animation-delay: 0.2s; }
.benefit-item:nth-child(3) { animation-delay: 0.3s; }

@keyframes benefitSlideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.benefit-item:hover {
    background: rgba(58, 157, 116, 0.1);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(58, 157, 116, 0.15);
}

.benefit-item i {
    color: #3a9d74;
    font-size: 1.3rem;
    width: 20px;
}

.benefit-item span {
    color: #374151;
    font-weight: 500;
    font-size: 0.95rem;
}

/* Sign In Button */
.auth-modal-actions {
    padding: 0 40px 30px;
}

.auth-modal-signin-btn {
    width: 100%;
    padding: 18px 24px;
    background: linear-gradient(135deg, #2c3e50, #3a9d74, #1abc9c);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 32px rgba(58, 157, 116, 0.3),
        0 4px 16px rgba(58, 157, 116, 0.2);
    margin-bottom: 20px;
}

.auth-modal-signin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 40px rgba(58, 157, 116, 0.4),
        0 6px 20px rgba(58, 157, 116, 0.3);
}

.auth-modal-signin-btn:active {
    transform: translateY(0);
}

.signin-btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: white;
    font-weight: 600;
    font-size: 1.05rem;
    position: relative;
    z-index: 2;
}

.signin-btn-content i {
    font-size: 1.3rem;
}

/* Stack primary label with subtext inside the sign-in button */
.signin-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.15;
}

.signin-subtext {
    font-size: 0.8rem;
    color: #d1d5db; /* soft grey */
    font-weight: 500;
    margin-top: 2px;
}

/* Shine Animation */
.signin-btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.auth-modal-signin-btn:hover .signin-btn-shine {
    left: 100%;
}

.auth-modal-privacy {
    font-size: 0.85rem;
    color: #9ca3af;
    text-align: center;
    line-height: 1.5;
    margin: 0;
}

/* Footer */
.auth-modal-footer {
    padding: 20px 40px 40px;
    text-align: center;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.auth-modal-skip {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin: 0 auto;
}

.auth-modal-skip:hover {
    color: #3a9d74;
    background: rgba(58, 157, 116, 0.05);
}

.auth-modal-skip i {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.auth-modal-skip:hover i {
    transform: translateX(3px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .auth-modal-overlay {
        padding: 10px;
        /* Start near top to ensure full content is reachable */
        align-items: flex-start;
    }

    .auth-modal-container { margin-top: 10px; }
    
    .auth-modal-header {
        padding: 40px 30px 20px;
    }
    
    .auth-modal-icon {
        width: 60px;
        height: 60px;
    }
    
    .auth-modal-icon i {
        font-size: 1.5rem;
    }
    
    .auth-modal-title {
        font-size: 1.5rem;
    }
    
    .auth-benefits {
        padding: 0 30px 20px;
    }
    
    .auth-modal-actions {
        padding: 0 30px 20px;
    }
    
    .auth-modal-footer {
        padding: 15px 30px calc(30px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 480px) {
    .auth-modal-content {
        border-radius: 20px;
    }
    
    .auth-modal-header {
        padding: 30px 20px 15px;
    }
    
    .auth-modal-title {
        font-size: 1.3rem;
    }
    
    .auth-benefits {
        padding: 0 20px 15px;
        gap: 12px;
    }
    
    .benefit-item {
        padding: 12px 15px;
    }
    
    .auth-modal-actions {
        padding: 0 20px 15px;
    }
    
    .auth-modal-signin-btn {
        padding: 16px 20px;
    }
    
    .auth-modal-footer {
        padding: 12px 20px 25px;
    }
}

/* Dark Mode Support */
body.dark-mode .auth-modal-content {
    background: linear-gradient(145deg, #1f2937, #111827);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .auth-modal-title {
    background: linear-gradient(135deg, #ffffff, #3a9d74);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark-mode .auth-modal-subtitle {
    color: #d1d5db;
}

body.dark-mode .benefit-item {
    background: rgba(58, 157, 116, 0.1);
    color: #f9fafb;
}

body.dark-mode .benefit-item span {
    color: #f3f4f6;
}

body.dark-mode .auth-modal-privacy {
    color: #d1d5db;
}

body.dark-mode .auth-modal-skip {
    color: #d1d5db;
}

body.dark-mode .auth-modal-skip:hover {
    color: #3a9d74;
    background: rgba(58, 157, 116, 0.15);
}