:root {
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --success: #10b981;
    --error: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: radial-gradient(circle at top right, #1e1b4b, var(--bg-darker));
    color: var(--text-primary);
    min-height: 100vh;
    padding: 30px 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    width: 100%;
    max-width: 800px;
    position: relative;
    z-index: 1;
}

/* Add a subtle background glow */
.container::before {
    content: '';
    position: absolute;
    top: -100px;
    left: -100px;
    width: 300px;
    height: 300px;
    background: var(--accent);
    filter: blur(150px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.8em;
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.search-box {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.search-box:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.search-box input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1.1em;
    font-weight: 400;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box input:focus {
    outline: none;
}

.coin-list {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    position: relative;
}

#connection-status {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 2;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
}

.connection-status.connected {
    color: var(--success);
}

.connection-status.connected::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulseGlow 2s infinite;
}

.connection-status.disconnected {
    color: var(--error);
}

.connection-status.disconnected::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error);
    box-shadow: 0 0 8px var(--error);
}

.section-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.coin-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.coin-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.coin-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex: 1;
    font-weight: 500;
    font-size: 1.1em;
    user-select: none;
    gap: 12px;
}

.crypto-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px;
}

/* Custom Checkbox styles */
.coin-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-secondary);
    border-radius: 6px;
    margin-right: 14px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    background: rgba(0, 0, 0, 0.2);
}

.coin-item input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.coin-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    font-weight: 900;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.price {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.price.loading {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.9em;
}

.price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 120px;
    gap: 4px;
}

.change-badge {
    font-size: 0.75em;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.change-badge.positive {
    color: var(--success);
    background: rgba(16, 185, 129, 0.15);
}

.change-badge.negative {
    color: var(--error);
    background: rgba(239, 68, 68, 0.15);
}

.price.update-flash-up {
    animation: flashPriceUp 0.8s ease-out;
}

.price.update-flash-down {
    animation: flashPriceDown 0.8s ease-out;
}

.drag-handle {
    color: var(--text-secondary);
    cursor: grab;
    padding: 4px 8px 4px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    opacity: 0.5;
    transition: opacity 0.2s;
    user-select: none;
}

.drag-handle:hover {
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

.divider {
    margin: 24px 0;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.status {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 1.1em;
}

/* Animations */
@keyframes pulseGlow {
    0% { opacity: 0.5; box-shadow: 0 0 4px var(--success); }
    50% { opacity: 1; box-shadow: 0 0 12px var(--success); }
    100% { opacity: 0.5; box-shadow: 0 0 4px var(--success); }
}

@keyframes flashPriceUp {
    0% { color: var(--success); text-shadow: 0 0 10px rgba(16, 185, 129, 0.8); }
    100% { color: var(--text-primary); text-shadow: none; }
}

@keyframes flashPriceDown {
    0% { color: var(--error); text-shadow: 0 0 10px rgba(239, 68, 68, 0.8); }
    100% { color: var(--text-primary); text-shadow: none; }
}

.tracked-container {
    margin-bottom: 24px;
}

.scroll-area {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px; /* Buffer for custom scrollbar */
}

/* Modern minimalist custom scrollbar */
.scroll-area::-webkit-scrollbar {
    width: 6px;
}
.scroll-area::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}
.scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
.scroll-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

@media (max-width: 768px) {
    body {
        padding: 16px 12px;
    }

    h1 {
        font-size: 2em;
        margin-bottom: 20px;
    }

    .container::before {
        width: 200px;
        height: 200px;
        top: -50px;
        left: -50px;
    }

    .search-box, .coin-list {
        padding: 16px;
        border-radius: 16px;
    }

    .coin-item {
        padding: 10px 12px;
    }

    .coin-item label {
        font-size: 1em;
    }

    .price {
        font-size: 1em;
        min-width: 90px;
    }
    
    #connection-status {
        position: relative;
        top: 0;
        right: 0;
        margin-bottom: 16px;
        display: inline-flex;
    }
}