/* Base Styles */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --text-color: #333;
    --text-light: #7f8c8d;
    --border-radius: 4px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f5f7fa;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    text-decoration: none;
    color: var(--secondary-color);
}

a:hover {
    color: var(--primary-color);
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--secondary-color);
    color: white;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Header Styles */
header {
    background-color: white;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
}

header h1 a {
    color: inherit;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 20px;
}

nav ul li a {
    color: var(--dark-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: var(--secondary-color);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 60px 0;
    text-align: center;
    margin-bottom: 40px;
}

.hero-content h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.hero-content p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto;
}

/* Featured News */
.featured-news {
    margin-bottom: 40px;
}

.featured-news h2,
.market-snapshot h2,
.tools-highlight h2,
.newsletter h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
    font-size: 2rem;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.news-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease;
}

.news-card:hover {
    transform: translateY(-5px);
}

.news-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.news-content {
    padding: 20px;
}

.news-content h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.news-content p {
    color: var(--text-light);
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.news-source {
    display: inline-block;
    background-color: var(--light-color);
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Market Snapshot */
.market-snapshot {
    margin-bottom: 40px;
}

.market-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    position: relative;
}

.market-tabs::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #e0e0e0;
    z-index: 1;
}
.tab-button {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #7f8c8d;
    position: relative;
    transition: all 0.3s ease;
    z-index: 2;
}

.tab-button.active {
    color: #3498db;
    font-weight: 500;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #3498db;
    z-index: 3;
    animation: tabUnderline 0.3s ease-out;
}

@keyframes tabUnderline {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.market-card {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
}

#market-container {
    position: relative;
    min-height: 300px;
    overflow: hidden;
}

.market-card {
    transition: all 0.3s ease;
    transform: translateY(0);
}

.market-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.change {
    transition: all 0.5s ease;
}

.change.positive {
    animation: pulseGreen 2s infinite;
}

.change.negative {
    animation: pulseRed 2s infinite;
}

@keyframes pulseGreen {
    0% { color: #27ae60; }
    50% { color: #2ecc71; }
    100% { color: #27ae60; }
}

@keyframes pulseRed {
    0% { color: #e74c3c; }
    50% { color: #c0392b; }
    100% { color: #e74c3c; }
}

.price {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.change {
    font-size: 0.9rem;
}

.change.positive {
    color: var(--success-color);
}

.change.negative {
    color: var(--danger-color);
}

/* Tools Highlight */
.tools-highlight {
    margin-bottom: 40px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.tool-card {
    background: white;
    padding: 30px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
    transition: transform 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-5px);
}

.tool-card i {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.tool-card h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.tool-card p {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* Newsletter */
.newsletter {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 60px 0;
    text-align: center;
    border-radius: var(--border-radius);
    margin-bottom: 40px;
}

.newsletter p {
    max-width: 600px;
    margin: 0 auto 20px;
}

.newsletter form {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
}

.newsletter input[type="email"] {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    font-size: 1rem;
}

.newsletter button {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

/* News Page Specific */
.news-header {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 30px;
}

.news-header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.news-list {
    max-width: 800px;
    margin: 0 auto;
}

.news-item {
    display: flex;
    margin-bottom: 30px;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.news-item-image {
    flex: 0 0 300px;
}

.news-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-item-content {
    flex: 1;
    padding: 20px;
}

.news-item-content h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.news-meta {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.read-more {
    display: inline-block;
    margin-top: 10px;
    font-weight: bold;
}

/* Footer */
footer {
    background-color: var(--dark-color);
    color: white;
    padding: 30px 0;
    text-align: center;
}

footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.social-links {
    margin-top: 15px;
}

.social-links a {
    color: white;
    margin: 0 10px;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--secondary-color);
}

/* Responsive */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
    }
    
    nav ul {
        margin-top: 15px;
    }
    
    .news-item {
        flex-direction: column;
    }
    
    .news-item-image {
        flex: 0 0 200px;
    }
    
    .newsletter form {
        flex-direction: column;
    }
    
    .newsletter input[type="email"] {
        border-radius: var(--border-radius);
        margin-bottom: 10px;
    }
    
    .newsletter button {
        border-radius: var(--border-radius);
        width: 100%;
    }

    .news-image-container {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
    background-color: #f5f7fa;
}

.news-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.news-card:hover .news-image {
    transform: scale(1.05);
}

/* Add to your style.css */
.stale-data {
    opacity: 0.7;
    position: relative;
}

.stale-data::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.5);
    z-index: 1;
}

.data-warning {
    color: #e67e22;
    font-size: 0.8rem;
    margin-top: 5px;
    font-style: italic;
}

.market-error {
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.market-error p:first-child {
    color: #e74c3c;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.market-error p:last-child {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Crypto Carousel Styles */
.crypto-carousel {
    position: relative;
    width: 100%;
    height: 300px; /* Adjust based on your card height */
    overflow: hidden;
}

.crypto-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.65, 0, 0.35, 1);
    transform: translateX(100%);
}

.crypto-slide.active {
    opacity: 1;
    transform: translateX(0);
}

.crypto-slide.next {
    transform: translateX(100%);
}

.crypto-slide.prev {
    transform: translateX(-100%);
}

/* Navigation Dots */
.crypto-nav-dots {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 10;
}

.crypto-nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ccc;
    cursor: pointer;
    transition: background-color 0.3s;
}

.crypto-nav-dot.active {
    background-color: #3498db;
}   
}

/* News Container Layout */
.news-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Market Panel Styles */
.market-panel {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.market-panel h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.market-tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.tab-button {
    padding: 8px 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: #7f8c8d;
    position: relative;
}

.tab-button.active {
    color: #3498db;
    font-weight: 500;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #3498db;
}


.change {
    font-size: 0.9rem;
}

.change.positive {
    color: #27ae60;
}

.change.negative {
    color: #e74c3c;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.market-error {
    color: #e74c3c;
    font-size: 0.9rem;
    padding: 10px;
    background: #fdecea;
    border-radius: 4px;
}


/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-link, .current-page {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    border-radius: 4px;
}

.page-link:hover {
    background-color: #f5f5f5;
}

.current-page {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}


@media (max-width: 768px) {
    /* General Container Adjustments */
    .container {
        width: 95%; /* Slightly wider container for mobile */
        padding: 0 10px;
    }

    /* Header */
    header .container {
        flex-direction: column;
        padding: 10px 0;
    }

    header h1 {
        font-size: 1.5rem; /* Smaller logo text for mobile */
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 10px;
    }

    nav ul li {
        margin: 5px 10px; /* Tighter spacing for nav items */
    }

    nav ul li a {
        font-size: 0.9rem; /* Slightly smaller nav links */
    }

    /* Hero Section */
    .hero {
        padding: 40px 0; /* Reduced padding for mobile */
    }

    .hero-content h2 {
        font-size: 1.8rem; /* Smaller heading */
    }

    .hero-content p {
        font-size: 1rem; /* Readable paragraph text */
        padding: 0 10px;
    }

    /* News Grid */
    .news-grid {
        grid-template-columns: 1fr; /* Single column for mobile */
        gap: 15px;
    }

    .news-card {
        display: flex;
        flex-direction: column;
        max-width: 100%; /* Ensure cards take full width */
    }

    .news-image-container {
        height: 150px; /* Smaller image height for mobile */
    }

    .news-image {
        object-fit: cover;
        width: 100%;
        height: 100%;
    }

    .news-content {
        padding: 15px; /* Reduced padding for mobile */
    }

    .news-content h3 {
        font-size: 1.1rem; /* Smaller title */
    }

    .news-content p {
        font-size: 0.85rem; /* Smaller description */
    }

    /* Market Snapshot */
    .market-snapshot {
        margin-bottom: 30px;
    }

    .market-tabs {
        flex-wrap: wrap; /* Allow tabs to wrap if needed */
        justify-content: center;
    }

    .tab-button {
        padding: 8px 12px;
        font-size: 0.9rem; /* Smaller tab text */
        flex: 1; /* Equal width for tabs */
        text-align: center;
    }

    .market-grid {
        grid-template-columns: 1fr; /* Single column for market cards */
        gap: 15px;
    }

    .market-card {
        padding: 15px;
    }

    .market-card h3 {
        font-size: 1.1rem; /* Smaller card title */
    }

    .price {
        font-size: 1.3rem; /* Slightly smaller price */
    }

    .change {
        font-size: 0.85rem; /* Smaller change text */
    }

    /* Tools Highlight */
    .tools-grid {
        grid-template-columns: 1fr; /* Single column for tools */
        gap: 15px;
    }

    .tool-card {
        padding: 20px;
    }

    .tool-card i {
        font-size: 2rem; /* Smaller icon */
    }

    .tool-card h3 {
        font-size: 1.1rem;
    }

    .tool-card p {
        font-size: 0.85rem;
    }

    .btn {
        padding: 8px 15px; /* Smaller buttons for touch */
        font-size: 0.9rem;
    }

    /* Newsletter */
    .newsletter {
        padding: 40px 0; /* Reduced padding */
    }

    .newsletter form {
        flex-direction: column;
        max-width: 90%;
    }

    .newsletter input[type="email"] {
        padding: 10px;
        font-size: 0.9rem;
        border-radius: var(--border-radius);
        margin-bottom: 10px;
    }

    .newsletter button {
        padding: 10px;
        font-size: 0.9rem;
        border-radius: var(--border-radius);
    }

    /* Crypto Carousel (if implemented) */
    .crypto-carousel {
        height: 250px; /* Smaller height for mobile */
    }

    .crypto-nav-dots {
        bottom: 5px; /* Closer to bottom */
    }

    .crypto-nav-dot {
        width: 8px;
        height: 8px; /* Smaller dots for mobile */
    }

    /* Pagination */
    .pagination {
        gap: 0.3rem;
    }

    .page-link, .current-page {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    /* News Container (if applicable) */
    .news-container {
        grid-template-columns: 1fr; /* Stack news and market panel */
    }

    .market-panel {
        position: static; /* Remove sticky positioning for mobile */
        margin-top: 20px;
    }
}

/* Ultra-Small Devices (max-width: 480px) */
@media (max-width: 480px) {
    .hero-content h2 {
        font-size: 1.5rem;
    }

    .hero-content p {
        font-size: 0.9rem;
    }

    .news-card {
        flex-direction: column;
    }

    .news-image-container {
        height: 120px; /* Even smaller images for tiny screens */
    }

    .market-card h3 {
        font-size: 1rem;
    }

    .price {
        font-size: 1.2rem;
    }

    .tool-card {
        padding: 15px;
    }

    .newsletter {
        padding: 30px 0;
    }
}