/* Glass Credit Container Component
 * Visual fill indicator showing credit balance like a glass jar
 * Features: Liquid fill animation, bubble effects, holographic accents
 */

/* ========================================
   Glass Container - Main Structure
   ======================================== */
.glass-credit-container {
    position: relative;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

/* The glass jar/beaker shape */
.glass-jar {
    position: relative;
    width: 160px;
    height: 200px;
    margin: 0 auto 1rem;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 0 30px 30px;
    overflow: hidden;
    box-shadow:
        inset 0 0 30px rgba(255, 255, 255, 0.05),
        0 10px 40px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Glass rim at top */
.glass-jar::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -6px;
    right: -6px;
    height: 16px;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0.1) 100%
    );
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Glass highlight/reflection */
.glass-jar::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 8px;
    width: 30%;
    height: 60%;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        transparent 100%
    );
    border-radius: 20px;
    pointer-events: none;
    z-index: 10;
}

/* ========================================
   Liquid Fill
   ======================================== */
.liquid-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(
        180deg,
        rgba(16, 185, 129, 0.9) 0%,
        rgba(5, 150, 105, 0.95) 50%,
        rgba(4, 120, 87, 1) 100%
    );
    border-radius: 0 0 28px 28px;
    transition: height 1s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Liquid surface wave effect */
.liquid-fill::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -50%;
    width: 200%;
    height: 20px;
    background: radial-gradient(
        ellipse at center,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(16, 185, 129, 0.8) 50%,
        transparent 70%
    );
    animation: wave 3s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% {
        transform: translateX(0) scaleY(1);
    }
    50% {
        transform: translateX(25%) scaleY(0.8);
    }
}

/* Liquid shine */
.liquid-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    width: 30%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 100%
    );
    animation: liquid-shine 4s ease-in-out infinite;
}

@keyframes liquid-shine {
    0%, 100% {
        opacity: 0.3;
        transform: translateX(0);
    }
    50% {
        opacity: 0.6;
        transform: translateX(50%);
    }
}

/* ========================================
   Bubbles Effect
   ======================================== */
.bubbles {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.bubble {
    position: absolute;
    bottom: -20px;
    width: 10px;
    height: 10px;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    border-radius: 50%;
    animation: bubble-rise 3s ease-in infinite;
}

.bubble:nth-child(1) { left: 20%; animation-delay: 0s; animation-duration: 2.5s; width: 8px; height: 8px; }
.bubble:nth-child(2) { left: 40%; animation-delay: 0.5s; animation-duration: 3s; width: 6px; height: 6px; }
.bubble:nth-child(3) { left: 60%; animation-delay: 1s; animation-duration: 2.8s; width: 10px; height: 10px; }
.bubble:nth-child(4) { left: 80%; animation-delay: 1.5s; animation-duration: 3.2s; width: 7px; height: 7px; }
.bubble:nth-child(5) { left: 30%; animation-delay: 2s; animation-duration: 2.6s; width: 5px; height: 5px; }

@keyframes bubble-rise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-180px) scale(0.5);
        opacity: 0;
    }
}

/* ========================================
   Fill Level Markers
   ======================================== */
.level-markers {
    position: absolute;
    top: 15px;
    right: -35px;
    bottom: 10px;
    width: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.625rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.level-marker {
    display: flex;
    align-items: center;
    gap: 4px;
}

.level-marker::before {
    content: '';
    width: 8px;
    height: 1px;
    background: var(--border-color);
}

/* ========================================
   Credit Display Below Jar
   ======================================== */
.credit-readout {
    text-align: center;
    padding: 1rem;
    background: rgba(16, 185, 129, 0.08);
    border-radius: 12px;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.credit-value-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
}

.credit-number {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--cta-primary);
    line-height: 1;
    position: relative;
}

/* Glitch effect for number */
.credit-number.glitching::before,
.credit-number.glitching::after {
    content: attr(data-value);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.credit-number.glitching::before {
    color: #00ffff;
    animation: glitch-1 0.2s steps(1) infinite;
    clip-path: inset(0 0 50% 0);
}

.credit-number.glitching::after {
    color: #ff00ff;
    animation: glitch-2 0.2s steps(1) infinite;
    clip-path: inset(50% 0 0 0);
}

@keyframes glitch-1 {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 1px); }
    40% { transform: translate(2px, -1px); }
    60% { transform: translate(-1px, 2px); }
    80% { transform: translate(1px, -2px); }
}

@keyframes glitch-2 {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(2px, -1px); }
    40% { transform: translate(-2px, 1px); }
    60% { transform: translate(1px, -2px); }
    80% { transform: translate(-1px, 2px); }
}

.credit-unit {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.credit-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ========================================
   Affordability Indicator
   ======================================== */
.affordability-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 20px;
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.affordability-badge i {
    color: var(--cta-primary);
}

.affordability-badge strong {
    color: var(--cta-primary);
    font-weight: 700;
}

/* Low balance state */
.affordability-badge.low-balance {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

.affordability-badge.low-balance i,
.affordability-badge.low-balance strong {
    color: #F59E0B;
}

/* Empty state */
.affordability-badge.empty-balance {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

.affordability-badge.empty-balance i,
.affordability-badge.empty-balance strong {
    color: #EF4444;
}

/* ========================================
   Action Buttons
   ======================================== */
.credit-actions {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-top: 1.25rem;
}

.btn-add-credits {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--cta-primary) 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.btn-add-credits::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.5s ease;
}

.btn-add-credits:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

.btn-add-credits:hover::before {
    left: 100%;
}

.btn-track-record {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-track-record:hover {
    background: rgba(16, 185, 129, 0.05);
    border-color: var(--cta-primary);
    color: var(--cta-primary);
}

/* ========================================
   Pricing Info
   ======================================== */
.pricing-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-align: center;
}

.pricing-tiers {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.pricing-tier {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.tier-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.tier-dot.elite { background: #F59E0B; }
.tier-dot.strong { background: #3B82F6; }
.tier-dot.standard { background: #6B7280; }

/* ========================================
   Dark Mode
   ======================================== */
[data-theme="dark"] .glass-jar {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        inset 0 0 30px rgba(255, 255, 255, 0.02),
        0 10px 40px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .glass-jar::before {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.15) 0%,
        rgba(255, 255, 255, 0.05) 100%
    );
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .liquid-fill {
    background: linear-gradient(
        180deg,
        rgba(16, 185, 129, 0.85) 0%,
        rgba(5, 150, 105, 0.9) 50%,
        rgba(4, 120, 87, 0.95) 100%
    );
}

[data-theme="dark"] .credit-readout {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

[data-theme="dark"] .affordability-badge {
    background: rgba(16, 185, 129, 0.15);
}

[data-theme="dark"] .btn-track-record {
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .btn-track-record:hover {
    background: rgba(16, 185, 129, 0.1);
}

[data-theme="dark"] .pricing-info {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* ========================================
   Fill Level Colors (by percentage)
   ======================================== */
.liquid-fill.fill-critical {
    background: linear-gradient(
        180deg,
        rgba(239, 68, 68, 0.9) 0%,
        rgba(220, 38, 38, 0.95) 50%,
        rgba(185, 28, 28, 1) 100%
    );
}

.liquid-fill.fill-low {
    background: linear-gradient(
        180deg,
        rgba(245, 158, 11, 0.9) 0%,
        rgba(217, 119, 6, 0.95) 50%,
        rgba(180, 83, 9, 1) 100%
    );
}

.liquid-fill.fill-medium {
    background: linear-gradient(
        180deg,
        rgba(59, 130, 246, 0.9) 0%,
        rgba(37, 99, 235, 0.95) 50%,
        rgba(29, 78, 216, 1) 100%
    );
}

/* Default green for healthy/full */

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 991px) {
    .glass-credit-container {
        max-width: 240px;
    }

    .glass-jar {
        width: 140px;
        height: 180px;
    }

    .credit-number {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .glass-jar {
        width: 120px;
        height: 160px;
    }

    .credit-number {
        font-size: 1.75rem;
    }

    .level-markers {
        display: none;
    }
}

/* ========================================
   Animation Utilities
   ======================================== */
.fade-in-up {
    animation: fade-in-up 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fill animation on load */
.liquid-fill.animate-fill {
    animation: fill-up 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fill-up {
    from {
        height: 0%;
    }
}

/* Pulse for low balance warning */
.glass-jar.pulse-warning {
    animation: jar-pulse 2s ease-in-out infinite;
}

@keyframes jar-pulse {
    0%, 100% {
        box-shadow:
            inset 0 0 30px rgba(255, 255, 255, 0.05),
            0 10px 40px rgba(0, 0, 0, 0.2),
            0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow:
            inset 0 0 30px rgba(255, 255, 255, 0.05),
            0 10px 40px rgba(0, 0, 0, 0.2),
            0 0 0 10px rgba(245, 158, 11, 0);
    }
}
