:root {
    --primary-dark: #0a0e27;
    --secondary-dark: #131829;
    --accent-gold: #d4af37;
    --accent-green: #00ff88;
    --accent-red: #ff3366;
    --text-primary: #e8e8e8;
    --text-secondary: #9ca3af;
    --border-color: #2a2f45;
    --card-bg: #181c2e;
}

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

body {
    font-family: 'Work Sans', sans-serif;
    background: var(--primary-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Ticker Tape */
.ticker-container {
    background: var(--secondary-dark);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.ticker-wrapper {
    display: flex;
    animation: scroll 60s linear infinite;
}

.ticker-wrapper:hover {
    animation-play-state: paused;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    margin: 0 30px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.ticker-symbol {
    color: var(--accent-gold);
    margin-right: 6px;
    font-weight: 600;
}

.ticker-price {
    margin-right: 6px;
}

.ticker-change {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.ticker-change.positive {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent-green);
}

.ticker-change.negative {
    background: rgba(255, 51, 102, 0.1);
    color: var(--accent-red);
}

/* Header */
header {
    padding: 30px 60px;
    background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--primary-dark) 100%);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 36px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-gold) 0%, #f4e4a8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    cursor: pointer;
    white-space: nowrap;
}

/* Search Bar */
.search-container {
    position: relative;
    flex: 1;
    max-width: 600px;
}

.search-input {
    width: 100%;
    padding: 14px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Work Sans', sans-serif;
    font-size: 15px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--secondary-dark);
}

.search-result-symbol {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    color: var(--accent-gold);
    margin-right: 8px;
}

.search-result-name {
    color: var(--text-secondary);
    font-size: 14px;
}

.search-result-price {
    float: right;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--text-primary);
}

nav {
    display: flex;
    gap: 25px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    align-items: center;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    white-space: nowrap;
}

nav a:hover {
    color: var(--accent-gold);
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gold);
    transition: width 0.3s ease;
}

nav a:hover::after {
    width: 100%;
}

.login-btn {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold) !important;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background: var(--accent-gold);
    color: var(--primary-dark) !important;
}

.login-btn::after {
    display: none;
}

/* Market Overview Layout */
.market-overview {
    padding: 40px 60px;
    max-width: 1600px;
    margin: 0 auto;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-primary);
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--accent-gold);
}

.markets-layout {
    display: flex;
    gap: 20px;
    margin-top: 30px;
    transition: all 0.4s ease;
}

.market-widgets-container {
    flex: 1;
    transition: all 0.4s ease;
}

.market-widgets-container.compressed {
    flex: 0 0 300px;
}

.market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.market-widgets-container.compressed .market-grid {
    grid-template-columns: 1fr;
}

/* Smaller Market Widgets */
.market-widget {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.market-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    border-color: var(--accent-gold);
}

.market-widget.selected {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.widget-symbol {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-gold);
    margin-bottom: 4px;
}

.widget-name {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-price {
    font-size: 20px;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
    margin-bottom: 6px;
}

.widget-change {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
}

.widget-change.positive {
    color: var(--accent-green);
}

.widget-change.negative {
    color: var(--accent-red);
}

/* Detail Panel */
.market-detail-panel {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    position: relative;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.close-detail {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.3s ease;
}

.close-detail:hover {
    color: var(--accent-gold);
}

.detail-header {
    margin-bottom: 30px;
}

.detail-symbol {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-gold);
}

.detail-name {
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.detail-price-section {
    margin: 20px 0;
}

.detail-price {
    font-size: 48px;
    font-weight: 700;
    font-family: 'IBM Plex Mono', monospace;
    line-height: 1;
}

.detail-change {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 20px;
    margin-top: 8px;
}

.detail-change.positive {
    color: var(--accent-green);
}

.detail-change.negative {
    color: var(--accent-red);
}

/* Chart Container */
.chart-container {
    margin: 30px 0;
    height: 300px;
    position: relative;
}

/* Fundamentals Grid */
.fundamentals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.fundamental-item {
    background: var(--secondary-dark);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.fundamental-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.fundamental-value {
    font-size: 24px;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--text-primary);
}

/* Articles Section */
.articles-section {
    padding: 60px 60px;
    max-width: 1600px;
    margin: 0 auto;
}

.articles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.article-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.4);
    border-color: var(--accent-gold);
}

.article-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #1a1f3a 0%, #2a2f45 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-placeholder {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    color: var(--text-secondary);
}

.article-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-meta {
    display: flex;
    gap: 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.article-category {
    color: var(--accent-gold);
}

.article-title {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.article-excerpt {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 14px;
    flex: 1;
    margin-bottom: 16px;
}

.read-more {
    align-self: flex-start;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    text-decoration: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    border-radius: 6px;
    display: inline-block;
}

.read-more:hover {
    background: var(--accent-gold);
    color: var(--primary-dark);
}

/* Footer */
footer {
    background: var(--secondary-dark);
    border-top: 1px solid var(--border-color);
    padding: 50px 60px 30px;
    margin-top: 80px;
}

.footer-content {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3, .footer-section h4 {
    font-family: 'Playfair Display', serif;
    color: var(--accent-gold);
    margin-bottom: 16px;
}

.footer-section p {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 14px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 12px;
}

.footer-section ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 14px;
}

.footer-section ul li a:hover {
    color: var(--accent-gold);
}

.footer-bottom {
    max-width: 1600px;
    margin: 0 auto;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
}

/* Loading States */
.loading {
    animation: pulse 2s ease-in-out infinite;
}

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

/* Responsive */
@media (max-width: 1200px) {
    .header-content {
        flex-wrap: wrap;
        gap: 20px;
    }

    .search-container {
        order: 3;
        flex-basis: 100%;
        max-width: 100%;
    }

    .market-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .articles-container {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 968px) {
    header {
        padding: 20px 30px;
    }

    .logo {
        font-size: 28px;
    }

    nav {
        gap: 15px;
        font-size: 11px;
    }

    .market-overview,
    .articles-section {
        padding: 40px 30px;
    }

    .markets-layout {
        flex-direction: column;
    }

    .market-widgets-container.compressed {
        flex: 1;
    }

    .market-widgets-container.compressed .market-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .market-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .articles-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .ticker-item {
        margin: 0 15px;
        font-size: 11px;
    }

    .market-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 48px;
    max-width: 500px;
    width: 100%;
}

.auth-title {
    font-family: 'Playfair Display', serif;
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 32px;
    text-align: center;
    background: linear-gradient(135deg, var(--accent-gold) 0%, #f4e4a8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    background: var(--primary-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: 'Work Sans', sans-serif;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.form-textarea {
    min-height: 200px;
    resize: vertical;
}

.form-button {
    width: 100%;
    padding: 16px;
    background: var(--accent-gold);
    color: var(--primary-dark);
    border: none;
    border-radius: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-button:hover {
    background: #f4e4a8;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(212, 175, 55, 0.3);
}

.auth-link {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-link a {
    color: var(--accent-gold);
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

.error-message {
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.success-message {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Page Content */
.page-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 40px;
}

.page-content h1 {
    font-family: 'Playfair Display', serif;
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.page-content h2 {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    font-weight: 700;
    margin: 40px 0 20px;
    color: var(--accent-gold);
}

.page-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 20px;
}