/* PCRmobile.css - Mobile optimization for the Nifty 50 Options Chain Analyzer */

@media screen and (max-width: 992px) {
    /* Container adjustments */
    .container {
        padding: 10px;
    }
    
    /* Header adjustments */
    header h1 {
        font-size: 1.5rem;
    }
    
    /* Filter panel adjustments */
    .filter-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-item {
        width: 100%;
    }
    
    .status-info {
        margin-left: 0;
        text-align: left;
        margin-top: 10px;
        width: 100%;
        display: flex;
        justify-content: space-between;
    }
    
    /* Dashboard layout adjustments */
    .dashboard-layout {
        flex-direction: column;
    }
    
    .options-chain-section, .intraday-section {
        width: 100%;
    }
    
    /* Options chain tables */
    .options-tables {
        flex-direction: column;
        gap: 20px;
    }
    
    .ce-table, .pe-table {
        width: 100%;
    }
    
    /* Tables adjustments */
    .table-container {
        max-height: 300px;
        width: 100%;
        overflow-x: auto;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 6px 8px;
    }
    
    /* Support & Resistance section */
    .levels-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .level-item {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }
    
    /* Market sentiment section */
    .sentiment-container {
        flex-direction: column;
    }
    
    .sentiment-gauge, .sentiment-conclusion {
        width: 100%;
    }
    
    /* Visualization section */
    .visualization-tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
    }
    
    .tab-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .chart-container {
        height: 250px;
    }
    
    /* PCR Stats adjustments */
    .pcr-stats {
        flex-wrap: wrap;
    }
    
    .stat-item {
        min-width: 45%;
    }
}

@media screen and (max-width: 576px) {
    /* Further adjustments for very small screens */
    header h1 {
        font-size: 1.2rem;
    }
    
    h2 {
        font-size: 1.1rem;
    }
    
    h3 {
        font-size: 1rem;
    }
    
    /* Make tables even more compact */
    table {
        font-size: 0.7rem;
    }
    
    th, td {
        padding: 4px 6px;
    }
    
    /* Adjust number formatting for smaller screens */
    td:not(:first-child) {
        font-size: 0.7rem;
    }
    
    /* Theme toggle position */
    .theme-toggle {
        top: 10px;
        right: 10px;
    }
    
    #themeToggle {
        width: 32px;
        height: 32px;
    }
    
    /* Intraday table optimizations */
    #intradayTable {
        table-layout: fixed;
    }
    
    #intradayTable th, #intradayTable td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Make certain columns fixed width */
    #intradayTable th:nth-child(1), #intradayTable td:nth-child(1) { /* Time */
        width: 50px;
    }
    
    #intradayTable th:nth-child(2), #intradayTable td:nth-child(2), /* Index */
    #intradayTable th:nth-child(3), #intradayTable td:nth-child(3), /* Future */
    #intradayTable th:nth-child(4), #intradayTable td:nth-child(4) /* VWAP */ {
        width: 60px;
    }
    
    #intradayTable th:nth-child(5), #intradayTable td:nth-child(5), /* CE OI */
    #intradayTable th:nth-child(6), #intradayTable td:nth-child(6) /* PE OI */ {
        width: 70px;
    }
    
    #intradayTable th:nth-child(7), #intradayTable td:nth-child(7), /* CE OI % */
    #intradayTable th:nth-child(8), #intradayTable td:nth-child(8) /* PE OI % */ {
        width: 55px;
    }
    
    #intradayTable th:nth-child(9), #intradayTable td:nth-child(9), /* CE COI */
    #intradayTable th:nth-child(10), #intradayTable td:nth-child(10) /* PE COI */ {
        width: 70px;
    }
    
    #intradayTable th:nth-child(11), #intradayTable td:nth-child(11), /* PCR OI */
    #intradayTable th:nth-child(12), #intradayTable td:nth-child(12) /* PCR COI */ {
        width: 55px;
    }
    
    #intradayTable th:nth-child(13), #intradayTable td:nth-child(13), /* PCR Conclusion */
    #intradayTable th:nth-child(14), #intradayTable td:nth-child(14) /* VWAP Conclusion */ {
        width: 80px;
    }
    
    /* Collapsible sections for mobile */
    .mobile-collapsible {
        position: relative;
    }
    
    .collapsible-header {
        padding: 10px;
        background-color: var(--bg-secondary);
        border-radius: 6px;
        margin-bottom: 10px;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .collapsible-header::after {
        content: '▼';
        font-size: 0.8rem;
        color: var(--text-secondary);
    }
    
    .collapsible-header.collapsed::after {
        content: '▶';
    }
    
    .collapsible-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .collapsible-content.expanded {
        max-height: 2000px; /* Arbitrary large value */
    }
}

/* Additional utility classes for mobile */
.hide-on-mobile {
    display: block;
}

.show-on-mobile {
    display: none;
}

@media screen and (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }
    
    .show-on-mobile {
        display: block !important;
    }
    
    /* Mobile navigation */
    .mobile-nav {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        background-color: var(--bg-secondary);
        padding: 8px 0;
        margin-bottom: 15px;
        border-radius: 6px;
    }
    
    .mobile-nav-item {
        padding: 6px 12px;
        margin: 0 5px;
        background-color: var(--bg-primary);
        border-radius: 4px;
        font-size: 0.8rem;
        color: var(--text-secondary);
        cursor: pointer;
    }
    
    .mobile-nav-item.active {
        background-color: var(--accent);
        color: white;
    }
    
    /* Mobile-optimized tables */
    .mobile-table {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .mobile-table-row {
        display: flex;
        flex-wrap: wrap;
        padding: 8px;
        border-bottom: 1px solid var(--border);
        background-color: var(--bg-secondary);
        margin-bottom: 5px;
        border-radius: 4px;
    }
    
    .mobile-table-cell {
        flex: 1 0 calc(50% - 10px);
        margin: 2px 5px;
    }
    
    .mobile-table-header {
        font-size: 0.7rem;
        color: var(--text-secondary);
        margin-bottom: 2px;
    }
    
    .mobile-table-value {
        font-family: 'Roboto Mono', monospace;
        font-size: 0.9rem;
    }
    
    /* Mobile-optimized charts */
    .mobile-chart-container {
        height: 200px;
        margin-bottom: 20px;
    }
    
    /* Mini cards for key stats on mobile */
    .mini-card-container {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .mini-card {
        flex: 1 0 calc(50% - 8px);
        background-color: var(--bg-secondary);
        padding: 10px;
        border-radius: 6px;
        display: flex;
        flex-direction: column;
    }
    
    .mini-card-title {
        font-size: 0.7rem;
        color: var(--text-secondary);
        margin-bottom: 5px;
    }
    
    .mini-card-value {
        font-family: 'Roboto Mono', monospace;
        font-size: 1rem;
        font-weight: 500;
    }
    
    .mini-card.positive .mini-card-value {
        color: var(--positive);
    }
    
    .mini-card.negative .mini-card-value {
        color: var(--negative);
    }
}