﻿/* General styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f8f9fa; /* Light Grey background */
    color: #343a40; /* Dark Grey text */
    min-height: 100vh;
}

/* Main container with improved centering for all devices */
.main-container {
    width: 100%;
    max-width: 1200px; /* Maximum width for larger screens */
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

h1 {
    margin-top: 20px;
    color: #6f42c1; /* Purple */
    text-align: center;
}

h2 {
    color: #6f42c1; /* Purple */
    text-align: center;
    margin: 20px 0;
}

form {
    margin-bottom: 20px;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.section {
    margin-bottom: 20px;
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* Responsive adjustments for better centering */
@media (min-width: 768px) {
    .main-container {
        padding: 30px 40px;
    }
}

@media (min-width: 1024px) {
    .main-container {
        padding: 40px 60px;
    }
    
    .section {
        width: 100%;
        max-width: 900px;
    }
    
    #chessPromotion {
        width: 100%;
        max-width: 900px;
    }
    
    .date-picker, .ticker-search {
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
    }
    
    form {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
}

.section button {
    margin-bottom: 10px;
    display: block;
    width: 100%;
    background-color: #6f42c1; /* Purple */
    color: #ffffff; /* White text */
    border: none;
    padding: 10px;
    cursor: pointer;
    cursor: pointer;
}

.section button:hover {
    background-color: #ffc107; /* Yellow on hover */
}

.scrollable {
    overflow-x: auto;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    position: relative;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
}

th, td {
    border: 1px solid #343a40; /* Dark Grey borders */
    padding: 8px;
    text-align: left;
}

/* Sticky/Frozen table headers - default behavior for all tables */
th {
    background-color: #6f42c1; /* Purple */
    color: #ffffff; /* White text */
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.4);
}

/* Ensure sticky headers work properly across all browsers */
.scrollable thead th {
    position: sticky;
    top: 0;
    background-color: #6f42c1;
    color: #ffffff;
    z-index: 10;
}

/* Additional mobile support for sticky headers */
@media (max-width: 768px) {
    th {
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    /* Table 1 mobile optimization - allow horizontal scroll with better readability */
    .table1-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table1-mobile {
        min-width: 100%;
        font-size: 12px;
    }
    
    .table1-mobile th,
    .table1-mobile td {
        padding: 6px 4px;
        font-size: 12px;
        white-space: nowrap;
        min-width: 80px;
    }
    
    /* Smaller screens - still readable */
    @media (max-width: 375px) {
        .table1-mobile {
            font-size: 11px;
        }
        
        .table1-mobile th,
        .table1-mobile td {
            padding: 5px 3px;
            font-size: 11px;
            min-width: 70px;
        }
    }
    
    /* iPhone SE - compact but readable */
    @media (max-width: 320px) {
        .table1-mobile {
            font-size: 10px;
        }
        
        .table1-mobile th,
        .table1-mobile td {
            padding: 4px 2px;
            font-size: 10px;
            min-width: 60px;
            min-width: 45px;
        }
    }
}

/* Signal colors for table cells */
.green-cell {
    background-color: #28a745; /* Green */
    color: white;
}

.red-cell {
    background-color: #dc3545; /* Red */
    color: white;
}

@media (max-width: 600px) {
    .section button {
        width: 100%;
    }
}

/* Conditional formatting for ADXTR table */
.adxtr-cell-1 {
    background-color: #28a745; /* Green */
    color: white;
}

.adxtr-cell--1 {
    background-color: #dc3545; /* Red */
    color: white;
}

/* Full-width button */
.full-width-button {
    width: 100%;
    display: block;
    margin: 10px 0;
    background-color: #6f42c1; /* Purple */
    color: #ffffff; /* White text */
    border: none;
    padding: 10px;
    cursor: pointer;
}

.full-width-button:hover {
    background-color: #ffc107; /* Yellow on hover */
}

/* Tooltip container */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 100%; /* Ensure the tooltip container is full width */
}

/* Tooltip text */
.tooltip .tooltiptext {
    visibility: hidden;
    width: 250px;
    background-color: #555;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 99999;
    bottom: 125%; /* Position the tooltip above the text */
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Tooltip arrow */
.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%; /* At the bottom of the tooltip */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}

/* Show the tooltip text when hovering (desktop) */
.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Mobile-friendly tooltip - show when active class is added */
.tooltip.active .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Responsive tooltips - Mobile and iPad (including iPad Pro) */
@media (max-width: 1366px) {
    .tooltip .tooltiptext {
        width: 90vw;
        max-width: 400px;
        position: fixed !important;
        left: auto !important;
        right: 5% !important;
        top: 15% !important;
        bottom: auto !important;
        transform: none !important;
        margin-left: 0 !important;
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 99999 !important;
        padding: 30px 25px !important;
        box-sizing: border-box;
    }
    
    /* Mobile/iPad tooltip enhancements */
    .tooltip {
        position: relative;
    }
    
    /* Visually separated lightbulb with invitation text */
    .tooltip::before {
        content: "Tap 💡 info";
        position: absolute;
        top: -15px;
        right: -10px;
        font-size: 11px;
        color: #666;
        background: rgba(255, 255, 255, 0.95);
        padding: 6px 10px;
        border-radius: 15px;
        border: 1px solid #ccc;
        pointer-events: auto;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        transition: all 0.2s ease;
        white-space: nowrap;
        z-index: 10;
        font-weight: 500;
    }
    
    .tooltip::before:hover,
    .tooltip::before:active {
        background: rgba(255, 255, 255, 1);
        transform: scale(1.05);
        box-shadow: 0 3px 10px rgba(0,0,0,0.25);
        color: #333;
    }
    
    /* Ensure tooltip is visible when active */
    .tooltip.active .tooltiptext {
        visibility: visible !important;
        opacity: 1 !important;
        display: block !important;
    }
    
    /* Add margin to tooltip container for lightbulb space */
    .tooltip {
        margin-bottom: 20px;
    }
    
    /* Chart section back navigation */
    .chart-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
    }
    
    .back-to-tools-btn {
        background-color: #007acc;
        color: white;
        border: none;
        padding: 8px 15px;
        border-radius: 20px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 500;
        transition: all 0.2s ease;
        box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    }
    
    .back-to-tools-btn:hover,
    .back-to-tools-btn:active {
        background-color: #005588;
        transform: scale(1.05);
        box-shadow: 0 3px 8px rgba(0,0,0,0.25);
    }
    
    /* Back to Table 1 button styling */
    .back-to-table1-btn {
        background-color: #28a745;
        color: white;
        border: none;
        padding: 6px 12px;
        border-radius: 15px;
        cursor: pointer;
        font-size: 11px;
        font-weight: 500;
        transition: all 0.2s ease;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        margin: 0 auto 8px auto;
        display: block;
        white-space: nowrap;
    }
    
    .back-to-table1-btn:hover,
    .back-to-table1-btn:active {
        background-color: #218838;
        transform: scale(1.05);
        box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    }
    
    /* Return to last tool button styling */
    .return-to-tool-btn {
        background-color: #fd7e14;
        color: white;
        border: none;
        padding: 10px 20px;
        border-radius: 25px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 500;
        transition: all 0.2s ease;
        box-shadow: 0 3px 8px rgba(0,0,0,0.15);
        margin: 15px auto;
        display: none;
        white-space: nowrap;
    }
    
    .return-to-tool-btn:hover,
    .return-to-tool-btn:active {
        background-color: #e8680e;
        transform: scale(1.05);
        box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    }
    
    .return-to-tool-btn.show {
        display: block;
    }
    
    @media (max-width: 600px) {
        .chart-header {
            flex-direction: column;
            gap: 10px;
        }
        
        .back-to-tools-btn {
            align-self: flex-start;
        }
    }
    
    /* Active lightbulb when tooltip is shown */
    .tooltip.active::before {
        background: rgba(255, 255, 0, 0.3);
        border-color: #ffa500;
    }
    
    /* Chart navigation button for 'tr' buttons - Mobile only */
    .tooltip.has-chart::after {
        content: 'View Chart ↓';
        position: absolute;
        top: -15px;
        left: -10px;
        font-size: 11px;
        color: #007acc;
        background: rgba(240, 248, 255, 0.95);
        padding: 6px 10px;
        border-radius: 15px;
        border: 1px solid #007acc;
        pointer-events: auto;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        transition: all 0.2s ease;
        white-space: nowrap;
        z-index: 10;
        font-weight: 500;
    }
    
    .tooltip.has-chart::after:hover,
    .tooltip.has-chart::after:active {
        background: rgba(240, 248, 255, 1);
        transform: scale(1.05);
        box-shadow: 0 3px 10px rgba(0,0,0,0.25);
        color: #005588;
    }
    
    /* Ensure mobile tooltips are properly displayed */
    .tooltip.active .tooltiptext {
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1000 !important;
        display: block !important;
    }
    
    /* Mobile clean block formatting */
    @media (max-width: 768px) {
        .tooltip.active .tooltiptext {
            position: fixed !important;
            top: 10% !important;
            right: 5% !important;
            left: 5% !important;
            width: auto !important;
            max-width: none !important;
            visibility: visible !important;
            opacity: 1 !important;
            display: block !important;
            z-index: 99999 !important;
            min-height: 200px !important;
            padding: 30px 20px !important;
            padding-left: 20px !important;
            word-wrap: break-word !important;
            overflow-wrap: break-word !important;
            word-break: break-word !important;
            white-space: normal !important;
            text-indent: 0 !important;
            margin-left: 0 !important;
        }
        
        /* Force clean block formatting on mobile */
        .tooltip.active .tooltiptext * {
            word-wrap: break-word !important;
            overflow-wrap: break-word !important;
            word-break: break-word !important;
            white-space: normal !important;
            max-width: 100% !important;
            text-indent: 0 !important;
            margin-left: 0 !important;
            padding-left: 0 !important;
        }
        
        /* Maintain list structure on mobile */
        .tooltip.active .tooltiptext ul {
            padding-left: 20px !important;
        }
    }
    
    /* Mobile tooltip - clean block formatting like top line */
    .tooltip .tooltiptext {
        position: fixed;
        top: 10%;
        right: 5%;
        left: 5%;
        width: auto;
        max-width: none;
        min-height: 200px;
        max-height: 80vh;
        background-color: rgba(0, 0, 0, 0.95);
        color: white;
        text-align: left;
        padding: 30px 25px;
        border-radius: 15px;
        font-size: 16px;
        line-height: 1.6;
        z-index: 1000;
        overflow-y: auto;
        overflow-x: hidden;
        box-shadow: 0 15px 50px rgba(0,0,0,0.7);
        backdrop-filter: blur(15px);
        box-sizing: border-box;
        border: 2px solid rgba(255, 255, 255, 0.2);
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: normal;
        text-indent: 0;
        margin-left: 0;
        padding-left: 25px;
    }
    
    /* Clean block formatting for all text elements */
    .tooltip .tooltiptext h3,
    .tooltip .tooltiptext h4 {
        text-align: center;
        margin: 0 0 20px 0;
        padding: 0;
        font-size: 18px;
        color: #fff;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        text-indent: 0;
        margin-left: 0;
    }
    
    .tooltip .tooltiptext p {
        margin: 15px 0;
        padding: 0;
        text-align: left;
        font-size: 17px;
        line-height: 1.6;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: normal;
        text-indent: 0;
        margin-left: 0;
        padding-left: 0;
    }
    
    .tooltip .tooltiptext ul {
        margin: 15px 0 15px 0;
        padding: 0;
        padding-left: 20px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        text-indent: 0;
        margin-left: 0;
    }
    
    .tooltip .tooltiptext li {
        margin: 8px 0;
        padding: 0;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        text-indent: 0;
        margin-left: 0;
        padding-left: 0;
    }
    
    /* Force clean block formatting on all elements */
    .tooltip .tooltiptext * {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        text-indent: 0 !important;
        margin-left: 0 !important;
        padding-left: 0 !important;
    }
    
    /* Special handling for lists to maintain structure */
    .tooltip .tooltiptext ul {
        padding-left: 20px !important;
    }
    
    /* Close instruction at top of tooltip */
    .tooltip .tooltiptext::before {
        content: 'Tap 💡 again to close';
        display: block;
        font-size: 14px;
        color: #bbb;
        text-align: center;
        margin-bottom: 25px;
        padding-bottom: 20px;
        border-bottom: 1px solid #555;
        font-weight: 600;
        background: rgba(255, 255, 255, 0.05);
        margin: -30px -25px 25px -25px;
        padding: 15px 25px 20px 25px;
        border-radius: 15px 15px 0 0;
        position: sticky;
        top: 0;
        z-index: 10;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .tooltip .tooltiptext::before:active {
        background: rgba(255, 255, 255, 0.15);
        color: #fff;
    }
    
    @media (max-width: 768px) {
        .tooltip .tooltiptext::before {
            margin: -30px -20px 25px -20px !important;
            padding: 15px 20px 20px 20px !important;
        }
    }
    
    /* Hide hover effects on mobile to prevent sticky hover */
    .tooltip:hover .tooltiptext {
        visibility: hidden;
        opacity: 0;
    }
}

/* Suggestions dropdown */
#suggestions {
    border: 1px solid #ccc;
    max-height: 150px;
    overflow-y: auto;
    width: 100%;
    background-color: #fff;
    position: absolute;
    z-index: 1000;
}

.suggestion {
    padding: 8px;
    cursor: pointer;
}

.suggestion:hover {
    background-color: #f0f0f0;
}

/* Date Picker and Ticker Search Styling - Improved Centering */
.date-picker, .ticker-search {
    margin-bottom: 20px;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.date-picker label, .ticker-search label {
    margin-bottom: 5px;
    font-weight: bold;
}

.date-picker input, .ticker-search input {
    padding: 10px;
    margin-bottom: 10px;
    width: 100%;
    max-width: 300px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.date-picker button, .ticker-search button {
    background-color: #6f42c1; /* Purple */
    color: #ffffff; /* White text */
    border: none;
    padding: 10px;
    cursor: pointer;
    width: 100%;
    max-width: 300px;
}

.date-picker button:hover, .ticker-search button:hover {
    background-color: #ffc107; /* Yellow on hover */
}

/* Pre-select buttons */
.pre-select-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 10px;
}

.pre-select {
    background-color: #6f42c1; /* Purple */
    color: #ffffff; /* White text */
    border: none;
    padding: 10px;
    margin: 5px;
    cursor: pointer;
    border-radius: 4px;
}

.pre-select:hover {
    background-color: #ffc107; /* Yellow on hover */
}

/* Privacy Consent Banner */
.privacy-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    z-index: 10000;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: 0 -2px 20px rgba(0,0,0,0.2);
}

/* Mobile: Show at top to avoid AI widget conflict */
@media (max-width: 768px) {
    .privacy-banner {
        top: 0;
        bottom: auto;
        transform: translateY(-100%);
        box-shadow: 0 2px 20px rgba(0,0,0,0.2);
    }
    
    .privacy-banner.show {
        transform: translateY(0);
    }
}

.privacy-banner.show {
    transform: translateY(0);
}

.privacy-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.privacy-banner-text {
    flex: 1;
    min-width: 300px;
    font-size: 0.9rem;
}

.privacy-banner-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.privacy-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.privacy-btn-accept {
    background: rgba(40, 167, 69, 0.8);
    border-color: rgba(40, 167, 69, 0.9);
}

.privacy-btn-accept:hover {
    background: #28a745;
    transform: translateY(-2px);
}

.privacy-btn-decline {
    background: rgba(220, 53, 69, 0.8);
    border-color: rgba(220, 53, 69, 0.9);
}

.privacy-btn-decline:hover {
    background: #dc3545;
    transform: translateY(-2px);
}

.privacy-btn-info {
    background: rgba(0, 123, 255, 0.8);
    border-color: rgba(0, 123, 255, 0.9);
}

.privacy-btn-info:hover {
    background: #007bff;
    transform: translateY(-2px);
}

/* Custom Chart container styling */
#allToolsVotesChart {
    width: 100%;
    height: 400px;
    max-width: 800px;
    margin: 20px auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section canvas {
    display: block;
    border-radius: 8px;
}

/* Responsive design for privacy banner */
@media (max-width: 768px) {
    /* Mobile chart optimization */
    #allToolsVotesChart {
        height: 300px;
        margin: 10px auto;
    }
    .privacy-banner {
        padding: 12px;
    }
    
    .privacy-banner-content {
        flex-direction: column;
        text-align: center;
    }
    
    .privacy-banner-text {
        min-width: auto;
        margin-bottom: 10px;
    }
    
    .privacy-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

/* Chart navigation for Desktop only */
@media (min-width: 1367px) {
    /* Visually separated lightbulb with invitation text - Desktop */
    .tooltip::before {
        content: "Hover 💡 for info";
        position: absolute;
        top: -15px;
        right: -10px;
        font-size: 11px;
        color: #666;
        background: rgba(255, 255, 255, 0.95);
        padding: 6px 10px;
        border-radius: 15px;
        border: 1px solid #ccc;
        pointer-events: none;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        transition: all 0.2s ease;
        white-space: nowrap;
        z-index: 10;
        font-weight: 500;
    }
    
    .tooltip:hover::before {
        background: rgba(255, 255, 255, 1);
        transform: scale(1.05);
        box-shadow: 0 3px 10px rgba(0,0,0,0.25);
        color: #333;
    }
    
    /* Chart navigation button for 'tr' buttons - Desktop/iPad */
    .tooltip.has-chart::after {
        content: 'View Chart ↓';
        position: absolute;
        top: -15px;
        left: -10px;
        font-size: 11px;
        color: #007acc;
        background: rgba(240, 248, 255, 0.95);
        padding: 6px 10px;
        border-radius: 15px;
        border: 1px solid #007acc;
        pointer-events: auto;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        transition: all 0.2s ease;
        white-space: nowrap;
        z-index: 10;
        font-weight: 500;
    }
    
    .tooltip.has-chart::after:hover {
        background: rgba(240, 248, 255, 1);
        transform: scale(1.05);
        box-shadow: 0 3px 10px rgba(0,0,0,0.25);
        color: #005588;
    }
    
    /* Back to Table 1 button styling - Desktop/iPad */
    .back-to-table1-btn {
        background-color: #28a745;
        color: white;
        border: none;
        padding: 8px 16px;
        border-radius: 18px;
        cursor: pointer;
        font-size: 13px;
        font-weight: 500;
        transition: all 0.2s ease;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        margin: 0 auto 10px auto;
        display: block;
        white-space: nowrap;
    }
    
    .back-to-table1-btn:hover {
        background-color: #218838;
        transform: scale(1.05);
        box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    }
    
    /* Return to last tool button styling - Desktop/iPad */
    .return-to-tool-btn {
        background-color: #fd7e14;
        color: white;
        border: none;
        padding: 10px 20px;
        border-radius: 25px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 500;
        transition: all 0.2s ease;
        box-shadow: 0 3px 8px rgba(0,0,0,0.15);
        margin: 15px auto;
        display: none;
        white-space: nowrap;
    }
    
    .return-to-tool-btn:hover {
        background-color: #e8680e;
        transform: scale(1.05);
        box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    }
    
    .return-to-tool-btn.show {
        display: block;
    }
    
    /* Chart section back navigation - Desktop/iPad */
    .chart-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
    }
    
    .back-to-tools-btn {
        background-color: #007acc;
        color: white;
        border: none;
        padding: 10px 18px;
        border-radius: 20px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 500;
        transition: all 0.2s ease;
        box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    }
    
    .back-to-tools-btn:hover {
        background-color: #005588;
        transform: scale(1.05);
        box-shadow: 0 3px 8px rgba(0,0,0,0.25);
    }
}

/* Chess Engine Cross-Promotion Styles */
#chessPromotion {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

#chessPromotion:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.3);
}

#chessPromotion a {
    display: inline-block;
    transition: all 0.3s ease;
}

#chessPromotion a:hover {
    background-color: #2980b9 !important;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

/* iPad responsiveness for chess promotion */
@media (min-width: 769px) and (max-width: 1023px) {
    #chessPromotion {
        margin: 20px auto !important;
        width: 100%;
        max-width: 900px;
    }
}

/* Desktop responsiveness for chess promotion */
@media (min-width: 1024px) {
    #chessPromotion {
        margin: 20px auto !important;
        width: 100%;
        max-width: 900px;
    }
}

/* Mobile responsiveness for chess promotion */
@media (max-width: 768px) {
    #chessPromotion {
        margin: 20px 10px;
        padding: 20px 15px;
    }
    
    #chessPromotion h3 {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }
    
    #chessPromotion p {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 15px;
    }
    
    #chessPromotion div {
        flex-direction: column;
        gap: 10px;
    }
    
    #chessPromotion a {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Loading Indicator - Unobtrusive overlay for computationally intensive operations */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    pointer-events: none;
}

.loading-indicator.show {
    display: flex;
    pointer-events: all;
}

.loading-content {
    background-color: rgba(111, 66, 193, 0.95);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    font-weight: 500;
}

/* ═══ Profit & Loss Calculator ═══ */
.pl-calculator {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 10px;
}

.pl-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}

.pl-field {
    display: flex;
    flex-direction: column;
}

.pl-field label {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
    color: #343a40;
}

.pl-field input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

.pl-field input:focus {
    outline: none;
    border-color: #6f42c1;
    box-shadow: 0 0 0 2px rgba(111, 66, 193, 0.2);
}

.pl-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.pl-buttons button {
    padding: 10px 30px;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    min-width: 120px;
}

#plCalculateBtn {
    background-color: #6f42c1;
}
#plCalculateBtn:hover {
    background-color: #ffc107;
}
#plResetBtn:hover {
    background-color: #5a6268 !important;
}

.pl-results {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pl-results h3 {
    color: #6f42c1;
    margin-top: 0;
}

.pl-results-table {
    width: 100%;
    border-collapse: collapse;
}

.pl-results-table td {
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid #eee;
}

.pl-results-table tr:last-child td {
    border-bottom: none;
}

.pl-label {
    color: #6c757d;
    font-size: 14px;
    width: 55%;
}

.pl-value {
    text-align: right;
    font-family: 'Courier New', Courier, monospace;
    font-size: 15px;
    color: #343a40;
}

.pl-highlight-row {
    background-color: #f8f9fa;
}

/* P&L Calculator — responsive */
@media (max-width: 480px) {
    .pl-inputs {
        grid-template-columns: 1fr;
    }
    .pl-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    .pl-buttons button {
        width: 100%;
    }
    .pl-bt-pick-row {
        flex-direction: column;
    }
}

/* ── Mode Tabs ── */
.pl-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 18px;
    border-bottom: 2px solid #dee2e6;
}

.pl-mode-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: #f0f0f0;
    color: #6c757d;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.pl-mode-tab.active {
    background: #fff;
    color: #6f42c1;
    border-bottom-color: #6f42c1;
}

.pl-mode-tab:hover:not(.active) {
    background: #e9ecef;
}

/* ── Backtest Steps ── */
.pl-bt-step {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #6f42c1;
}

.pl-bt-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #6f42c1;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    flex-shrink: 0;
}

.pl-bt-step label {
    font-weight: bold;
    font-size: 14px;
    color: #343a40;
    flex-shrink: 0;
}

.pl-bt-step select {
    flex: 1;
    min-width: 180px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.pl-bt-step select:focus {
    outline: none;
    border-color: #6f42c1;
    box-shadow: 0 0 0 2px rgba(111, 66, 193, 0.2);
}

/* ── Pick Row (date + price + clear) ── */
.pl-bt-pick-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.pl-bt-pick-row input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    color: #555;
    min-width: 140px;
}

.pl-bt-pick-row input:focus {
    outline: none;
    border-color: #6f42c1;
    box-shadow: 0 0 0 2px rgba(111, 66, 193, 0.2);
}

.pl-bt-price {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    font-weight: bold;
    color: #6c757d;
    white-space: nowrap;
    min-width: 80px;
    text-align: right;
}

.pl-bt-clear {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.pl-bt-clear:hover {
    color: #dc3545;
    border-color: #dc3545;
}

/* ── Dynamic nav button injected into tool sections ── */
.pl-nav-to-calc {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px 0;
    background: #6f42c1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
}

.pl-nav-to-calc:hover {
    background: #ffc107;
}

/* ── Hover price badge on signal table rows ── */
.pl-hover-price {
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    background: #343a40;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 20;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* ── Results meta line ── */
.pl-results-meta {
    text-align: center;
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 12px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

/* ── Info icon + tooltip ── */
.pl-info-icon {
    position: relative;
    cursor: help;
    font-size: 14px;
    margin-left: 4px;
}

.pl-info-tooltip {
    display: none;
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    background: #343a40;
    color: #fff;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.5;
    padding: 10px 12px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 100;
    text-align: left;
}

.pl-info-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #343a40;
}

.pl-info-icon:hover .pl-info-tooltip,
.pl-info-icon:focus .pl-info-tooltip {
    display: block;
}