/**
 * Account Carousel - Revolut-style swipeable account selector
 * Theme-aware with currency-specific accent colors
 */

/* === CAROUSEL CONTAINER WRAPPER - breaks out of parent padding === */
#account-carousel-container {
    margin-left: -20px;
    margin-right: -20px;
    width: calc(100% + 40px);
}

/* === CAROUSEL CONTAINER === */
.account-carousel {
    position: relative;
    width: 100%;
    overflow: hidden; /* Needed for swipe animation */
    padding: 5px 0 10px;
    touch-action: pan-y pinch-zoom;
    user-select: none;
    -webkit-user-select: none;
}

/* === TRACK (holds all slides) === */
.carousel-track {
    display: flex;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Disable transition during drag for responsive feel */
.carousel-track.dragging {
    transition: none !important;
}

/* === INDIVIDUAL SLIDE === */
.carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    box-sizing: border-box;
    opacity: 0.4;
    transform: scale(0.9);
    transition: opacity 0.35s ease, transform 0.35s ease;
    position: relative;
    /* NO overflow: hidden - sparkline needs to break out to screen edges */
}

.carousel-slide.active {
    opacity: 1;
    transform: scale(1);
}

/* Content layer (above sparkline) */
.slide-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* === SPARKLINE CHART === */
.sparkline-container {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 120px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.35;
    transition: opacity 0.3s ease;
}

/* Desktop: Cap the width so it doesn't go crazy wide */
@media (min-width: 500px) {
    .sparkline-container {
        max-width: 480px;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
    }
}

.carousel-slide.active .sparkline-container {
    opacity: 0.5;
}

.sparkline-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Min/Max Labels on the right */
.sparkline-labels {
    position: absolute;
    right: 8px;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px 0;
    pointer-events: none;
}

.sparkline-max,
.sparkline-min {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.9;
    text-align: right;
}

.sparkline-max {
    color: #4CAF50;
}

.sparkline-min {
    color: #F44336;
}

/* Light mode adjustments */
body[data-theme="light"] .sparkline-container {
    opacity: 0.3;
}

body[data-theme="light"] .carousel-slide.active .sparkline-container {
    opacity: 0.45;
}

/* === ICON WRAPPER === */
.slide-icon-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.slide-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* CoinGecko logo images inside slide icon */
.slide-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Light mode: Slightly darker shadow */
body[data-theme="light"] .slide-icon {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.slide-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* === BALANCE DISPLAY === */
.slide-balance {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* Balance row for crypto (amount + symbol side by side) */
.balance-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
}

.balance-main {
    font-family: 'Outfit', sans-serif;
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    /* Animated gradient for active slide - matches existing luxury-balance */
    background: linear-gradient(
        90deg, 
        #FFD700 0%, 
        #FDB931 20%, 
        #FFFFFF 50%, 
        #FDB931 80%, 
        #FFD700 100%
    );
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shine 3s linear infinite;
    text-shadow: 0px 2px 10px rgba(255, 215, 0, 0.2);
}

/* Light mode: Darker gold gradient */
body[data-theme="light"] .balance-main {
    background: linear-gradient(
        90deg, 
        #8B7328 0%, 
        #A68932 20%, 
        #C9A227 50%, 
        #A68932 80%, 
        #8B7328 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

@keyframes shine {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.balance-symbol {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-secondary);
}

.balance-usd {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.balance-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.balance-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
    padding: 3px 10px;
    border-radius: 20px;
}

.balance-change.positive {
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.15);
}

.balance-change.negative {
    color: #F44336;
    background: rgba(244, 67, 54, 0.15);
}

/* === PLACEHOLDER SLIDE (Buy Crypto CTA) === */
.placeholder-slide {
    opacity: 0.6;
}

.placeholder-slide.active {
    opacity: 1;
}

.placeholder-balance .balance-main {
    font-size: 24px;
    background: none;
    color: var(--text-secondary);
    -webkit-background-clip: unset;
    background-clip: unset;
    animation: none;
    text-shadow: none;
}

.placeholder-balance .balance-sub {
    font-size: 14px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.placeholder-slide .slide-icon {
    border: 2px dashed var(--border-color-strong);
    background: transparent !important;
    color: var(--text-secondary) !important;
}

/* === DOT INDICATORS === */
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: var(--border-color-strong);
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.carousel-dot:hover {
    background: var(--text-secondary);
    transform: scale(1.2);
}

.carousel-dot.active {
    background: var(--gold);
    width: 24px;
    border-radius: 4px;
}

/* Light mode dots */
body[data-theme="light"] .carousel-dot {
    background: rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .carousel-dot:hover {
    background: rgba(0, 0, 0, 0.3);
}

body[data-theme="light"] .carousel-dot.active {
    background: var(--gold);
}

/* === CURRENCY-SPECIFIC ACCENT COLORS === */
/* These can be applied via inline styles or data attributes */

/* USD - Green */
.carousel-slide[data-account-id="USD"] .slide-icon {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
}

/* Bitcoin - Orange */
.carousel-slide[data-account-id="bitcoin"] .slide-icon {
    background: rgba(247, 147, 26, 0.15);
    color: #F7931A;
}

/* Ethereum - Blue/Purple */
.carousel-slide[data-account-id="ethereum"] .slide-icon {
    background: rgba(98, 126, 234, 0.15);
    color: #627EEA;
}

/* Tether/USDT - Teal */
.carousel-slide[data-account-id="tether"] .slide-icon {
    background: rgba(38, 161, 123, 0.15);
    color: #26A17B;
}

/* Solana - Purple */
.carousel-slide[data-account-id="solana"] .slide-icon {
    background: rgba(153, 69, 255, 0.15);
    color: #9945FF;
}

/* Binance Coin - Yellow */
.carousel-slide[data-account-id="binancecoin"] .slide-icon {
    background: rgba(243, 186, 47, 0.15);
    color: #F3BA2F;
}

/* Ripple/XRP - Dark Blue/Gray */
.carousel-slide[data-account-id="ripple"] .slide-icon {
    background: rgba(35, 41, 47, 0.25);
    color: #fff;
}

/* Cardano - Blue */
.carousel-slide[data-account-id="cardano"] .slide-icon {
    background: rgba(0, 51, 173, 0.15);
    color: #0033AD;
}

/* Dogecoin - Gold */
.carousel-slide[data-account-id="dogecoin"] .slide-icon {
    background: rgba(196, 166, 72, 0.15);
    color: #C4A648;
}

/* Avalanche - Red */
.carousel-slide[data-account-id="avalanche-2"] .slide-icon {
    background: rgba(232, 65, 66, 0.15);
    color: #E84142;
}

/* Polygon/MATIC - Purple */
.carousel-slide[data-account-id="matic-network"] .slide-icon {
    background: rgba(130, 71, 229, 0.15);
    color: #8247E5;
}

/* Chainlink - Blue */
.carousel-slide[data-account-id="chainlink"] .slide-icon {
    background: rgba(55, 91, 210, 0.15);
    color: #375BD2;
}

/* === LIGHT MODE ADJUSTMENTS === */
body[data-theme="light"] .carousel-slide[data-account-id="ripple"] .slide-icon {
    background: rgba(35, 41, 47, 0.1);
    color: #23292F;
}

/* === RESPONSIVE ADJUSTMENTS === */
@media (max-width: 360px) {
    .balance-main {
        font-size: 30px;
    }
    
    .balance-symbol {
        font-size: 16px;
    }
    
    .slide-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* === SWIPE HINT ANIMATION (optional - shows on first load) === */
@keyframes swipeHint {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-10px); }
}

.account-carousel.show-hint .carousel-track {
    animation: swipeHint 1s ease-in-out 2;
}
