/**
 * Streak Badge & Reward Modal Styles
 * Phong cách nhất quán với AInhanh - Bootstrap 5 + Gradient
 */

/* ========== STREAK RING & BADGE TRÊN AVATAR ========== */
.user-avatar-container {
    position: relative;
    display: inline-block;
    padding: 4px;
}

/* Colorful ring around avatar - only show when has streak */
.user-avatar-container.has-streak::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: rotate-ring 3s linear infinite;
    z-index: 1;
}

/* Avatar image */
.user-avatar-container img {
    position: relative;
    z-index: 2;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Streak badge - compact rectangle, number only, top right corner */
.user-streak-badge {
    position: absolute;
    top: -8px;
    right: -4px;
    background: linear-gradient(to left, #667eea 0%, #764ba2 50%, #f093fb 100%);
    opacity: 0.9;
    color: white;
    border-radius: 0;
    min-width: 24px;
    height: 18px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.5);
    border: none;
    z-index: 10;
    animation: streak-pulse 2s ease-in-out infinite;
}

.user-streak-badge .fire-icon {
    display: none;
}

/* Rotate ring animation */
@keyframes rotate-ring {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Animation khi cập nhật streak */
@keyframes streak-updated {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.streak-updated {
    animation: streak-updated 0.5s ease-in-out;
}

/* Pulse effect cho badge */
@keyframes streak-pulse {
    0%, 100% { 
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.5);
    }
    50% { 
        box-shadow: 0 2px 16px rgba(102, 126, 234, 0.9);
    }
}

/* Fire icon animation */
@keyframes fire-flicker {
    0%, 100% { opacity: 1; transform: translateY(0); }
    50% { opacity: 0.8; transform: translateY(-2px); }
}

/* ========== REWARD MODAL STYLES ========== */
.streak-reward-popup {
    border-radius: 20px !important;
    padding: 20px !important;
}

.reward-animation {
    position: relative;
    width: 100%;
    height: 100px;
    overflow: visible;
    margin-bottom: 20px;
}

.confetti {
    position: absolute;
    font-size: 2rem;
    animation: confetti-fall 2s ease-out infinite;
    pointer-events: none;
}

.confetti:nth-child(1) { left: 10%; animation-delay: 0s; }
.confetti:nth-child(2) { left: 30%; animation-delay: 0.2s; }
.confetti:nth-child(3) { left: 50%; animation-delay: 0.4s; }
.confetti:nth-child(4) { left: 70%; animation-delay: 0.6s; }
.confetti:nth-child(5) { left: 90%; animation-delay: 0.8s; }

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(150px) translateX(var(--x-movement, 0)) rotate(360deg);
        opacity: 0;
    }
}

.streak-reward-content {
    padding: 20px;
    text-align: center;
}

.streak-milestone h2 {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.reward-points div {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    animation: scale-in 0.5s ease-out;
}

@keyframes scale-in {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.streak-confirm-btn {
    padding: 12px 40px !important;
    font-size: 1.1rem !important;
    border-radius: 25px !important;
    font-weight: bold !important;
    transition: all 0.3s ease !important;
}

.streak-confirm-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.5) !important;
}

/* ========== STREAK INFO CARD (Compact Dashboard Version) ========== */
.streak-info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.streak-info-card .current-streak {
    font-size: 3rem;
    font-weight: bold;
    margin: 10px 0;
}

.streak-info-card .streak-label {
    font-size: 1rem;
    opacity: 0.9;
}

.streak-progress-bar {
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    height: 20px;
    margin-top: 15px;
    overflow: hidden;
}

.streak-progress-fill {
    background: linear-gradient(90deg, #4ecb73, #2ecc71);
    height: 100%;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* ========== COMPACT STREAK TOOLTIP ========== */
.streak-tooltip {
    animation: float-bounce 2s ease-in-out infinite;
}

@keyframes float-bounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-3px);
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .user-avatar-container {
        padding: 3px;
    }
    
    .user-avatar-container.has-streak::before {
        padding: 2px;
    }
    
    .user-streak-badge {
        min-width: 20px;
        height: 16px;
        padding: 2px 5px;
        font-size: 0.6rem;
        top: -1px;
        right: -1px;
        border-width: 1.5px;
        border-radius: 6px;
    }
    
    .streak-milestone h2 {
        font-size: 2rem !important;
    }
    
    .reward-points div {
        font-size: 2.5rem !important;
    }
}

/* ========== DAILY STREAK POPUP ========== */
.streak-info-modal {
    border-radius: 25px !important;
    padding: 30px !important;
    max-width: 450px !important;
}

.streak-daily-popup {
    text-align: center;
    padding: 20px 10px;
}

.streak-fire-container {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

.streak-fire-icon {
    font-size: 5rem;
    line-height: 1;
    animation: fire-bounce 1s ease-in-out infinite;
}

@keyframes fire-bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-10px) scale(1.1);
    }
}

.streak-count-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    min-width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.5);
    border: 3px solid white;
}

.streak-title {
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
}

.streak-number {
    margin: 20px 0;
}

.streak-number .current-streak {
    font-size: 4rem;
    font-weight: 900;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.streak-number .streak-label {
    font-size: 1.2rem;
    color: #666;
    margin-left: 10px;
    font-weight: 600;
}

.streak-message {
    font-size: 1.1rem;
    color: #555;
    margin: 20px 0;
    font-weight: 500;
}

.streak-progress-container {
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: 15px;
}

.streak-progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
}

.streak-progress-bar {
    background: rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
    position: relative;
}

.streak-progress-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    height: 100%;
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    animation: progress-glow 2s ease-in-out infinite;
}

@keyframes progress-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.9);
    }
}

.streak-record {
    margin-top: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 20px;
    color: #d35400;
    font-weight: 600;
    font-size: 0.95rem;
}

/* ========== STREAK POPUP V2 - COMPACT & ELEGANT ========== */
.streak-popup-v2 {
    border-radius: 20px !important;
    padding: 0 !important;
    max-width: 420px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden !important;
}

.streak-daily-popup-v2 {
    padding: 0;
    margin: 0;
}

/* Header */
.streak-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px 20px 20px;
    text-align: center;
    position: relative;
}

.streak-icon-wrapper {
    position: relative;
    display: inline-block;
}

.streak-icon {
    font-size: 3.5rem;
    color: #fff;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    animation: fire-pulse 2s ease-in-out infinite;
}

@keyframes fire-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.streak-plus-badge {
    position: absolute;
    top: -5px;
    right: -15px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.4);
    border: 3px solid #fff;
}

/* Content */
.streak-content {
    padding: 25px 20px 20px;
    text-align: center;
    background: #fff;
}

.streak-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.streak-info-link {
    color: #667eea;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.streak-info-link:hover {
    opacity: 1;
    transform: scale(1.1);
}

.streak-stats {
    margin: 15px 0;
}

.streak-main-number {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}

.streak-main-number .number {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.streak-main-number .unit {
    font-size: 1.2rem;
    color: #7f8c8d;
    font-weight: 600;
}

.streak-desc {
    margin: 15px 0 0 0;
    font-size: 1rem;
    color: #555;
    font-weight: 500;
}

.streak-desc i {
    margin-right: 6px;
    color: #667eea;
}

/* Progress section */
.streak-progress-section {
    padding: 20px 20px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-label {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 600;
}

.progress-label i {
    color: #ffc107;
    margin-right: 5px;
}

.progress-count {
    font-size: 0.9rem;
    color: #495057;
    font-weight: 700;
}

.progress-track {
    height: 8px;
    background: #dee2e6;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: progress-shine 2s ease-in-out infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

/* Footer */
.streak-footer {
    padding: 12px 20px;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #d35400;
    border-top: 1px solid #faddb8;
}

.streak-footer i {
    margin-right: 6px;
    color: #f39c12;
}

/* Button */
.streak-actions-v2 {
    padding: 20px !important;
    margin: 0 !important;
}

.streak-btn-v2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 14px 40px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
    margin: 0 !important;
}

.streak-btn-v2:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4) !important;
}

.streak-btn-v2:active {
    transform: translateY(0) !important;
}

.streak-btn-v2 i {
    margin-right: 6px;
}

/* Responsive */
@media (max-width: 480px) {
    .streak-popup-v2 {
        max-width: 340px !important;
        margin: 20px !important;
    }
    
    .streak-icon {
        font-size: 3rem;
    }
    
    .streak-main-number .number {
        font-size: 3rem;
    }
    
    .streak-heading {
        font-size: 1.3rem;
    }
}

/* ========== STREAK INFO POPUP ========== */
.streak-info-popup {
    border-radius: 20px !important;
    padding: 0 !important;
    max-width: 520px !important;
}

.streak-info-explanation {
    text-align: left;
    padding: 0;
}

.info-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px 30px;
    text-align: center;
    color: white;
}

.info-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    animation: fire-pulse 2s ease-in-out infinite;
}

.info-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.info-content {
    padding: 25px 30px;
    max-height: 60vh;
    overflow-y: auto;
}

.info-section {
    margin-bottom: 25px;
}

.info-section:last-of-type {
    margin-bottom: 15px;
}

.info-section h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section h4 i {
    color: #667eea;
    font-size: 1rem;
}

.info-section p {
    margin: 0 0 10px 0;
    color: #555;
    line-height: 1.6;
}

.info-section ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
    color: #555;
}

.info-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.info-section li strong {
    color: #667eea;
    font-weight: 600;
}

.info-highlight {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 15px 20px;
    border-radius: 12px;
    text-align: center;
    color: #d35400;
    font-size: 1rem;
    margin-top: 10px;
}

.info-highlight i {
    font-size: 1.2rem;
    margin-right: 8px;
    color: #f39c12;
}

.streak-info-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 12px 32px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
}

.streak-info-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4) !important;
}

.streak-info-btn i {
    margin-right: 6px;
}

/* ========== DARK MODE SUPPORT (Optional) ========== */
@media (prefers-color-scheme: dark) {
    .user-streak-badge {
        border-color: #333;
    }
    
    .streak-info-card {
        background: linear-gradient(135deg, #434343 0%, #000000 100%);
    }
    
    .streak-message {
        color: #aaa;
    }
    
    .streak-progress-label {
        color: #aaa;
    }
}

