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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Header Styles */
header {
    background-color: #2c3e50;
    color: white;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.last-updated {
    font-size: 0.9rem;
    color: #ecf0f1;
    opacity: 0.9;
}

/* Controls Section */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #34495e;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#search {
    padding: 0.6rem;
    width: 250px;
    border-radius: 4px;
    border: none;
    font-size: 1rem;
    transition: width 0.3s ease;
}

#search:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3498db;
    width: 300px;
}

#currency-select {
    padding: 0.6rem;
    border-radius: 4px;
    border: none;
    font-size: 1rem;
    background-color: white;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.3s ease;
}

#currency-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3498db;
}

/* Ticker Container */
.ticker-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
}

/* Ticker Card Styles */
.ticker-card {
    background-color: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.ticker-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.coin-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.coin-icon {
    width: 28px;
    height: 28px;
    margin-right: 0.75rem;
    border-radius: 50%;
}

.coin-name {
    font-weight: bold;
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

.coin-symbol {
    color: #7f8c8d;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.coin-rank {
    margin-left: auto;
    font-size: 0.8rem;
    color: #7f8c8d;
    background-color: #f0f0f0;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.price {
    font-size: 1.4rem;
    font-weight: bold;
    margin: 1rem 0;
    color: #2c3e50;
}

.price-change {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.positive {
    background-color: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

.negative {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.market-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.market-info span {
    display: flex;
    flex-direction: column;
}

.market-info span:first-child {
    margin-right: 1rem;
}

/* Loading, Error, and Message States */
.loading, .error, .message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 2rem;
    font-size: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.loading {
    color: #3498db;
}

.error {
    color: #e74c3c;
}

.message {
    color: #7f8c8d;
}

.spinner {
    border: 4px solid rgba(52, 152, 219, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-left-color: #3498db;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

button {
    margin-top: 1.5rem;
    padding: 0.6rem 1.2rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .ticker-container {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    #search {
        width: 100%;
    }
    
    #search:focus {
        width: 100%;
    }
    
    #currency-select {
        width: 100%;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .price {
        font-size: 1.2rem;
    }
    
    .coin-name {
        font-size: 1rem;
    }
    
    .market-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .market-info span:first-child {
        margin-right: 0;
    }
}

/* Animation for price changes */
@keyframes flashUpdate {
    0% { background-color: transparent; }
    50% { background-color: rgba(52, 152, 219, 0.2); }
    100% { background-color: transparent; }
}

.price-updated {
    animation: flashUpdate 1s;
}