/* LPPL Bubble Detector - Modern Dark Theme Styles */

:root {
    /* Colors */
    --bg-primary: #0a0f1e;
    --bg-secondary: #0f1628;
    --bg-card: rgba(15, 23, 42, 0.8);
    --bg-glass: rgba(30, 41, 59, 0.6);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-yellow: #eab308;
    --accent-green: #22c55e;

    --border-color: rgba(148, 163, 184, 0.1);
    --glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Spacing */
    --header-height: 70px;
    --panel-width: 340px;

    /* Animation */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--bg-primary) 0%, #0d1326 50%, #0a0f1e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-subtitle {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
}

/* Search Section */
.search-section {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    justify-content: flex-end;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 16px 0 44px;
    font-size: 14px;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: var(--glow-blue);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* Timeframe & Preset Selectors */
.timeframe-selector,
.preset-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeframe-selector label,
.preset-selector label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.timeframe-selector input {
    width: 70px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 12px;
    font-size: 14px;
    color: var(--text-primary);
    text-align: center;
}

.preset-selector select {
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 32px 0 14px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.timeframe-selector input:focus,
.preset-selector select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Analyze Button */
.analyze-btn {
    height: 44px;
    padding: 0 28px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 8px;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.analyze-btn:active {
    transform: translateY(0);
}

.analyze-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    padding: 24px;
    gap: 24px;
}

/* Chart Section */
.chart-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-legend {
    display: flex;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 3px;
    border-radius: 2px;
}

.legend-color.price {
    background: var(--accent-blue);
}

.legend-color.fit {
    background: var(--accent-red);
}

.legend-color.critical {
    background: var(--accent-orange);
    border-style: dashed;
}

.chart-container {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    min-height: 400px;
    position: relative;
}

.chart-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Results Panel */
.results-panel {
    width: var(--panel-width);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.results-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state .hint {
    font-size: 13px;
    margin-top: 8px;
}

/* Result Cards */
.result-card {
    margin-bottom: 20px;
}

.result-card:last-child {
    margin-bottom: 0;
}

.result-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.result-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.result-value.small {
    font-size: 16px;
    font-weight: 600;
}

/* Bubble Gauge */
.bubble-gauge {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.gauge-circle {
    width: 140px;
    height: 140px;
    margin: 0 auto 16px;
    position: relative;
}

.gauge-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: var(--bg-primary);
    stroke-width: 10;
}

.gauge-fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out, stroke 0.3s ease;
}

.gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    font-weight: 700;
}

.gauge-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Risk Badge */
.risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
}

/* Divider */
.result-divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

/* Parameters */
.parameters-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.param-item {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 12px;
}

.param-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.param-value {
    font-size: 14px;
    font-weight: 600;
    font-family: 'SF Mono', 'Menlo', monospace;
}

/* Recommendation Bar */
.recommendation-bar {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
}

.recommendation-content {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.recommendation-icon {
    font-size: 24px;
}

.recommendation-text strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.recommendation-text p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* No Bubble State */
.no-bubble-state {
    text-align: center;
    padding: 32px 16px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 12px;
}

.no-bubble-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.no-bubble-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-green);
    margin-bottom: 8px;
}

.no-bubble-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error State */
.error-state {
    text-align: center;
    padding: 40px 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.error-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-red);
    margin-bottom: 8px;
}

.error-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }

    .results-panel {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        height: auto;
        padding: 16px;
        gap: 12px;
    }

    .search-section {
        flex-wrap: wrap;
        width: 100%;
    }

    .search-box {
        width: 100%;
    }
}

/* Plotly Overrides */
.js-plotly-plot .plotly .modebar {
    background: transparent !important;
}

.js-plotly-plot .plotly .modebar-btn {
    color: var(--text-muted) !important;
}

.js-plotly-plot .plotly .modebar-btn:hover {
    color: var(--text-primary) !important;
}

/* Quick Picks */
.quick-picks {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-glass);
    border-radius: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.quick-label {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.quick-btn {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.quick-btn:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.quick-btn:active {
    transform: translateY(0);
}

/* Advanced Options Toggle */
.advanced-options,
.options-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.toggle-advanced-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-advanced-btn:hover {
    background: var(--bg-glass);
    border-color: var(--accent-blue);
}

.toggle-advanced-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Help Modal */
.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.help-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.help-content h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.help-item {
    margin-bottom: 16px;
}

.help-item strong {
    color: var(--accent-blue);
}

.help-item p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

.help-close {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    background: var(--accent-blue);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
}