/* ===========================
   Markets Page Styles
   =========================== */

:root {
    --primary-color: #0aa026;
    --primary-dark: #088a1f;
    --secondary-color: #0ba026;
    --dark-bg: #0a192f;
    --card-bg: #0f2a48;
    --text-light: #e0e0e0;
    --text-muted: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.1);
}

body.light {
    --primary-color: #0aa026;
    --dark-bg: #f5f7fa;
    --card-bg: #ffffff;
    --text-light: #1f2937;
    --text-muted: #6b7280;
    --border-color: rgba(0, 0, 0, 0.1);
}

/* ===========================
   Markets Section
   =========================== */

.markets-section {
    padding: 100px 0;
    background: linear-gradient(135deg, var(--dark-bg) 0%, #0c2642 100%);
    min-height: 100vh;
}

body.light .markets-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
}

/* ===========================
   Hero Section
   =========================== */

.markets-hero {
    text-align: center;
    margin-bottom: 80px;
    animation: fadeInDown 0.8s ease;
}

.markets-hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-light);
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.markets-hero p {
    font-size: 1.3rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    font-weight: 400;
}

@media (max-width: 768px) {
    .markets-hero h1 {
        font-size: 2.2rem;
    }
    
    .markets-hero p {
        font-size: 1.1rem;
    }
}

/* ===========================
   Markets Grid
   =========================== */

.markets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 30px;
    margin-bottom: 80px;
}

/* ===========================
   Market Cards
   =========================== */

.market-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease forwards;
    animation-fill-mode: both;
}

.market-card:nth-child(1) { animation-delay: 0.1s; }
.market-card:nth-child(2) { animation-delay: 0.2s; }
.market-card:nth-child(3) { animation-delay: 0.3s; }
.market-card:nth-child(4) { animation-delay: 0.4s; }
.market-card:nth-child(5) { animation-delay: 0.5s; }
.market-card:nth-child(6) { animation-delay: 0.6s; }

.market-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(10, 160, 38, 0.1), transparent);
    transition: left 0.5s ease;
}

.market-card:hover::before {
    left: 100%;
}

.market-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(10, 160, 38, 0.2);
}

body.light .market-card:hover {
    box-shadow: 0 20px 40px rgba(10, 160, 38, 0.1);
}

/* Market Icon */
.market-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.market-card:hover .market-icon {
    transform: scale(1.15) rotate(5deg);
}

/* Market Title */
.market-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 15px;
    transition: color 0.3s ease;
}

.market-card:hover h3 {
    color: var(--primary-color);
}

/* Market Description */
.market-description {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Market Details */
.market-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.detail-item .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Market Features */
.market-features {
    list-style: none;
    margin: 0;
    padding: 0;
}

.market-features li {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.market-features li:hover {
    color: var(--text-light);
    transform: translateX(5px);
}

.market-features i {
    color: var(--primary-color);
    font-weight: 700;
    min-width: 16px;
}

/* ===========================
   Comparison Section
   =========================== */

.comparison-section {
    margin-bottom: 80px;
}

.comparison-section h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 50px;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
}

.markets-table {
    width: 100%;
    border-collapse: collapse;
}

.markets-table thead {
    background: rgba(10, 160, 38, 0.15);
}

.markets-table th {
    padding: 20px;
    text-align: left;
    font-weight: 700;
    color: var(--text-light);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.markets-table td {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.95rem;
}

.markets-table tbody tr {
    transition: background-color 0.3s ease;
}

.markets-table tbody tr:hover {
    background-color: rgba(10, 160, 38, 0.1);
}

.markets-table strong {
    color: var(--text-light);
    font-weight: 700;
}

@media (max-width: 768px) {
    .comparison-section h2 {
        font-size: 1.8rem;
    }
    
    .markets-table th,
    .markets-table td {
        padding: 12px;
        font-size: 0.85rem;
    }
}

/* ===========================
   Trading Tools Section
   =========================== */

.trading-tools-section {
    margin-bottom: 80px;
}

.trading-tools-section h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 50px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 35px;
    text-align: center;
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease forwards;
    animation-fill-mode: both;
}

.tool-card:nth-child(1) { animation-delay: 0.1s; }
.tool-card:nth-child(2) { animation-delay: 0.2s; }
.tool-card:nth-child(3) { animation-delay: 0.3s; }
.tool-card:nth-child(4) { animation-delay: 0.4s; }
.tool-card:nth-child(5) { animation-delay: 0.5s; }
.tool-card:nth-child(6) { animation-delay: 0.6s; }

.tool-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(10, 160, 38, 0.15);
}

.tool-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.tool-card:hover .tool-icon {
    transform: scale(1.2);
}

.tool-card h4 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 12px;
}

.tool-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===========================
   CTA Section
   =========================== */

.markets-cta {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, rgba(10, 160, 38, 0.15) 0%, rgba(10, 160, 38, 0.05) 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    animation: fadeInUp 0.8s ease;
}

.markets-cta h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-light);
    margin-bottom: 20px;
}

.markets-cta p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.markets-cta .btn-lg {
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.markets-cta .btn-lg:hover {
    transform: scale(1.05);
}

/* ===========================
   Animations
   =========================== */

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 768px) {
    .markets-section {
        padding: 60px 0;
    }
    
    .markets-hero {
        margin-bottom: 50px;
    }
    
    .markets-grid {
        gap: 20px;
        margin-bottom: 50px;
    }
    
    .market-card {
        padding: 30px;
    }
    
    .market-details {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin-bottom: 20px;
        padding-bottom: 20px;
    }
    
    .detail-item .label {
        font-size: 0.75rem;
    }
    
    .detail-item .value {
        font-size: 1rem;
    }
    
    .comparison-section,
    .trading-tools-section {
        margin-bottom: 50px;
    }
    
    .trading-tools-section h2 {
        font-size: 2rem;
    }
    
    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
    
    .tool-card {
        padding: 25px;
    }
    
    .tool-icon {
        font-size: 2rem;
    }
    
    .markets-cta {
        padding: 40px 25px;
    }
    
    .markets-cta h2 {
        font-size: 1.8rem;
    }
    
    .markets-cta p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .markets-section {
        padding: 40px 0;
    }
    
    .markets-hero h1 {
        font-size: 1.8rem;
    }
    
    .markets-hero p {
        font-size: 1rem;
    }
    
    .market-card {
        padding: 25px;
    }
    
    .market-card h3 {
        font-size: 1.3rem;
    }
    
    .market-description {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }
    
    .market-features li {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    
    .comparison-section h2 {
        font-size: 1.5rem;
        margin-bottom: 30px;
    }
    
    .trading-tools-section h2 {
        font-size: 1.5rem;
        margin-bottom: 30px;
    }
    
    .tool-card {
        padding: 20px;
    }
    
    .tool-card h4 {
        font-size: 1rem;
    }
    
    .tool-card p {
        font-size: 0.9rem;
    }
    
    .markets-cta {
        padding: 30px 15px;
    }
    
    .markets-cta h2 {
        font-size: 1.5rem;
    }
    
    .markets-cta p {
        font-size: 0.95rem;
    }
}

/* ===========================
   Live Data Indicators
   =========================== */

.market-loader {
    text-align: center;
    padding: 30px;
    background: rgba(10, 160, 38, 0.1);
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    animation: fadeInDown 0.5s ease;
}

.market-loader p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin: 0;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(10, 160, 38, 0.3);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.market-data-timestamp {
    text-align: center;
    padding: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
    animation: fadeInDown 0.5s ease;
}

.market-data-timestamp small {
    background: rgba(10, 160, 38, 0.1);
    padding: 5px 15px;
    border-radius: 20px;
    display: inline-block;
    color: var(--primary-color);
}

.market-data-error {
    padding: 15px 20px;
    background: rgba(255, 68, 68, 0.15);
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 8px;
    margin-bottom: 30px;
    color: #ff8888;
    font-size: 0.95rem;
    animation: fadeInDown 0.5s ease;
}

.market-data-error p {
    margin: 0;
}

.price-ticker {
    display: inline-block;
    background: rgba(10, 160, 38, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-left: 10px;
    white-space: nowrap;
}

.price-change.positive {
    color: #0aa026;
}

.price-change.negative {
    color: #ff4444;
}

/* ===========================
   Live Data Badge
   =========================== */

.live-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}
