/* ========================================
   AUTH MODAL (в стиле сайта)
   ======================================== */

#telegramAuthModal.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: hsl(var(--background) / 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 1rem;
}

#telegramAuthModal.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

#telegramAuthModal .modal-card {
    background: linear-gradient(135deg, hsl(240 8% 14%) 0%, hsl(240 8% 12%) 100%);
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    width: 100%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 24px hsl(var(--background) / 0.6);
    backdrop-filter: blur(10px);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#telegramAuthModal.modal-overlay.active .modal-card {
    transform: scale(1) translateY(0);
}

#telegramAuthModal .modal-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
    flex-shrink: 0;
}

#telegramAuthModal .modal-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin: 0;
    line-height: 1.2;
}

#telegramAuthModal .modal-card-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    flex-shrink: 0;
}

#telegramAuthModal .modal-card-close:hover {
    background: hsl(var(--muted) / 0.5);
    color: hsl(var(--foreground));
    transform: scale(1.1) rotate(90deg);
}

#telegramAuthModal .modal-card-close i,
#telegramAuthModal .modal-card-close svg {
    width: 16px;
    height: 16px;
}

#telegramAuthModal .modal-card-body {
    padding: 0;
}

/* Auth Container */
.auth-container {
    padding: 1rem;
}

/* Auth Steps */
.auth-step {
    display: none;
}

.auth-step.active {
    display: block;
    animation: authFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Auth Icon */
.auth-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
}

.auth-icon svg {
    width: 28px;
    height: 28px;
}

/* Auth Title & Description */
.auth-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin: 0 0 0.375rem 0;
    text-align: center;
}

.auth-description {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.5;
    margin: 0 0 1rem 0;
    text-align: center;
}

/* Widget Container */
.auth-widget-container {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

/* Loading */
.auth-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
}

.auth-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid hsl(var(--border));
    border-top-color: hsl(var(--primary));
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}

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

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.6875rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: hsl(var(--border));
}

/* Telegram Button */
.auth-telegram-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, hsl(240 8% 14%) 0%, hsl(240 8% 12%) 100%);
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    color: hsl(var(--foreground));
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    height: 36px;
}

.auth-telegram-btn:hover {
    background: hsl(var(--muted) / 0.5);
    border-color: hsl(var(--primary) / 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px hsl(var(--background) / 0.4);
}

.auth-telegram-btn svg {
    width: 16px;
    height: 16px;
    fill: hsl(var(--primary));
}

/* Hint */
.auth-hint {
    font-size: 0.6875rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.75rem;
    text-align: center;
    opacity: 0.8;
}

/* Success State */
.auth-success-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--success) / 0.15);
    border: 1px solid hsl(var(--success) / 0.3);
    border-radius: 0.5rem;
}

.auth-success-icon i {
    width: 24px;
    height: 24px;
    color: hsl(var(--success));
}

/* Error State */
.auth-error-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--error) / 0.15);
    border: 1px solid hsl(var(--error) / 0.3);
    border-radius: 0.5rem;
}

.auth-error-icon i {
    width: 24px;
    height: 24px;
    color: hsl(var(--error));
}

.auth-retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: 0.375rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0.75rem;
}

.auth-retry-btn:hover {
    background: hsl(var(--muted) / 0.5);
    color: hsl(var(--foreground));
    transform: translateY(-1px);
    box-shadow: 0 2px 8px hsl(var(--background) / 0.3);
}

.auth-retry-btn i {
    width: 14px;
    height: 14px;
}

/* User Info */
.auth-user-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem;
    background: hsl(var(--muted) / 0.3);
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    margin: 0.75rem 0;
}

.auth-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    background: hsl(var(--muted));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    overflow: hidden;
    flex-shrink: 0;
}

.auth-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-user-details {
    flex: 1;
    min-width: 0;
}

.auth-user-name {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    line-height: 1.2;
}

.auth-user-username {
    display: block;
    font-size: 0.6875rem;
    color: hsl(var(--muted-foreground));
}

/* Bonus */
.auth-bonus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: hsl(var(--primary) / 0.1);
    border: 1px solid hsl(var(--primary) / 0.2);
    border-radius: 0.375rem;
    color: hsl(var(--primary));
    font-size: 0.75rem;
    font-weight: 500;
    width: 100%;
}

.auth-bonus i {
    width: 14px;
    height: 14px;
}

/* Footer */
.auth-footer {
    padding: 0.625rem 1rem;
    border-top: 1px solid hsl(var(--border));
    background: hsl(var(--muted) / 0.2);
}

.auth-terms {
    font-size: 0.625rem;
    color: hsl(var(--muted-foreground));
    margin: 0;
    text-align: center;
    opacity: 0.7;
}

/* Demo Widget Notice */
.demo-widget-notice {
    padding: 0.625rem !important;
    background: hsl(var(--muted) / 0.3) !important;
    border: 1px solid hsl(var(--border)) !important;
    border-radius: 0.375rem !important;
    text-align: center !important;
}

.demo-widget-notice p {
    color: hsl(var(--muted-foreground)) !important;
    font-size: 0.6875rem !important;
    margin: 0 !important;
}

.demo-widget-notice p:first-child {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    margin-bottom: 0.25rem !important;
}

/* ========================================
   USER BLOCK (в панели ввода)
   ======================================== */


/* Responsive */
@media (max-width: 480px) {
    #telegramAuthModal.modal-overlay {
        padding: 0.5rem;
    }

    #telegramAuthModal .modal-card {
        max-width: 100%;
    }
    
    .auth-container {
        padding: 0.75rem;
    }
    
    .auth-footer {
        padding: 0.5rem 0.75rem;
    }
}
