/* CSS Reset & Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0077cc;
    --primary-dark: #005fa3;
    --secondary-color: #6a11cb;
    --secondary-dark: #2575fc;
    --success-color: #00c9a7;
    --danger-color: #ff4d4d;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
    color: white;
    padding: 30px 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-left h1 {
    margin: 0 0 5px;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.header-left p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.95;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.icon-btn:active {
    transform: scale(0.95);
}

.moon-icon {
    display: none;
}

body.dark-mode .sun-icon {
    display: none;
}

body.dark-mode .moon-icon {
    display: inline;
}

/* Price Summary Cards */
.price-summary {
    margin-top: 30px;
}

.price-summary h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 25px;
    font-weight: 700;
}

.price-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.price-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 2px solid transparent;
}

.price-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.crypto-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.card-title h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.card-title .symbol {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.card-body {
    text-align: center;
}

.price-loading {
    font-size: 0.9rem;
    color: var(--text-secondary);
    animation: pulse 1.5s infinite;
}

.price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 10px 0;
}

.price-change {
    font-size: 1rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    display: inline-block;
}

.price-change.positive {
    color: var(--success-color);
    background: rgba(0, 201, 167, 0.1);
}

.price-change.negative {
    color: var(--danger-color);
    background: rgba(255, 77, 77, 0.1);
}

/* Crypto Table */
.crypto-table {
    margin-top: 50px;
}

.crypto-table h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 25px;
    font-weight: 700;
}

.table-container {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

#crypto-table {
    width: 100%;
    border-collapse: collapse;
}

#crypto-table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

#crypto-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

#crypto-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

#crypto-table tbody tr {
    transition: var(--transition);
}

#crypto-table tbody tr:hover {
    background-color: rgba(0, 119, 204, 0.05);
}

#crypto-table tbody tr:last-child td {
    border-bottom: none;
}

.crypto-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crypto-name img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.crypto-symbol {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: block;
}

/* Loading Spinner */
.loading-spinner {
    border: 4px solid rgba(0, 119, 204, 0.1);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 30px auto;
    display: none;
}

.loading-spinner.active {
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Error Message */
.error-message {
    background: rgba(255, 77, 77, 0.1);
    border: 2px solid var(--danger-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.error-message.hidden {
    display: none;
}

.error-message span {
    font-size: 2rem;
}

.error-message p {
    margin: 0;
    color: var(--danger-color);
    font-weight: 600;
}

.retry-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    margin-left: 10px;
}

.retry-btn:hover {
    background: #e60000;
    transform: scale(1.05);
}

/* Chart Section */
.chart-section {
    margin-top: 50px;
}

.chart-section h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 25px;
    font-weight: 700;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 30px;
}

.chart-container {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.chart-container:hover {
    box-shadow: var(--shadow-lg);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chart-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.chart-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.tradingview-widget-container {
    border-radius: 8px;
    overflow: hidden;
    min-height: 400px;
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 30px 0;
    text-align: center;
    margin-top: 60px;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
}

footer p {
    margin: 8px 0;
    font-size: 1rem;
}

.footer-note {
    opacity: 0.9;
    font-size: 0.9rem;
}

.footer-disclaimer {
    opacity: 0.8;
    font-size: 0.85rem;
    margin-top: 15px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--primary-color);
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    min-width: 250px;
    font-weight: 600;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.info {
    background: var(--primary-color);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Dark Mode */
body.dark-mode {
    --bg-light: #1a1a1a;
    --bg-white: #2d2d2d;
    --text-primary: #f4f4f9;
    --text-secondary: #bbb;
    --border-color: #444;
}

body.dark-mode .price-summary h2,
body.dark-mode .crypto-table h2,
body.dark-mode .chart-section h2 {
    color: #00aaff;
}

body.dark-mode #crypto-table thead {
    background: linear-gradient(135deg, #004080, #0066cc);
}

body.dark-mode #crypto-table tbody tr:hover {
    background-color: rgba(0, 170, 255, 0.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-left h1 {
        font-size: 1.8rem;
    }

    .price-cards {
        grid-template-columns: 1fr;
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }

    #crypto-table {
        font-size: 0.85rem;
    }

    #crypto-table th,
    #crypto-table td {
        padding: 10px 8px;
    }

    .toast-container {
        bottom: 20px;
        right: 20px;
        left: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    .header-left h1 {
        font-size: 1.5rem;
    }

    .header-left p {
        font-size: 0.9rem;
    }

    .price-summary h2,
    .crypto-table h2,
    .chart-section h2 {
        font-size: 1.5rem;
    }

    .price {
        font-size: 1.5rem;
    }

    .chart-header h3 {
        font-size: 1.1rem;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}
