/* PCRstyles.css */
:root {
    /* Light mode variables */
    --bg-primary-light: #f5f7fa;
    --bg-secondary-light: #ffffff;
    --text-primary-light: #333333;
    --text-secondary-light: #666666;
    --border-light: #dbe1e8;
    --accent-light: #3182ce;
    --positive-light: #38a169;
    --negative-light: #e53e3e;
    --positive-bg-light: rgba(56, 161, 105, 0.1);
    --negative-bg-light: rgba(229, 62, 62, 0.1);
    --neutral-bg-light: #f0f4f8;
    --hover-light: #edf2f7;
    
    /* Dark mode variables */
    --bg-primary-dark: #1a202c;
    --bg-secondary-dark: #2d3748;
    --text-primary-dark: #f7fafc;
    --text-secondary-dark: #cbd5e0;
    --border-dark: #4a5568;
    --accent-dark: #63b3ed;
    --positive-dark: #68d391;
    --negative-dark: #fc8181;
    --positive-bg-dark: rgba(104, 211, 145, 0.1);
    --negative-bg-dark: rgba(252, 129, 129, 0.1);
    --neutral-bg-dark: #2d3748;
    --hover-dark: #4a5568;
    
    /* Default theme (dark) */
    --bg-primary: var(--bg-primary-dark);
    --bg-secondary: var(--bg-secondary-dark);
    --text-primary: var(--text-primary-dark);
    --text-secondary: var(--text-secondary-dark);
    --border: var(--border-dark);
    --accent: var(--accent-dark);
    --positive: var(--positive-dark);
    --negative: var(--negative-dark);
    --positive-bg: var(--positive-bg-dark);
    --negative-bg: var(--negative-bg-dark);
    --neutral-bg: var(--neutral-bg-dark);
    --hover: var(--hover-dark);
}

/* General Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    margin-bottom: 20px;
    text-align: center;
}

h1, h2, h3 {
    font-weight: 500;
    margin-bottom: 15px;
}

h1 {
    font-size: 2rem;
    color: var(--accent);
}

h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin-top: 20px;
}

h3 {
    font-size: 1.2rem;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

#themeToggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#themeToggle:hover {
    background: var(--hover);
}

/* Filter Panel */
.filter-panel {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-item {
    flex: 1;
    min-width: 150px;
}

.filter-item label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.filter-item select,
.filter-item input {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Roboto', sans-serif;
}

.go-btn {
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.go-btn:hover {
    opacity: 0.9;
}

.status-info {
    margin-left: auto;
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.options-chain-section {
    flex: 1;
    min-width: 300px;
}

.intraday-section {
    flex: 2;
    min-width: 600px;
}

/* PCR Stats */
.pcr-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    background-color: var(--bg-secondary);
    padding: 10px;
    border-radius: 6px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Tables */
.options-tables {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.ce-table, .pe-table {
    flex: 1;
    background-color: var(--bg-secondary);
    border-radius: 6px;
    overflow: hidden;
}

.table-container {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: var(--neutral-bg);
    position: sticky;
    top: 0;
    z-index: 10;
    font-weight: 500;
}

th:first-child, td:first-child {
    text-align: left;
}

tbody tr:hover {
    background-color: var(--hover);
}

/* Numeric values */
td:not(:first-child) {
    font-family: 'Roboto Mono', monospace;
}

/* Conditional styling for table cells */
.positive {
    color: var(--positive);
    background-color: var(--positive-bg);
}

.negative {
    color: var(--negative);
    background-color: var(--negative-bg);
}

.bullish {
    background-color: var(--positive-bg);
}

.bearish {
    background-color: var(--negative-bg);
}

tfoot td {
    font-weight: 700;
    background-color: var(--neutral-bg);
}

/* Support & Resistance */
.support-resistance {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.levels-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.level-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 15px;
    border-radius: 4px;
    min-width: 150px;
}

.level-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.level-value {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    font-size: 1.1rem;
}

.resistance {
    background-color: var(--negative-bg);
}

.resistance .level-value {
    color: var(--negative);
}

.support {
    background-color: var(--positive-bg);
}

.support .level-value {
    color: var(--positive);
}

.current {
    background-color: var(--neutral-bg);
    border: 1px dashed var(--border);
}

/* Market Sentiment */
.market-sentiment {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 15px;
}

.sentiment-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.sentiment-gauge {
    flex: 1;
    min-width: 300px;
}

.sentiment-conclusion {
    flex: 2;
    min-width: 300px;
}

.gauge-title {
    text-align: center;
    margin-bottom: 10px;
    font-weight: 500;
}

.gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gauge {
    width: 100%;
    height: 20px;
    background: linear-gradient(to right, var(--negative), #f6e05e, var(--positive));
    border-radius: 10px;
    margin-bottom: 5px;
    position: relative;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    width: 3px;
    background-color: var(--text-primary);
    position: absolute;
    top: 0;
    transition: left 0.5s ease;
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Light Mode */
body.light-theme {
    --bg-primary: var(--bg-primary-light);
    --bg-secondary: var(--bg-secondary-light);
    --text-primary: var(--text-primary-light);
    --text-secondary: var(--text-secondary-light);
    --border: var(--border-light);
    --accent: var(--accent-light);
    --positive: var(--positive-light);
    --negative: var(--negative-light);
    --positive-bg: var(--positive-bg-light);
    --negative-bg: var(--negative-bg-light);
    --neutral-bg: var(--neutral-bg-light);
    --hover: var(--hover-light);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dashboard-layout {
        flex-direction: column;
    }
    
    .intraday-section, .options-chain-section {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-item {
        width: 100%;
    }
    
    .status-info {
        margin-left: 0;
        text-align: left;
        margin-top: 10px;
    }
    
    .options-tables {
        flex-direction: column;
    }
    
    .ce-table, .pe-table {
        width: 100%;
    }
    
    .levels-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .level-item {
        width: 100%;
    }
}

/* Animation for updating data */
@keyframes highlight {
    0% {
        background-color: var(--accent);
        color: white;
    }
    100% {
        background-color: transparent;
        color: var(--text-primary);
    }
}

.highlight {
    animation: highlight 1s ease;
}