/* ─── CSS Variables & Design System ─── */
:root {
    --bg-dark: #07090e;
    --card-bg: rgba(13, 17, 27, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f0f4f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.4);
    --secondary: #0ea5e9;
    --secondary-glow: rgba(14, 165, 233, 0.3);
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.2);
    
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Global Reset & Body Styles ─── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg-dark);
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background-color: var(--bg-dark);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding: 2rem 1rem;
    line-height: 1.5;
}

/* ─── Glowing Background Orbs ─── */
.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    background: radial-gradient(circle at 50% 50%, #0d131f 0%, #06090e 100%);
}

.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -2;
    opacity: 0.15;
    pointer-events: none;
}

.orb-1 {
    top: -10%;
    left: 10%;
    width: 45vw;
    height: 45vw;
    background: var(--primary);
    animation: pulse-orb 15s infinite alternate;
}

.orb-2 {
    bottom: -10%;
    right: 10%;
    width: 40vw;
    height: 40vw;
    background: var(--secondary);
    animation: pulse-orb 20s infinite alternate-reverse;
}

@keyframes pulse-orb {
    0% { transform: scale(1) translate(0, 0); opacity: 0.12; }
    100% { transform: scale(1.2) translate(5%, 5%); opacity: 0.2; }
}

/* ─── Layout Container ─── */
.app-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* ─── Glassmorphism Cards ─── */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.75rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

/* ─── Header Section ─── */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.logo-container {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.logo-icon {
    font-size: 1.5rem;
    color: #fff;
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #fff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ─── Buttons & Badges ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success-glow {
    background: var(--success-glow);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

/* ─── Metric Cards Grid ─── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.card-icon-wrapper {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.return-icon {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.win-icon {
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.2);
    color: var(--secondary);
}

.trades-icon {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.dd-icon {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.metric-info .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.25rem;
}

.metric-info .value {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.metric-info .change {
    font-size: 0.8rem;
}

.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }

/* ─── Chart Section & Controls ─── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.title-group h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
}

.header-icon {
    font-size: 1.25rem;
}

.config-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.config-selector-wrapper label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-select {
    background-color: #0b0f19;
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.875rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    transition: height 0.2s ease;
}

/* Fullscreen Chart Overlay Styling */
.chart-section.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    margin: 0;
    border-radius: 0;
    padding: 2rem 2.5rem;
    background: rgba(7, 9, 14, 0.98);
    backdrop-filter: blur(25px);
    display: flex;
    flex-direction: column;
}

.chart-section.fullscreen .chart-container {
    flex: 1;
    height: auto !important;
    margin-top: 1rem;
}

.chart-section.fullscreen .section-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.chart-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.navigation-controls {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
    padding: 2px;
}

.btn-control {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 6px;
}

.btn-control:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-control:active {
    background: rgba(255, 255, 255, 0.1);
}

.btn-control i {
    font-size: 0.9rem;
}

.btn-fullscreen-toggle {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.btn-fullscreen-toggle:hover {
    background: rgba(99, 102, 241, 0.18);
    color: #fff;
    border-color: rgba(99, 102, 241, 0.45);
}

/* ─── Info Grid ─── */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

/* Position Details Styles */
.position-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pos-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.pos-metric:last-child {
    border-bottom: none;
}

.pos-metric .p-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pos-metric .p-value {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.05rem;
}

.unrealized-glow-green {
    color: var(--success);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.unrealized-glow-red {
    color: var(--danger);
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* Rule Details Styles */
.rules-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rule-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.rule-number {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.rule-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.rule-text strong {
    color: var(--text-primary);
    font-weight: 500;
}

/* ─── Table Section ─── */
.table-filters {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-input {
    background-color: #0b0f19;
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    border-radius: 8px;
    outline: none;
    width: 250px;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--success);
    box-shadow: 0 0 10px var(--success-glow);
}

.table-wrapper {
    overflow-x: auto;
    max-height: 380px;
    overflow-y: auto;
}

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

.trade-table th {
    background-color: #0d121f;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 0.875rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

.trade-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.trade-table tbody tr {
    transition: var(--transition);
}

.trade-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Custom Scrollbar for overflow containers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ─── Pine Section & Code Box ─── */
.code-wrapper {
    position: relative;
    border-radius: 12px;
    background: #05070b;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1.25rem;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

pre {
    white-space: pre;
    color: #e2e8f0;
}

/* ─── Footer ─── */
.app-footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* ─── Animations ─── */
.animate-fade-in {
    animation: fadeIn 0.8s ease forwards;
}

.animate-slide-up {
    opacity: 0;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-pulse {
    animation: pulseIcon 2.0s infinite alternate;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }
.delay-7 { animation-delay: 0.7s; }
.delay-8 { animation-delay: 0.8s; }
.delay-9 { animation-delay: 0.9s; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseIcon {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.1); opacity: 1; }
}

/* ─── Strategy Methodology & Guide Section ─── */
.methodology-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.25rem;
}

.methodology-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 1.5rem;
    transition: var(--transition);
}

.methodology-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.methodology-card h3 {
    font-family: var(--font-heading);
    margin-bottom: 0.875rem;
}

.methodology-card .description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

.methodology-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.methodology-list li {
    position: relative;
    padding-left: 1.25rem;
    color: var(--text-secondary);
}

.methodology-list li::before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    left: 0;
    font-size: 1.2rem;
    top: -0.1rem;
}

.methodology-list li strong {
    color: var(--text-primary);
}

.full-width-card {
    grid-column: 1 / -1;
}

.exit-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.step-card {
    background: rgba(7, 9, 14, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.step-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
}

.step-num {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--secondary);
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.375rem;
}

.step-card h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.step-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.badge-primary-glow {
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid rgba(79, 70, 229, 0.3);
    color: #a5b4fc;
}

.badge-secondary-glow {
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #7dd3fc;
}

.badge-warning-glow {
    background: var(--warning-glow);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

/* ─── Responsive Styles ─── */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .config-selector-wrapper {
        width: 100%;
        justify-content: space-between;
    }
    
    .table-filters {
        width: 100%;
    }
    
    .form-input {
        width: 100%;
    }
    
    .chart-container {
        height: 300px;
    }
}
