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

html {
    scroll-behavior: smooth;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
    animation: pageLoad 0.3s ease-out;
}

@keyframes pageLoad {
    from { opacity: 0; }
    to { opacity: 1; }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.last-update {
    font-size: 0.875rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.live-indicator i {
    font-size: 0.5rem;
    animation: pulse 2s infinite;
}

.live-indicator.live { color: #10b981; }
.live-indicator.live i { color: #10b981; }
.live-indicator.checking { color: #f59e0b; }
.live-indicator.checking i { color: #f59e0b; animation: spin 1s linear infinite; }
.live-indicator.error { color: #ef4444; }
.live-indicator.error i { color: #ef4444; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.main-content {
    padding: 3rem 0;
    min-height: 70vh;
}

.market-section {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-title i {
    font-size: 1.75rem;
}

.crypto-section .section-title { color: #667eea; }
.stocks-section .section-title { color: #f5576c; }

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 15px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 15px;
    font-size: 14px;
    font-weight: 600;
    color: #10b981;
}

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

.prices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.loading-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    font-size: 1.25rem;
    color: var(--secondary-color);
}

.loading-placeholder i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

.price-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
    user-select: none;
}

.price-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.price-card:active {
    transform: translateY(-4px) scale(0.98);
}

.price-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
}

.price-symbol {
    display: flex;
    align-items: center;
    gap: 15px;
}

.price-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
}

.price-name {
    font-size: 17px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}

.price-code {
    font-size: 13px;
    color: #7f8c8d;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.price-change {
    font-size: 15px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 10px;
}

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

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

.price-value {
    font-size: 32px;
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 18px;
    letter-spacing: -0.5px;
}

.price-chart {
    width: 100%;
    height: 90px !important;
    margin-top: 12px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 35px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    z-index: 10;
}

.modal-close:hover {
    background: #e5e7eb;
    color: #1f2937;
    transform: rotate(90deg);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f3f4f6;
}

.modal-asset-icon .price-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
}

.modal-asset-info h2 {
    font-size: 28px;
    margin: 0 0 5px 0;
    color: #1f2937;
}

.modal-symbol {
    font-size: 16px;
    color: #6b7280;
    font-weight: 600;
    letter-spacing: 1px;
}

.modal-price-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
}

.modal-current-price {
    font-size: 40px;
    font-weight: 800;
    color: #1f2937;
    letter-spacing: -1px;
}

.modal-change {
    font-size: 22px;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 12px;
}

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

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

.modal-chart-container {
    margin-bottom: 30px;
    position: relative;
    height: 250px;
}

.modal-chart-container h3 {
    font-size: 18px;
    color: #4b5563;
    margin-bottom: 15px;
    font-weight: 600;
}

.modal-chart-container canvas {
    width: 100% !important;
    height: 250px !important;
    max-height: 250px !important;
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-item {
    padding: 18px;
    background: #f9fafb;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 16px;
    color: #1f2937;
    font-weight: 700;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.footer {
    background: var(--dark);
    color: white;
    padding: 2.5rem 0;
    text-align: center;
    margin-top: 4rem;
}

.footer p {
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

@media (max-width: 1024px) {
    .prices-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .header h1 { font-size: 1.5rem; }
    .header-info { width: 100%; justify-content: space-between; }
    .section-title { font-size: 1.5rem; }
    .prices-grid { grid-template-columns: 1fr; }
    .price-card { padding: 18px; }
    .price-value { font-size: 26px; }
    .modal-content { width: 95%; padding: 25px; max-height: 95vh; }
    .modal-header { flex-direction: column; align-items: flex-start; gap: 15px; }
    .modal-price-section { flex-direction: column; gap: 15px; align-items: flex-start; }
    .modal-current-price { font-size: 32px; }
    .modal-stats { grid-template-columns: 1fr; }
    .live-indicator { font-size: 0.75rem; padding: 0.375rem 0.75rem; }
}
