/* Custom styles for ByBit Option Monitor */

.gex-container,
.main-content-full,
.card {
    max-width: 100%;
    overflow-x: hidden;
}

/* Layout */
.sidebar {
    height: 100vh;
    background-color: var(--theme-bg-secondary);
    background: linear-gradient(135deg, var(--theme-bg-secondary) 0%, var(--theme-bg-tertiary) 100%);
    border-right: 1px solid var(--theme-border-primary);
    box-shadow: var(--theme-shadow-sm);
}

.main-content {
    height: 100vh;
    overflow-y: auto;
    background-color: var(--theme-bg-card);
}

/* Portfolio selector */
.portfolio-selector {
    margin-bottom: 2rem;
}

.portfolio-selector select {
    border-radius: 8px;
    border: 2px solid var(--theme-border-primary);
    transition: all 0.3s ease;
}

.portfolio-selector select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem var(--color-primary-soft);
}

/* Cards */
.summary-card {
    margin-bottom: 1rem;
    transition: transform 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--theme-shadow-md);
}

.card {
    border-radius: 10px;
    border: 1px solid var(--theme-border-primary);
    box-shadow: none;
}

.card-header {
    background: linear-gradient(135deg, var(--theme-bg-secondary) 0%, var(--theme-bg-card) 100%);
    border-bottom: 1px solid var(--theme-border-primary);
    font-weight: 600;
}

/* Plot container */
.plot-container {
    margin: 1rem 0;
    min-height: 400px;
    border-radius: 8px;
    background-color: var(--theme-bg-secondary);
}

/* Badges */
.badge {
    font-size: 0.75em;
    padding: 0.5em 0.8em;
    border-radius: 15px;
}

/* Loading states */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--color-grey);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.loading::after {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-light);
    border-top: 2px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Error states */
.error {
    color: var(--color-danger);
    padding: 1rem;
    background-color: var(--color-danger-soft);
    border: 1px solid var(--color-danger);
    border-radius: 8px;
    margin: 1rem 0;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--theme-border-primary);
    }

    .main-content {
        height: auto;
    }

    .summary-card {
        margin-bottom: 0.5rem;
    }
}

/* Hover effects */
.btn {
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}



/* nouislider customization - unified compact style */
.nouislider-container {
    margin: 8px 0 60px 0;
}

.noUi-target {
    background: var(--theme-bg-secondary);
    border-radius: 3px;
    border: 1px solid var(--theme-border-primary);
    box-shadow: none;
    height: 6px;
}

.noUi-connect {
    background: var(--color-primary);
}

.noUi-horizontal .noUi-handle {
    border-radius: 50% !important;
    background: var(--color-control-handle) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
    cursor: pointer !important;
    width: 24px !important;
    height: 24px !important;
    right: -12px !important;
    top: -10px !important;
    transition: all 0.2s ease !important;
    border: 1px solid var(--color-primary) !important;
}

.noUi-horizontal .noUi-handle:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
    transform: scale(1.1);
}

.noUi-horizontal .noUi-handle:before,
.noUi-horizontal .noUi-handle:after {
    display: none !important;
}

/* Disable transition during replay playback to prevent flickering */
.tm-playing .noUi-handle {
    transition: none !important;
}

.noUi-pips {
    color: var(--color-dark) !important;
    font-size: 0.65rem;
    font-weight: 500;
}

.noUi-marker-large {
    background: var(--color-dark) !important;
    height: 10px;
    width: 1px;
}

.noUi-marker-normal {
    background: var(--color-dark) !important;
    height: 6px;
    width: 1px;
}

.noUi-value-large {
    font-weight: 500;
    color: var(--color-dark) !important;
    font-size: 0.7rem;
}

/* Specific overrides for nouislider CDN styles */
#scaleSlider .noUi-pips .noUi-value,
#dateRangeSlider .noUi-pips .noUi-value,
#ivAdjustmentSlider .noUi-pips .noUi-value {
    color: var(--color-dark) !important;
}

#scaleSlider .noUi-pips .noUi-marker,
#dateRangeSlider .noUi-pips .noUi-marker,
#ivAdjustmentSlider .noUi-pips .noUi-marker {
    background: var(--color-dark) !important;
}

#scaleSlider .noUi-pips .noUi-value-large,
#dateRangeSlider .noUi-pips .noUi-value-large,
#ivAdjustmentSlider .noUi-pips .noUi-value-large {
    color: var(--color-dark) !important;
}

.noUi-pips-horizontal .noUi-value {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 3px;
}

.noUi-pips-horizontal .noUi-value:hover {
    color: white;
    background-color: var(--color-primary);
    font-weight: 600;
}

/* Slider header styling */
.slider-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--theme-text-secondary);
    margin-bottom: 6px;
    display: block;
}

.slider-current-value {
    color: var(--color-primary);
    font-weight: 700;
    background: var(--color-primary-tint);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

/* IV Adjustment value styling when not 100 */
#ivAdjustmentValue.iv-modified {
    background: var(--color-warning) !important;
    color: white !important;
    box-shadow: 0 0 8px var(--color-warning-soft);
    animation: ivPulse 2s infinite;
}

@keyframes ivPulse {

    0%,
    100% {
        box-shadow: 0 0 8px var(--color-warning-soft);
    }

    50% {
        box-shadow: 0 0 12px var(--color-warning-soft);
    }
}

/* Position Cards */
#position-cards-section {
    border-bottom: 1px solid var(--theme-border-primary);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

#position-cards-section h6 {
    color: var(--theme-text-secondary);
    font-weight: 600;
    margin-bottom: 0.8rem;
}

.position-card {
    transition: all 0.2s ease;
    margin-bottom: 0.8rem;
}

.position-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--theme-shadow-md);
}

.position-card .card {
    border-radius: 8px;
    border: 1px solid var(--theme-border-primary);
    background: var(--theme-bg-card);
    box-shadow: var(--theme-shadow-sm);
}

/* Position card background colors based on side */
.position-card[data-side="Buy"] .card {
    background: linear-gradient(135deg, #f5fdf7 0%, #f0fcf3 100%);
    border-color: #d4edd4;
}

.position-card[data-side="Sell"] .card {
    background: linear-gradient(135deg, #fdf5f5 0%, #fcf0f0 100%);
    border-color: #edd4d4;
}

.position-card .card-body {
    padding: 0.75rem;
}

.position-symbol {
    font-size: 0.85rem;
    color: var(--theme-text-primary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.position-side-badge {
    font-size: 0.85rem;
    /* 30% larger than 0.65rem */
    padding: 0.25em 0.5em;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}


/* Strike Slider Section */
.strike-slider-section {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--theme-border-primary);
}

.strike-slider-container {
    margin: 0.8rem 0.2rem 2.5rem 0.2rem;
    height: 6px;
}


/* Position card disabled state */
.position-card.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.position-card.disabled .card {
    background-color: var(--theme-bg-secondary);
    border-color: var(--theme-border-secondary);
}

.position-card.disabled .card-body {
    color: var(--color-grey);
}

.position-card.disabled:hover {
    transform: none;
    box-shadow: var(--theme-shadow-sm);
}

/* Keep checkbox clickable even when card is disabled */
.position-card.disabled .position-included-checkbox {
    pointer-events: auto;
}

/* Responsive adjustments for position cards */
@media (max-width: 768px) {
    .position-card .card-body {
        padding: 0.6rem;
    }


    .position-symbol {
        font-size: 0.8rem;
    }
}

/* Combined Analysis Styles */
.combined-analysis-container {
    max-width: 100%;
}

.var-info-card {
    transition: transform 0.2s ease;
    border: 1px solid var(--theme-border-primary);
}

.var-info-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--theme-shadow-md);
}

.var-metric {
    padding: 0.25rem 0;
}

.metric-label-compact {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--theme-text-secondary);
    margin-bottom: 0.125rem;
}

.metric-value-compact {
    font-size: 1rem;
    font-weight: bold;
}

.compact-card {
    border-radius: 0.375rem;
}

.compact-card .card-header {
    border-bottom: 1px solid var(--theme-border-primary);
}

.confidence-section {
    border-right: 1px solid var(--theme-border-primary);
}

.confidence-section:last-child {
    border-right: none;
}

.confidence-header {
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--theme-border-primary);
    margin-bottom: 0.25rem;
}

/* Legacy styles for backwards compatibility */
.metric-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--theme-text-secondary);
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: bold;
}

.pnl-section .card {
    border-left: 4px solid var(--theme-positive);
}

#pnl-chart-container .table-responsive {
    max-height: none;
}

/* Chart container optimizations */
.chart-container {
    padding: 0;
    margin: 0;
    overflow: hidden;
}

#pnl-chart {
    padding: 0;
    margin: 0;
}

/* --- Mobile App Mode Layout (Single Page View) --- */
@media (max-width: 768px) {

    /* Hide footer in app mode to save space */
    .gex-app-mode-footer-hidden footer.footer {
        display: none !important;
    }

    /* Main container takes full viewport height minus navbar */
    .gex-app-container-mobile {
        display: flex;
        flex-direction: column;
        height: calc(100dvh - 56px);
        /* Fallback for dynamic viewport height */
        overflow: hidden;
        /* Prevent body scroll */
        padding-bottom: 0 !important;
    }

    /* Fixed height elements should not shrink */
    .gex-controls-fixed {
        flex-shrink: 0;
    }

    /* Content area (Chart + Markers) grows to fill space */
    .gex-content-grow {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        /* Crucial for nested flex scrolling */
        overflow: hidden;
    }

    /* Markers/Widgets fixed height */
    .gex-markers-mobile-fixed {
        flex-shrink: 0;
        max-height: 120px;
        overflow-y: auto;
        margin-bottom: 0.5rem;
    }

    /* Chart takes remaining space in the content area */
    .gex-chart-mobile-fill {
        flex-grow: 1;
        height: 100% !important;
        /* Force explicit height */
        min-height: 0;
        position: relative;
    }

    /* Compact controls on mobile */
    .gex-control-col-mobile {
        width: 50%;
        padding-right: 5px;
    }

    .gex-control-col-mobile:last-child {
        padding-right: 12px;
        /* Bootstrap gutter */
        padding-left: 5px;
    }
}

/* ========================================
   Account Page - Referral Link Styles
   ======================================== */

/* Referral copy button */
#copyReferralBtn {
    font-weight: 500;
    transition: all 0.3s ease;
}

#copyReferralBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#referralCodeDisplay {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
}

/* Responsive font sizes for referral button */
@media (max-width: 576px) {
    #referralCodeDisplay {
        font-size: 0.9rem;
    }
}