/* === AlgoStraddle Base Styles === */

/* Font family */
body, html, input, button, select, textarea {
    font-family: 'IBM Plex Sans', 'Source Sans 3', sans-serif !important;
}

/* Base HTML */
html {
    font-size: 110%;
    scroll-behavior: smooth;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* Body performance */
body {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* GPU acceleration for scrollable containers */
.scroll-container,
[class*="overflow-auto"],
[class*="overflow-y-auto"],
[class*="overflow-scroll"] {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: scroll-position;
}

@media (min-width: 1024px) {
    main {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        will-change: scroll-position;
    }
}

/* Optimize animations for performance */
.animate-pulse {
    animation-duration: 1s;
    animation-timing-function: ease-in-out;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Chart container */
.chart-container {
    contain: style;
    will-change: auto;
}

.chart-container-relative {
    position: relative;
    width: 100%;
}

/* Glass panel effect */
.glass-panel {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .glass-panel {
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #475569;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Mobile Settings Sidebar */
@media (max-width: 1023px) {
    #settings-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 300px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding: 12px;
        background: white;
        -webkit-overflow-scrolling: touch;
    }

    .dark #settings-sidebar {
        background: #1f2937;
    }

    #settings-sidebar.open {
        left: 0;
    }

    #settings-sidebar select,
    #settings-sidebar input,
    #settings-sidebar button:not(.settings-close-btn) {
        position: relative;
        z-index: 1001;
        pointer-events: auto;
    }

    #settings-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    #settings-overlay.open {
        display: block;
    }
}

@media (min-width: 1024px) {
    #mobile-settings-btn,
    #settings-overlay {
        display: none !important;
    }
}

/* Floating buttons: hidden by default, shown on scroll (mobile) */
@media (max-width: 1023px) {
    #mobile-settings-btn {
        opacity: 0;
        transform: translateY(20px);
        pointer-events: none;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    #mobile-settings-btn.scroll-visible {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    #theme-toggle {
        opacity: 0;
        transform: translateY(20px);
        pointer-events: none;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    #theme-toggle.scroll-visible {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }
}

/* CMS rich text content styling */
.cms-content h1, .cms-content h2, .cms-content h3, .cms-content h4 {
    font-weight: 700;
    margin: 1.25em 0 0.5em;
}
.cms-content h1 { font-size: 1.5em; }
.cms-content h2 { font-size: 1.3em; }
.cms-content h3 { font-size: 1.15em; }
.cms-content p { margin: 0.6em 0; }
.cms-content ul, .cms-content ol { margin: 0.6em 0; padding-left: 1.5em; }
.cms-content ul { list-style: disc; }
.cms-content ol { list-style: decimal; }
.cms-content li { margin: 0.25em 0; }
.cms-content a { color: #2563eb; text-decoration: underline; }
.dark .cms-content a { color: #60a5fa; }
.cms-content blockquote {
    border-left: 3px solid #6366f1;
    padding-left: 1em;
    margin: 0.8em 0;
    color: #6b7280;
}
.dark .cms-content blockquote { color: #9ca3af; }
.cms-content img { max-width: 100%; height: auto; border-radius: 0.5rem; }
.cms-content table { width: 100%; border-collapse: collapse; margin: 0.8em 0; }
.cms-content th, .cms-content td { border: 1px solid #e5e7eb; padding: 0.4em 0.75em; text-align: left; }
.dark .cms-content th, .dark .cms-content td { border-color: #374151; }
.cms-content th { background: #f9fafb; font-weight: 600; }
.dark .cms-content th { background: #1f2937; }
.cms-content pre, .cms-content code { font-family: monospace; font-size: 0.9em; }
.cms-content pre { background: #f3f4f6; padding: 0.75em 1em; border-radius: 0.375rem; overflow-x: auto; }
.dark .cms-content pre { background: #1f2937; }
.cms-content hr { border: none; border-top: 1px solid #e5e7eb; margin: 1em 0; }
.dark .cms-content hr { border-color: #374151; }

/* Footer link hover animations */
footer .footer-col a,
.hover-underline-animation {
    position: relative;
    display: inline-block;
    text-decoration: none !important;
}

footer .footer-col a::after,
.hover-underline-animation::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -1px;
    left: 0;
    background-color: currentColor;
    transition: width 0.3s ease;
}

footer .footer-col a:hover::after,
.hover-underline-animation:hover::after {
    width: 100%;
}

/* Footer chevron rotation on expand */
.footer-chevron.rotated {
    transform: rotate(180deg);
}

/* ===== CE / PE Color Utilities ===== */
.text-ce { color: #16a34a; }
.dark .text-ce { color: #4ade80; }
.text-pe { color: #dc2626; }
.dark .text-pe { color: #f87171; }

/* ===== Strike Table (Decay / Straddle sidebars) ===== */
.strike-table-container {
    max-height: 500px;
    overflow-y: auto;
}

.strike-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.strike-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 7px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    text-align: right;
    white-space: nowrap;
}
.strike-table thead th:first-child { text-align: left; }

.dark .strike-table thead th {
    background: #1e2939;
    color: #94a3b8;
    border-bottom-color: #334155;
}

.strike-table tbody td {
    padding: 7px 6px;
    text-align: right;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.strike-table tbody td:first-child { text-align: left; }

.dark .strike-table tbody td {
    border-bottom-color: #1e2939;
}

.strike-table tbody tr:hover {
    background: rgba(241, 245, 249, 0.8);
}
.dark .strike-table tbody tr:hover {
    background: rgba(51, 65, 85, 0.35);
}

.strike-cell-strike {
    font-weight: 600;
    color: #334155;
    font-variant-numeric: tabular-nums;
}
.dark .strike-cell-strike { color: #cbd5e1; }

.strike-row-selected {
    background: rgba(234, 179, 8, 0.13) !important;
    font-weight: 700;
}
.dark .strike-row-selected {
    background: rgba(234, 179, 8, 0.09) !important;
}
