body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f8fafc;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

/* --- Main App Container --- */
.app-container {
    max-width: 800px;
    width: 100%;
    padding: 40px;
    text-align: center;
}

.app-header {
    margin-bottom: 50px;
}

.app-header h1 {
    font-size: 2.5rem;
    color: #1a202c;
    margin: 0 0 20px 0;
    font-weight: 600;
}

.crypto-main-icon {
    color: #4a5568;
    margin-right: 12px;
}

/* --- Connection Status Indicator --- */
.connection-status {
    margin-top: 10px;
    padding: 8px 16px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.status-icon {
    font-size: 0.85rem;
}

.status-connecting {
    background-color: #fbbf24;
    color: #92400e;
}
.status-open {
    background-color: #34d399;
    color: #065f46;
}
.status-closed,
.status-error {
    background-color: #f87171;
    color: #991b1b;
}
.status-offline {
    background-color: #9ca3af;
    color: #374151;
}

/* --- Tickers Grid --- */
.tickers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.ticker-container {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.2s ease;
}

.ticker-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ticker-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.crypto-icon {
    font-weight: bold;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crypto-icon img {
    width: 32px;
    height: 32px;
}

.ticker-symbol {
    font-size: 1.6rem;
    margin: 0;
    color: #1a202c;
    font-weight: 600;
}

.vs-currency {
    font-size: 1rem;
    color: #718096;
    font-weight: 400;
}

/* --- Price Container --- */
.price-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.price-direction-icon {
    font-size: 1.2rem;
    transition: all 0.3s ease;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
}

/* --- Price Styling & Animations --- */
.ticker-price {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
    transition: all 0.3s ease;
}

.price-up {
    color: #059669;
}

.price-up + .price-direction-icon,
.price-up ~ .price-container .price-direction-icon {
    background-color: #d1fae5;
    color: #059669;
}

.price-down {
    color: #dc2626;
}

.price-down + .price-direction-icon,
.price-down ~ .price-container .price-direction-icon {
    background-color: #fee2e2;
    color: #dc2626;
}

.price-same {
    color: #374151;
}

.price-same + .price-direction-icon,
.price-same ~ .price-container .price-direction-icon {
    background-color: #f3f4f6;
    color: #6b7280;
}

/* --- Footer --- */
.app-footer {
    margin-top: 50px;
    padding: 25px 0;
    border-top: 1px solid #e2e8f0;
}

.app-footer p {
    color: #64748b;
    font-size: 0.85rem;
    margin: 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.app-footer i {
    color: #64748b;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* --- PWA Install/Update Banners --- */
.install-banner,
.update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    color: #374151;
    padding: 16px 20px;
    z-index: 1000;
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid #e5e7eb;
}

.update-banner {
    background: #fef3c7;
    border-bottom: 1px solid #f59e0b;
    color: #92400e;
}

.install-content,
.update-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.install-content span,
.update-content span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.install-content i,
.update-content i {
    font-size: 16px;
    opacity: 0.8;
}

.install-btn,
.update-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 14px;
    white-space: nowrap;
}

.install-btn:hover,
.update-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.update-btn {
    background: #f59e0b;
    color: #92400e;
}

.update-btn:hover {
    background: #d97706;
}

.dismiss-btn {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dismiss-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Adjust body padding when banners are present */
body:has(.install-banner),
body:has(.update-banner) {
    padding-top: 64px;
}

/* --- Responsive Adjustments for PWA --- */
@media (max-width: 768px) {
    .install-content,
    .update-content {
        flex-wrap: wrap;
        gap: 12px;
        text-align: left;
    }
    
    .install-content span,
    .update-content span {
        font-size: 14px;
        flex: 1;
        min-width: 200px;
    }
    
    .install-btn,
    .update-btn {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    body:has(.install-banner),
    body:has(.update-banner) {
        padding-top: 72px;
    }
}

/* --- Standalone App Styles (when installed as PWA) --- */
@media (display-mode: standalone) {
    body {
        padding-top: 20px;
    }
    
    .app-header h1 {
        margin-top: 0;
    }
    
    /* Hide install banner when already installed */
    .install-banner {
        display: none;
    }
}

/* iOS Safari specific adjustments */
@media (display-mode: standalone) and (-webkit-touch-callout: none) {
    body {
        padding-top: env(safe-area-inset-top, 20px);
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }
}
@media (max-width: 768px) {
    .app-container {
        padding: 20px;
    }

    .app-header h1 {
        font-size: 2rem;
    }

    .ticker-container {
        padding: 20px;
    }

    .ticker-symbol {
        font-size: 1.4rem;
    }

    .ticker-price {
        font-size: 1.8rem;
    }

    .crypto-icon {
        font-size: 1.5rem;
        width: 32px;
        height: 32px;
    }
}
