/* Reset & Variables */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #121824;
    --bg-card: rgba(22, 30, 49, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.15);
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --accent: #6366f1; /* Indigo */
    --accent-glow: rgba(99, 102, 241, 0.4);
    
    --color-buy: #10b981; /* Emerald Green */
    --color-buy-bg: rgba(16, 185, 129, 0.15);
    --color-sell: #f43f5e; /* Rose Red */
    --color-sell-bg: rgba(244, 63, 94, 0.15);
    
    --font-primary: 'Outfit', 'Noto Sans JP', sans-serif;
    --sidebar-width: 320px;
    --transition-speed: 0.25s;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

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

/* Sidebar Controls */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 10;
}

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

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

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-main);
    line-height: 1.1;
}

.logo .subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
}

/* Forms and Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-group label i, .form-group label svg {
    width: 14px;
    height: 14px;
}

.form-control {
    width: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    padding: 10px 12px;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    transition: all var(--transition-speed);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--border-glow);
}

.input-with-button {
    display: flex;
    gap: 8px;
}

.input-with-button input {
    flex: 1;
}

.help-text {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 4px;
    line-height: 1.3;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.label-row label {
    margin-bottom: 0;
}

.param-value {
    font-size: 0.85rem;
    font-family: monospace;
    font-weight: bold;
    color: var(--accent);
    background-color: var(--border-glow);
    padding: 2px 6px;
    border-radius: 4px;
}

.divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 24px 0;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Preset Buttons Grid */
.preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-preset {
    background-color: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-family: var(--font-primary);
    font-size: 0.75rem;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.btn-preset:hover {
    color: var(--text-main);
    background-color: rgba(15, 23, 42, 0.8);
    border-color: var(--accent);
}

.btn-preset.active {
    color: #fff;
    background-color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Buttons */
.btn-primary {
    width: 100%;
    background-color: var(--accent);
    border: none;
    color: white;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-speed);
    margin-top: 10px;
}

.btn-primary:hover {
    background-color: #4f46e5;
    box-shadow: 0 0 12px var(--accent-glow);
}

.btn-primary svg {
    width: 16px;
    height: 16px;
}

.btn-secondary {
    background-color: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-primary);
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition-speed);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
}

/* Sliders */
.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: #1e293b;
    outline: none;
    margin: 8px 0;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 6px var(--accent-glow);
    transition: transform 0.1s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Main Dashboard Area */
.main-dashboard {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100vh;
    overflow-y: auto;
    position: relative;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.asset-title-block h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.badge-symbol {
    display: inline-block;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--accent);
    background-color: var(--border-glow);
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

/* Stats Cards Grid */
.stats-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.stat-card {
    min-width: 160px;
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-value-container {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.stat-change {
    font-size: 0.8rem;
    font-weight: 600;
}

.stat-change.up {
    color: var(--color-buy);
}

.stat-change.down {
    color: var(--color-sell);
}

/* Glassmorphism Cards */
.card-glass {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px;
}

/* Charts Section */
.charts-section {
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 16px;
    flex-shrink: 0;
}

.chart-container {
    width: 100%;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

#chart-price-container {
    height: 380px;
}

#chart-rsi-container {
    height: 200px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

/* Bottom Log and Explanation layout */
.bottom-section {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
    align-items: start;
}

.log-card, .info-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    min-height: 280px;
}

.card-header {
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.card-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i, .card-header h3 svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

/* Tables styling */
.table-wrapper {
    overflow-x: auto;
    flex: 1;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

th {
    color: var(--text-muted);
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(15, 23, 42, 0.3);
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

.no-data {
    text-align: center;
    color: var(--text-dim);
    padding: 40px 0 !important;
}

/* Signals badges styling */
.sig-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.sig-badge.buy {
    color: var(--color-buy);
    background-color: var(--color-buy-bg);
}

.sig-badge.sell {
    color: var(--color-sell);
    background-color: var(--color-sell-bg);
}

.text-buy {
    color: var(--color-buy);
    font-weight: 600;
}

.text-sell {
    color: var(--color-sell);
    font-weight: 600;
}

.btn-chart-jump {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--transition-speed);
}

.btn-chart-jump:hover {
    background-color: var(--accent);
    color: white;
}

/* Info card details */
.info-content {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.info-content p {
    margin-bottom: 12px;
}

.info-content ul {
    list-style-type: none;
}

.info-content li {
    margin-bottom: 12px;
    position: relative;
    padding-left: 16px;
}

.info-content li::before {
    content: "•";
    color: var(--accent);
    font-weight: bold;
    font-size: 1.25rem;
    position: absolute;
    left: 0;
    top: -2px;
}

/* Loading overlay overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 14, 23, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    z-index: 100;
    backdrop-filter: blur(4px);
    border-radius: 12px;
    transition: opacity var(--transition-speed) ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

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

/* Responsive adjustment */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
    }
    .main-dashboard {
        height: auto;
        overflow-y: visible;
    }
    .bottom-section {
        grid-template-columns: 1fr;
    }
}

/* Dashboard Tabs */
.dashboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    padding-bottom: 0.5rem;
}
.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #94a3b8;
    padding: 8px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.tab-btn:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.03);
}
.tab-btn.active {
    color: #6366f1; /* Primary Indigo */
    background: rgba(99, 102, 241, 0.1);
}

/* Tab Content Visibility */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* Screener Layout */
.screener-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.screener-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}
.screener-update-time {
    font-size: 0.85rem;
    color: #94a3b8;
}
.screener-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.screener-table-card {
    padding: 1.5rem;
    border-radius: 12px;
}
#screener-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}
#screener-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}
.badge-param {
    background: rgba(148, 163, 184, 0.1);
    color: #cbd5e1;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
}
.badge-method {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.btn-screener-view {
    background-color: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 4px;
    transition: background-color var(--transition-speed);
}
.btn-screener-view:hover {
    background-color: #4f46e5;
}

