/* Global Styles */

/* Importing Google Fonts - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* Ensure Material Symbols Rounded is imported */
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

:root {
    /* Light theme colors */
    --color-text-primary: #1F2936;
    --color-text-placeholder: #969696;
    --color-bg-primary: #f9fafb;
    --color-bg-secondary: #ECECFD;
    --color-bg-sidebar: #FFFFFF;
    --color-border-hr: #E2E8F0;
    --color-hover-primary: #695CFE;
    --color-hover-secondary: #e2e2fb;
    --color-shadow: rgba(0, 0, 0, 0.05);
    --nav-height: 50px; /* Matches .site-nav height */
    --disclaimer-height: 20px; /* Matches .disclaimer height */
    --sidebar-width: 400px;
}

body.dark-theme {
    /* Dark theme colors */
    --color-text-primary: #F1F5F9;
    --color-text-placeholder: #A6B7D2;
    --color-bg-primary: #111827;
    --color-bg-secondary: #3D4859;
    --color-bg-sidebar: #1f2937;
    --color-border-hr: #3B475C;
    --color-hover-secondary: #48566a;
    --color-shadow: rgba(0, 0, 0, 0.3);
}

body {
    min-height: 100vh;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}
/*Sidebar Properties*/
.sidebar {
    position: sticky;
    top: 0;
    left: 0;
    width: 800px;
    height: 100vh;
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    background: var(--color-bg-sidebar);
    border-right: 1px solid var(--color-border-hr);
    box-shadow: 0 3px 9px var(--color-shadow);
    transition: width 0.4s ease, left 0.4s ease;
    z-index: 40;
}

.sidebar.collapsed {
    width: 150px;
}

.sidebar .sidebar-header {
    padding: 20px 18px;
    display: flex;
    position: relative;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border-hr);
}

.sidebar-header .header-logo {
    width: 400px; 
    height: 400px; 
    display: block;
    object-fit: contain;
    border-radius: 50%;
    transition: opacity 0.4s ease;
}

.sidebar.collapsed .header-logo {
    opacity: 0;
    pointer-events: none;
}

.site-nav .sidebar-toggle,
.sidebar-header .sidebar-toggle {
    height: 40px;
    width: 40px;
    border: none;
    cursor: pointer;
    display: flex;
    position: absolute;
    right: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
    transition: 0.4s ease;
}

.site-nav .sidebar-toggle:hover,
.sidebar-header .sidebar-toggle:hover {
    background: var(--color-hover-secondary);
}

.sidebar.collapsed .sidebar-header .sidebar-toggle {
    transform: translateX(-1px);
    height: 60px;
    width: 70px;
}

/* Closing and opening bar */
.sidebar-header .sidebar-toggle span {
    font-size: 6rem; /* Increased from 10rem */
    transition: transform 0.4s ease;
}

.sidebar.collapsed .sidebar-toggle span {
    transform: rotate(180deg);
}

.sidebar .sidebar-content {
    flex: 1;
    padding: 20px 18px;
    overflow: hidden auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-text-placeholder) transparent;
}

.sidebar.collapsed .sidebar-content {
    scrollbar-width: none;
}


.sidebar.collapsed .search-form:hover {
    cursor: pointer;
}

.sidebar-content .search-form:focus-within,
.sidebar.collapsed .search-form:hover {
    background: var(--color-hover-secondary);
}

.sidebar-content .search-form span {
    color: var(--color-text-placeholder);
}

.sidebar-content .menu-list {
    display: flex;
    gap: 50px;
    list-style: none;
    flex-direction: column;
}

.menu-list .menu-link {
    display: flex;
    gap: 12px;
    white-space: nowrap;
    border-radius: 8px;
    padding: 12px 15px;
    align-items: center;
    text-decoration: none;
    color: var(--color-text-primary);
    font-size: 4rem; /* Increased from 3rem */
    transition: 0.3s ease;
}

.menu-list .menu-link .material-symbols-rounded {
    font-size: 6rem; /* Set size for currency_rupee_circle and other menu icons */
}

.menu-link .menu-label {
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .menu-link .menu-label {
    opacity: 0;
    pointer-events: none;
}

.menu-list .menu-link:is(:hover, .active) {
    color: #fff;
    background: var(--color-hover-primary);
}

.sidebar .sidebar-footer {
    padding: 20px 18px;
    white-space: nowrap;
    border-top: 5px solid var(--color-border-hr);
    margin-bottom: 150px;

  }

.sidebar-footer .theme-toggle {
    width: 100%;
    min-height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border: none;
    padding: 0 15px;
    white-space: nowrap;
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
    transition: 0.3s ease;
    }

.sidebar-footer .theme-toggle:hover {
    background: var(--color-hover-secondary);
}

.theme-toggle .theme-label {
    display: flex;
    gap: 10px;
    align-items: center;
}

.theme-toggle .theme-label .theme-text {
    font-size: 3rem; /* Increased from 1.5rem */
    transition: opacity 0.4s 0.2s ease;
}

.sidebar.collapsed .theme-toggle :where(.theme-text, .theme-toggle-track) {
    opacity: 0;
    width: 0;
    transition: all 0.2s ease;
}

.theme-toggle .theme-toggle-track {
    height: 24px;
    width: 56px;
    border-radius: 999px;
    margin-left: auto;
    background: #c3d1ec;
    position: relative;
    transition: opacity 0.4s 0.2s ease, background-color 0.3s ease;
}

body.dark-theme .theme-toggle-track {
    background: #695CFE;
}

.theme-toggle-track .theme-toggle-indicator {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 36px;
    height: 18px;
    border-radius: 50%;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

body.dark-theme .theme-toggle-indicator {
    transform: translateX(24px);
}

.site-nav {
    top: 0;
    display: none;
    padding: 15px 20px;
    position: sticky;
    background: var(--color-bg-primary);
    border-bottom: 1px solid var(--color-border-hr);
}

.site-nav .sidebar-toggle {
    position: unset;
}

.container {  /* do not delete*/
    display: flex;

}

/* Responsive media query code for small screens */
@media (max-width: 768px) {
    .sidebar {
        width: 300px;
    }

    .sidebar.open {
        width: 300px;
    }

    .sidebar.collapsed {
        width: 90px;
    }

    .sidebar.collapsed + main {
        margin-left: 90px;
    }

}
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    font-family: Arial, sans-serif;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

/* Make the table header sticky */
#chainTable thead,
#chainTable th {
    position: sticky;
    top: 115px; /* Changed from var(--header-offset, 0px) to fix header at 10px */
    z-index: 20; /* Ensure header stays above table content */
    padding: 8px; /* Add padding for readability */
}

/* Option Chain Table */
#chainTable {
    width: calc(100vw - var(--sidebar-width, 800px)); /* Added to ensure full width minus sidebar */
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    font-size: 24px;
    margin: 110px 0 10px;
    table-layout: auto;
    max-height: calc(100vh - var(--header-offset, 0px) - 60px - var(--nav-height, 50px)); /* Account for nav and margins */
    overflow-y: scroll; /* Changed to enable vertical scrolling */
    top: 115px; /* Added to align table 10px from top */
    right: 0; /* Stretch to right edge */
    left: var(--sidebar-width, 800px); /* Changed from 0 to start after default sidebar */
}


/* Adjust table position and width when sidebar is collapsed */
.sidebar.collapsed ~ main #chainTable {
    left: 150px; /* Changed to start after collapsed sidebar (150px) */
    width: calc(100vw - 150px); /* Changed to match collapsed sidebar width */
}

:root {
    --sidebar-width: 800px; /* Updated from 400px to match .sidebar width */
}


#chainTable th {/*table Header*/
    padding: 5px;
    border: 1px solid var(--color-border-hr);
    text-align: center;
    font-size: 70px;
    white-space: pre-line;
    color: var(--color-text-primary);
}
#chainTable td {  /*table data*/
    padding: 10px;
    border: 2px solid var(--color-border-hr);
    text-align: center;
    font-size: 50px;
    white-space: pre-line;
    color: var(--color-text-primary);
}

.call-column {
    background-color: red;
    color: #fff;
}

.put-column {
    background-color: #60a560;
    color: #fff;
}

th:nth-child(8) {  /*8th column cell*/
    background-color: #5993b1;
    color: #fff;
}

td:nth-child(8) { /* complete column 8 background color*/
    background-color: #5f7072;
    color: #fff;
}

.negative {
    color: red;
}

.total-row {
    font-weight: bold;
    background-color: #b91f34;
    color: #fff;
}

.spot-row {
    font-weight: bold;
    text-align: center;
    background-color: #b91f34;
    color: #fff;
}

.spot-row td:nth-child(8) {
    background-color: #b3b3b3;
    color: #fff;
    cursor: pointer;
}

.shift-row {
    font-weight: bold;
    text-align: center;
    background-color: var(--color-bg-secondary);
}

.shift-row .shift-up {
    color: rgb(126, 226, 126);
}

.shift-row .shift-down {
    color: red;
}

.pcr-row {
    text-align: center;
    font-weight: bold;
    background-color: var(--color-bg-secondary);
}

.highest-value-call {
    background-color: #FF0000;
    color: #fff;
    white-space: pre-line;
}

.highest-value-put {
    background-color: #60a560;
    color: #fff;
    white-space: pre-line;
}

.second-highest {
    background-color: #caca09;
    color: #000;
    white-space: pre-line;
}

.third-highest {
    background-color: #7a7a76;
    color: #000;
    white-space: pre-line;
}

/* Ensure OI, OI Chg, and Volume columns are readable */
td:nth-child(3),/* Call OI Chg */
td:nth-child(4),/*  OI */
td:nth-child(5),/* Volume */
td:nth-child(11),/* Put OI Chg */
td:nth-child(12),/*  OI */
td:nth-child(13) { /* Volume */
    min-width: 100px;
    line-height: 1.5;
}

/* Charts */
#oiChart {
    width: 100%;
    max-width: 90vw;
    height: 40vh;
    margin: 10px auto;
    display: block;
}

.popup-chart {
    width: 100%;
    max-width: 80vw;
    height: 20vh;
    margin: 10px 0;
}

/* Popups and Modals */
/* Elastic Limit Popup */
.inline-popup {
    position: absolute;
    z-index: 10;
    background: #080808;
    border: 15px solid #ccc;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 1000px;
    padding: 25px;
}

.popup-content {
    max-width: 100%;
}

.popup-content h3 {
    margin: 0 0 15px;
    font-size: 2em;
}

.popup-content p {
    margin: 9px 0;
    font-size: 1.5em;
    font-weight: 400;
}

.popup-content button {
    display: block;
    margin: 15px auto 0;
    padding: 10px 25px;
    background: #337ab7;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 2em;
}

.popup-content button:hover {
    background: linear-gradient(45deg, #00b4d8, #0096c7);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Utility Classes */
.divider {
    border-top: 1px solid var(--color-border-hr);
    margin: 5px 0;
}

.resistance {
    color: #d32f2f;
    font-weight: 600;
}

.support {
    color: #2e7d32;
    font-weight: 600;
}

.rate-limit-message,
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 5px;
    margin: 5px 0;
    font-size: 12px;
    text-align: center;
}

/* Disclaimer */
.disclaimer {
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
    text-align: center;
    z-index: 1200;
    font-size: 50px;
    box-sizing: border-box;
    right: 0;
}

.disclaimer-text {
    display: inline-block;
    animation: marquee 60s linear infinite;
}

/* Animations-- Moving disclaimer slowly left to right */
@keyframes marquee {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    
    .sidebar.collapsed { /* collapsing Side Bar*/
        width: 120px;
    }

    #oiChart {
        height: 30vh;
    }
}

/* Dropdown Container */
.dropdown-container {
    top: 10px; /* Position above the table, below any navigation */
    gap: 20px; /* Space between dropdowns */
    align-items: center; /* Align dropdowns vertically */
    padding: 10px; /* Add padding for better appearance */
    border-radius: 8px; /* Consistent with other UI elements */
    box-shadow: 0 2px 6px var(--color-shadow); /* Subtle shadow */
   }

.dropdown-container select {
    padding: 8px;
    font-size: 4rem; /* Match other UI text sizes */
    background: var(--color-bg-primary); /* Match primary background */
    color: var(--color-text-primary); /* Match text color */
    border: 1px solid var(--color-border-hr); /* Match border style */
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

.dropdown-container select:hover {
    background: var(--color-hover-secondary); /* Hover effect */
}

.dropdown-container select:focus {
    outline: none;
    border-color: var(--color-hover-primary); /* Highlight on focus */
}

.expiry-display {
    font-size: 4rem; /* Matches the dropdown select font size */
    white-space: nowrap; /* Prevent text wrapping to ensure full date visibility */
    min-width: 500px; /* Ensure enough space for typical date format (e.g., YYYY-MM-DD) */
}

