@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@100;200;300;400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto; /* ✅ AUTO = Scroll tự động khi cần */
    -webkit-overflow-scrolling: touch;
}

body { 
    font-family: 'JetBrains Mono', sans-serif; 
    min-height: 100%;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto; /* ✅ AUTO = Scroll khi nội dung dài */
}

#particles-js { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: -1;
    pointer-events: none;
}
    ::-webkit-scrollbar { width: 8px; }
    ::-webkit-scrollbar-track { background: #1e293b; }
    ::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
    ::-webkit-scrollbar-thumb:hover { background: #64748b; }
    .flow-button { box-shadow: 0 1px 3px rgba(0,0,0,0.1); transition: all 0.2s; }
    .flow-button:hover { box-shadow: 0 4px 8px rgba(0,0,0,0.15); transform: scale(1.03); filter: brightness(1.1); }
    .flow-button:active { transform: scale(0.98); box-shadow: inset 0 2px 4px rgba(0,0,0,0.06); }
    .spinner { border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: #fff; border-radius: 50%; width: 16px; height: 16px; animation: spin 1s linear infinite; margin: auto; }
    @keyframes spin { to { transform: rotate(360deg); } }
    .flow-button img { width: 24px; height: 24px; object-fit: cover; border-radius: 4px; margin-right: 8px; }
    .content-container { backdrop-filter: blur(8px); background: rgba(30, 41, 59, 0.8); }
    .language-select { position: absolute; top: 20px; right: 20px; }
    #userAvatar { transition: all 0.2s ease-in-out; cursor: pointer; }
    #userAvatar:hover { transform: scale(1.1); box-shadow: 0 0 15px rgba(91, 192, 222, 0.7); }

.skeleton {
  background-color: #334155;
  border-radius: 0.5rem;
  position: relative;
  overflow: hidden;
  height: 52px;
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 150%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
  0% { left: -150%; }
  100% { left: 150%; }
}
#flowButtons {
    position: relative;
    min-height: 100px;
}

#loadingOverlay .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
}
.popSc {
    position: fixed;
    z-index: 999999;
    inset: 0;
    background: rgba(30, 41, 59, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
}
.popBo {
    background: #23243b;
    border-radius: 16px;
    padding: 32px 28px 28px 28px;
    box-shadow: 0 12px 40px #0009, 0 1.5px 0 0 #ffd60080;
    color: #fff;
    max-width: 360px;
    width: 100%;
    text-align: center;
    font-family: 'Inter', Arial, sans-serif;
    animation: popupScaleIn .3s cubic-bezier(.39,.57,.56,1.12);
}
@keyframes popupScaleIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.popBo h2 {
    font-size: 1.35rem;
    margin-bottom: 14px;
    font-weight: bold;
    letter-spacing: .01em;
}
.popCo {
    margin-top: 5px;
    font-size: 1rem;
    color: #ffd600;
    font-weight: 500;
}

/* Responsive cho mobile */
@media (max-width: 768px) {
    html, body {
        height: auto; /* ✅ AUTO = Không khóa height */
        min-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto; /* ✅ AUTO = Scroll tự do khi cần */
        position: relative;
    }
    
    body {
        padding: 0.5rem;
        -webkit-overflow-scrolling: touch;
        touch-action: auto; /* ✅ AUTO = Cho phép mọi tương tác */
    }
    
    .content-container {
        margin-top: 1rem;
        margin-bottom: 1rem;
        max-width: 100%;
        position: relative;
        z-index: 1;
    }
    
    .language-select {
        top: 10px;
        right: 10px;
        z-index: 10;
    }
    
    #flowButtons {
        gap: 0.5rem;
    }
    
    .flow-button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* ✅ Premium Badge - Nâng Cấp Đẹp Hơn với Hiệu Ứng Cao Cấp */
.premium-badge {
    position: relative;
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    border-radius: 50px;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.6),
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    animation: float 3s ease-in-out infinite, glow-pulse 2s ease-in-out infinite;
    cursor: default;
    overflow: hidden;
}

.premium-badge::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 0%,
        transparent 20%,
        rgba(255, 255, 255, 0.2) 35%,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(255, 255, 255, 0.2) 65%,
        transparent 80%,
        transparent 100%
    );
    animation: shine 4s ease-in-out infinite;
    pointer-events: none;
    transform: skewX(-20deg);
}

.premium-badge::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at center,
        rgba(255, 215, 0, 0.3) 0%,
        transparent 70%
    );
    animation: pulse-glow 3s ease-in-out infinite;
    pointer-events: none;
    opacity: 0;
}

.premium-badge-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.premium-star {
    font-size: 20px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    animation: sparkle 1.5s ease-in-out infinite;
}

.premium-star.left {
    animation-delay: 0s;
}

.premium-star.right {
    animation-delay: 0.75s;
}

.premium-crown {
    font-size: 24px;
    animation: bounce-crown 2s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.premium-text-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.premium-text {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #1a1a1a;
    text-shadow: 
        1px 1px 0 #fff,
        -1px -1px 0 rgba(255, 255, 255, 0.5),
        0 0 15px rgba(255, 215, 0, 0.8);
    animation: text-glow 2s ease-in-out infinite;
}

.premium-subtitle {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #4a4a4a;
    text-transform: uppercase;
    opacity: 0.9;
}

/* Animations */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(255, 215, 0, 0.6),
            0 4px 15px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(255, 215, 0, 0.9),
            0 6px 20px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.7);
    }
}

@keyframes shine {
    0% {
        left: -150%;
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    50% {
        left: 50%;
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        left: 150%;
        opacity: 0;
    }
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes sparkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2) rotate(180deg);
    }
}

@keyframes bounce-crown {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-3px) scale(1.1);
    }
}

@keyframes text-glow {
    0%, 100% {
        text-shadow: 
            1px 1px 0 #fff,
            -1px -1px 0 rgba(255, 255, 255, 0.5),
            0 0 15px rgba(255, 215, 0, 0.8);
    }
    50% {
        text-shadow: 
            1px 1px 0 #fff,
            -1px -1px 0 rgba(255, 255, 255, 0.5),
            0 0 25px rgba(255, 215, 0, 1),
            0 0 35px rgba(255, 215, 0, 0.6);
    }
}

.premium-badge:hover {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.premium-badge:hover .premium-crown {
    animation: bounce-crown 0.5s ease-in-out infinite;
}

/* Đảm bảo touch scroll mượt trên iOS */
body {
    -webkit-overflow-scrolling: touch;
}

/* Fix cho các thiết bị có notch */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0.5rem, env(safe-area-inset-left));
        padding-right: max(0.5rem, env(safe-area-inset-right));
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    }
}
