/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0B6FFF;
    --bg-deep: #0554CC;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-dark: #1B2845;
    --card-date: rgba(255, 255, 255, 0.2);
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-white: #ffffff;
    --green: #16a34a;
    --green-bg: rgba(22, 163, 74, 0.1);
    --red: #dc2626;
    --red-bg: rgba(220, 38, 38, 0.1);
    --radius: 20px;
    --radius-sm: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.18);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-deep) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-x: hidden;
}

/* Animated background blobs */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    z-index: 0;
    animation: float 8s ease-in-out infinite;
}

body::before {
    width: 400px;
    height: 400px;
    background: #3b82f6;
    top: -100px;
    left: -100px;
}

body::after {
    width: 350px;
    height: 350px;
    background: #06b6d4;
    bottom: -80px;
    right: -80px;
    animation-delay: -4s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ===== Container ===== */
.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 4px;
}

.header__title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -0.02em;
}

.header__status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-white);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}

/* ===== Grid ===== */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===== Card Base ===== */
.card {
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    animation: cardIn 0.5s ease-out backwards;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Staggered animation */
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }

/* ===== Crypto Cards ===== */
.card--crypto {
    grid-column: 1 / 2;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.card__icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition);
}

.card:hover .card__icon {
    transform: scale(1.1) rotate(5deg);
}

.card__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.card__label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.card__price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.card__change {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    width: fit-content;
    transition: background var(--transition);
}

.card__change--up {
    color: var(--green);
    background: var(--green-bg);
}

.card__change--down {
    color: var(--red);
    background: var(--red-bg);
}

/* Mini sparkline area (decorative) */
.card__sparkline {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 80px;
    height: 40px;
    opacity: 0.15;
}

.card__sparkline svg {
    width: 100%;
    height: 100%;
}

/* ===== Fiat Card ===== */
.card--fiat {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    background: var(--card-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    backdrop-filter: blur(20px);
}

.card__fiat-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 4px;
}

.card__fiat-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card__fiat-symbol {
    font-size: 1.1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    width: 22px;
    text-align: center;
}

.card__fiat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -0.02em;
}

.card__fiat-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: auto;
}

.card__fiat-change--up {
    color: #4ade80;
}

.card__fiat-change--down {
    color: #f87171;
}

.card__fiat-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
}

/* ===== Date Card ===== */
.card--date {
    grid-column: 2 / 3;
    background: var(--card-date);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0;
    padding: 24px 20px;
}

.card__date-day {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--text-white);
    line-height: 1;
    letter-spacing: -0.03em;
}

.card__date-month {
    font-size: 1.3rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    text-transform: lowercase;
}

/* ===== Update Card ===== */
.card--update {
    grid-column: 1 / 3;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
}

.update-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
}

.update-time {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-white);
}

.update-btn {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 10px;
    padding: 8px;
    color: var(--text-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), transform var(--transition);
}

.update-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.update-btn:active {
    transform: rotate(180deg) scale(0.95);
}

.update-btn.spinning svg {
    animation: spin 0.8s ease;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== Footer ===== */
.footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.35);
}

.footer__dot {
    font-size: 0.5rem;
}

/* ===== Loading shimmer ===== */
.shimmer {
    background: linear-gradient(
        90deg,
        rgba(200, 200, 200, 0.15) 25%,
        rgba(200, 200, 200, 0.35) 50%,
        rgba(200, 200, 200, 0.15) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
    color: transparent !important;
}

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

/* ===== Value update flash ===== */
@keyframes flash-green {
    0% { background-color: rgba(74, 222, 128, 0.25); }
    100% { background-color: transparent; }
}

@keyframes flash-red {
    0% { background-color: rgba(248, 113, 113, 0.25); }
    100% { background-color: transparent; }
}

.flash-up {
    animation: flash-green 0.8s ease-out;
}

.flash-down {
    animation: flash-red 0.8s ease-out;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .card__price {
        font-size: 1.2rem;
    }

    .card__fiat-value {
        font-size: 1.4rem;
    }

    .card__date-day {
        font-size: 2.8rem;
    }

    .card--crypto {
        padding: 16px;
        gap: 10px;
    }

    .card__icon {
        width: 40px;
        height: 40px;
    }

    .card__icon svg {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 360px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .card--crypto,
    .card--fiat,
    .card--date,
    .card--update {
        grid-column: 1 / -1;
        grid-row: auto;
    }
}
