:root[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #eeeeee;
    --header-bg: #1a1a2e;
    --header-text: #ffffff;
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --hover-bg: #f8f9fa;
    --dropdown-bg: #ffffff;
    --dropdown-hover: #f5f5f5;
    --success: #00c853;
    --danger: #ff1744;
    --warning: #ffc107;
    --info: #00b0ff;
    --gold: #FFD700;
    --primary: #2962ff;
    --secondary-blue: #0039cb;
}

:root[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #232342;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #2a2a4a;
    --header-bg: #0f0f1a;
    --header-text: #ffffff;
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --hover-bg: #2a2a4a;
    --dropdown-bg: #232342;
    --dropdown-hover: #2a2a4a;
    --success: #00e676;
    --danger: #ff1744;
    --warning: #ffd740;
    --info: #40c4ff;
    --gold: #FFD700;
    --primary: #448aff;
    --secondary-blue: #2962ff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--header-bg);
    color: var(--header-text);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--card-shadow);
    z-index: 1000;
    transition: transform 0.3s;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Header Styles */
.header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--card-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--header-text);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo i {
    color: var(--gold);
    margin-right: 0.5rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    position: relative;
}

.dropdown-arrow {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    margin-left: auto;
}


.nav-link:hover {
    color: var(--header-text);
}

/* Menu Toggle Button */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--header-text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}


/* Dropdown Styles */
.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--dropdown-bg);
    border-radius: 5px;
    box-shadow: var(--card-shadow);
    width: 200px;
    padding: 1rem 0;
    display: none;
    z-index: 10;
}

.nav-item:hover .dropdown {
    display: block;
}

.dropdown-item {
    padding: 0.5rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    transition: background-color 0.3s;
}

.dropdown-item:hover {
    background-color: var(--dropdown-hover);
    color: var(--primary);
}

/* Ticker Tape */
.ticker-tape {
    background-color: var(--bg-secondary);
    padding: 0.8rem 0;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    position: relative;
}

.ticker-tape-container {
    white-space: nowrap;
    animation: ticker 40s linear infinite;
    display: inline-block;
}

.ticker-tape-container:hover {
    animation-play-state: paused;
}

@keyframes ticker {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.ticker-item {
    display: inline-block;
    margin-right: 30px;
    font-weight: 500;
    color: var(--text-primary);
}

.ticker-item.up {
    color: var(--success);
}

.ticker-item.down {
    color: var(--danger);
}

/* Live Data Highlights */
@keyframes highlight-up {
    0% {
        background-color: rgba(0, 200, 83, 0.3);
    }

    100% {
        background-color: transparent;
    }
}

@keyframes highlight-down {
    0% {
        background-color: rgba(255, 23, 68, 0.3);
    }

    100% {
        background-color: transparent;
    }
}

.highlight-up {
    animation: highlight-up 1s ease-out;
}

.highlight-down {
    animation: highlight-down 1s ease-out;
}

/* Market Section */
.market-section {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Page Content Typography */
.page-content h1 {
    font-size: 2rem !important;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.page-content h2 {
    font-size: 1.5rem !important;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
}

.page-content h3 {
    font-size: 1.25rem !important;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}

.page-content h4 {
    font-size: 1.1rem !important;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.page-content p {
    margin-bottom: 1rem;
}

/* Tab Styles */
.tab-navigation {
    display: flex;
    gap: 1rem;
    margin-bottom: 0;
    overflow-x: auto;
}


.tab-button {
    padding: 0.8rem 1.5rem;
    border: 1px solid transparent;
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    box-shadow: var(--card-shadow);
}

.tab-button:hover {
    background: var(--header-bg);
    color: var(--header-text);
}

.tab-button.active {
    background: var(--header-bg);
    color: var(--header-text);
}

.tab-button i {
    font-size: 1.2rem;
}

/* Search Box Styles */
.search-container {
    display: flex;
    align-items: center;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    font-size: 1rem;
}

.search-input {
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    width: 250px;
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

/* Mobile Market Selector */
.mobile-market-selector {
    display: none;
    width: 100%;
    margin-bottom: 1rem;
}

.market-select {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
    cursor: pointer;
}

h1.market-card-title {
    font-size: 22px;
    font-weight: 500;
}

h2.market-card-title {
    font-size: 22px;
    font-weight: 500;
}

span.market-note {
    font-size: 16px;
    padding: 2px;
    margin: 2px;
}

.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.tab-pane.active {
    display: block;
    opacity: 1;
}

/* Market Card */
.market-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.market-card-header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.market-subtitle {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin: 1.5rem;
    font-weight: 500;
}

/* Table Styles */
.market-table {
    width: 100%;
    border-collapse: collapse;
}

.market-table th,
.market-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.market-table th {
    background: var(--header-bg);
    color: var(--header-text);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    position: relative;
}

.market-table th:hover {
    background: var(--primary);
}

.market-table th:after {
    content: '↕';
    position: absolute;
    right: 8px;
    opacity: 0.5;
}

.market-table tr {
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.market-table tr.row-up {
    background: rgba(0, 200, 83, 0.05);
    border-left-color: var(--success);
}

.market-table tr.row-down {
    background: rgba(255, 23, 68, 0.05);
    border-left-color: var(--danger);
}

.market-table tr:hover {
    background: var(--hover-bg);
}

.market-table tr.row-up:hover {
    background: rgba(0, 200, 83, 0.1);
}

.market-table tr.row-down:hover {
    background: rgba(255, 23, 68, 0.1);
}

.market-table td.price-up {
    color: var(--success);
    font-weight: 500;
}

.market-table td.price-down {
    color: var(--danger);
    font-weight: 500;
}

.market-table a {
    text-decoration: none;
    color: inherit;
    display: contents;
}

.refresh-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
    padding: 0.5rem 1rem;
}

/* Ticker Links */
.ticker-item a {
    color: inherit;
    text-decoration: none;
    display: inline-block;
}

.ticker-item a:hover {
    text-decoration: underline;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
        flex-direction: row;
        /* Keep logo and hamburger on same row */
        justify-content: space-between;
        gap: 0;
    }

    .menu-toggle {
        display: block;
    }

    .nav-right {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background-color: var(--header-bg);
        flex-direction: column;
        padding: 4rem 1.5rem 2rem;
        transition: right 0.3s ease;
        z-index: 1000;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
        align-items: flex-start;
        overflow-y: auto;
    }

    .nav-right.active {
        right: 0;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .nav-link {
        padding: 1rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
    }

    .dropdown {
        width: 100%;
        position: static;
        box-shadow: none;
        margin-top: 0;
        padding: 0 0 0 1rem;
        display: none;
        background: transparent;
    }

    .nav-item.active .dropdown {
        display: block;
    }

    .nav-item.active .dropdown-arrow {
        transform: rotate(180deg);
    }

    .dropdown-item {

        color: rgba(255, 255, 255, 0.8);
        padding: 0.8rem 0;
    }


    .market-section {
        padding: 1rem;
    }

    .mobile-market-selector {
        display: block;
    }

    .tab-navigation {
        display: none;
    }

    .market-controls {
        flex-direction: column;
        align-items: stretch !important;
    }

    .search-container {
        width: 100%;
    }

    .search-box input {
        width: 100% !important;
    }

    .tab-button {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }


    .market-table {
        font-size: 0.9rem;
    }

    .market-subtitle {
        font-size: 1.2rem;
        margin: 1rem;
    }

    .theme-toggle {
        bottom: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Footer Styles */
.footer {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 4rem 0 0;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
}

.footer-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.footer-title {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-title i {
    color: var(--gold);
}

.footer-description {
    color: var(--text-secondary);
    line-height: 1.6;
    opacity: 0.8;
}

.footer-subtitle {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
    opacity: 0.8;
}

.footer-links a:hover {
    color: var(--header-text);
    opacity: 1;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-link {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--header-text);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.footer-bottom {
    margin-top: 4rem;
    padding: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.copyright {
    color: var(--text-secondary);
    opacity: 0.8;
}

.footer-apps {
    display: flex;
    gap: 1rem;
}

.app-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--header-text);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.app-link:hover {
    background: var(--primary);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .footer {
        padding: 2rem 0 0;
        margin-top: 2rem;
    }

    .footer-content {
        padding: 0 1rem;
        gap: 2rem;
    }

    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-apps {
        width: 100%;
        justify-content: center;
    }
}