:root {
    /* Light theme colors */
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --border-color: #e0e0e0;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --card-bg: #ffffff;
    --header-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="dark"] {
    /* Dark theme colors */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-tertiary: #999999;
    --border-color: #404040;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --card-bg: #2d2d2d;
    --header-bg: linear-gradient(135deg, #4a5568 0%, #553c7e 100%);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: var(--header-bg);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
    font-weight: 300;
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.api-status {
    font-size: 0.85em;
    opacity: 0.9;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
}

.last-updated {
    font-size: 0.9em;
    opacity: 0.9;
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.2s ease;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-left: 10px;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.index-card {
    display: flex;
    justify-content: center;
}

.nifty-card {
    min-width: 400px;
    max-width: 500px;
    text-align: center;
}

.card {
    background: var(--card-bg);
    padding: 40px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-light);
    border-left: 5px solid #007bff;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.card h3 {
    color: var(--text-secondary);
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.card .value {
    font-size: 3em;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.card .change {
    font-size: 1.2em;
    font-weight: 500;
}

.change.positive {
    color: #28a745;
}

.change.negative {
    color: #dc3545;
}

.summary-section {
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-light);
    text-align: center;
    transition: background-color 0.3s ease;
}

.stat-card h4 {
    margin: 0 0 10px 0;
    color: var(--text-secondary);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-value.positive {
    color: #28a745;
}

.stat-value.negative {
    color: #dc3545;
}

.stat-value.buy-signal {
    color: #ff6b00;
    animation: pulse-orange 2s infinite;
}

@keyframes pulse-orange {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.buy-banner {
    background: linear-gradient(45deg, #ff4444, #ff6666);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(255, 68, 68, 0.3);
    animation: banner-pulse 3s infinite;
    border: 2px solid #ff0000;
}

@keyframes banner-pulse {
    0%, 100% { 
        box-shadow: 0 4px 20px rgba(255, 68, 68, 0.3);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 6px 30px rgba(255, 68, 68, 0.5);
        transform: scale(1.02);
    }
}

.banner-content {
    text-align: center;
}

.banner-main {
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.banner-details {
    font-size: 1.1em;
    margin-bottom: 8px;
    opacity: 0.95;
}

.banner-stats {
    font-size: 0.9em;
    opacity: 0.9;
    font-family: monospace;
}

.charts-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-light);
    transition: background-color 0.3s ease;
}

.chart-container {
    height: 400px;
    position: relative;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header {
        padding: 25px 20px;
    }

    header h1 {
        font-size: 2em;
    }

    .nifty-card {
        min-width: 100%;
    }

    .card {
        padding: 30px 20px;
    }

    .card .value {
        font-size: 2.5em;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .buy-banner {
        padding: 15px;
    }

    .banner-main {
        font-size: 1.4em;
    }

    .banner-details {
        font-size: 1em;
    }

    .charts-section {
        padding: 20px;
    }

    .chart-container {
        height: 300px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .card .value {
        font-size: 2em;
    }

    .card .change {
        font-size: 1em;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading Animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}
