:root {
    --bg-color: #0b0c10;
    --panel-bg: linear-gradient(145deg, #1f2229, #15171c);
    --panel-bg-hover: linear-gradient(145deg, #262a33, #1a1d24);
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #00f0ff;
    --accent-glow: rgba(0, 240, 255, 0.25);
    --profit-color: #00ff9d;
    --profit-glow: rgba(0, 255, 157, 0.25);
    --profit-bg: rgba(0, 255, 157, 0.08);
    --loss-color: #ff3366;
    --loss-glow: rgba(255, 51, 102, 0.25);
    --loss-bg: rgba(255, 51, 102, 0.08);
    --border: #2d313b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* --- Native App Feel: Disable Highlighting & Dragging --- */
body {
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE/Edge */
    user-select: none; /* Standard */
    -webkit-user-drag: none; /* Prevents dragging entire blocks */
}

/* Prevent image/icon dragging globally */
img, svg {
    -webkit-user-drag: none;
    user-drag: none;
}

/* Ensure inputs and textareas stay usable so you can still highlight your own typing */
input, textarea {
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    -ms-user-select: auto !important;
    user-select: auto !important;
}

/* --- THE EXCEPTION CLASS --- */
/* Add class="allow-select" to anything you want to be highlightable/copyable */
.allow-select {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    cursor: text;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    padding: 40px 20px;
    background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 30px 30px;
    min-height: 100vh;
}

.dashboard {
    width: 100%;
    max-width: 1600px; 
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    position: relative;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 0 10px var(--accent-glow);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.hamburger-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}
.hamburger-btn:hover { color: var(--accent); }

@media(max-width: 768px) {
    h1 {
        position: static;
        transform: none;
        font-size: 20px;
    }
}

.view-toggle {
    display: flex;
    background: #0f1115;
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--border);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.view-toggle button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
}

.view-toggle button.active {
    background: var(--panel-bg);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    border: 1px solid rgba(0, 240, 255, 0.2);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
    position: relative;
    overflow: hidden;
    /* NEW: Allows text inside to dynamically scale based on the card's width */
    container-type: inline-size; 
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.stat-title {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px; /* Back to fixed starting size */
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* --- Special Styling for Main PnL Card --- */
.stat-card-main {
    border: 1px solid rgba(0, 240, 255, 0.4);
    box-shadow: 0 8px 16px rgba(0, 240, 255, 0.08), inset 0 1px 0 rgba(255,255,255,0.05);
    background: linear-gradient(145deg, #1f2229, #111a24); /* Slight blue tint */
}

.stat-card-main::before {
    /* Changes the top highlight line to the accent color */
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.stat-card-main .stat-title {
    color: var(--accent);
    font-weight: bold;
}

.stat-card-main .stat-value {
    font-size: 30px; /* Main card starting size */
}

.split-layout {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 25px;
    align-items: stretch; 
}

/* Handles the squishing issue on smaller screens */
@media(max-width: 1100px) {
    .split-layout { grid-template-columns: 1fr; }
    .chart-container { min-height: 400px; }
}

.left-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.right-panel {
    background: var(--panel-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
    padding: 20px;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.chart-header {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chart-container {
    position: relative;
    flex: 1; 
    min-height: 300px; /* Acts as a safety fallback */
    width: 100%;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel-bg);
    padding: 15px 20px;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.month-nav button {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 6px;
    transition: 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.month-nav button:hover {
    background: rgba(255,255,255,0.08);
    border-color: var(--accent);
    color: var(--accent);
}

.month-display {
    font-size: 32px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255,255,255,0.1);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: var(--border);
    gap: 1px;
    border: 1px solid var(--border);
    /* Changed: Flattened the bottom corners so the footer attaches seamlessly */
    border-radius: 0; 
    border-bottom: none; 
    overflow: hidden;
    /* Removed the box-shadow from here so it doesn't double-up with the footer */
}

.day-name {
    background: #15171c;
    text-align: center;
    padding: 12px;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-muted);
    text-transform: uppercase;
}

.day-cell {
    background: var(--panel-bg);
    min-height: 110px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    /* NEW: Crucial fix! This stops the calendar grid columns from stretching */
    min-width: 0; 
    container-type: inline-size;
}

.day-cell:hover { background: var(--panel-bg-hover); }

.day-cell.empty {
    background-color: #0b0c10;
    cursor: default;
}

.day-cell.is-today { 
    /* Toned down from 2px solid to a softer 1px semi-transparent border */
    box-shadow: inset 0 0 0 2px rgba(0, 240, 255, 0.6); 
}

.cell-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: auto;
}

.day-number {
    font-size: 16px;
    color: var(--text-muted);
}

.is-today .day-number {
    color: var(--accent);
    font-weight: bold;
    /* Reduced the text glow from 8px down to 4px */
    text-shadow: 0 0 4px var(--accent-glow); 
}

.note-icon {
    font-size: 12px;
    opacity: 0.8;
    cursor: help;
}

.cell-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    margin-top: auto;
}

.trades-count {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.pnl-value {
    font-size: 16px; /* Calendar day starting size */
    font-weight: bold;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.profit-text { color: var(--profit-color); text-shadow: 0 0 8px var(--profit-glow); }
.loss-text { color: var(--loss-color); text-shadow: 0 0 8px var(--loss-glow); }
.profit-cell { background: var(--profit-bg); border-bottom: 3px solid var(--profit-color); }
.loss-cell { background: var(--loss-bg); border-bottom: 3px solid var(--loss-color); }

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    z-index: 1000; 
}

.modal {
    background: var(--panel-bg);
    padding: 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
    box-shadow: 0 0 30px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.05);
}

.modal h2 { margin-bottom: 20px; color: var(--accent); }
.modal-danger h2 { color: var(--loss-color); text-shadow: 0 0 10px var(--loss-glow); }

.input-row { display: flex; gap: 15px; margin-bottom: 20px; }
.input-group { flex: 1; margin-bottom: 20px; }
.input-row .input-group { margin-bottom: 0; }

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.input-group input, .input-group textarea {
    width: 100%;
    padding: 12px;
    background: #0b0c10;
    border: 1px solid var(--border);
    color: white;
    border-radius: 6px;
    font-size: 16px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
    transition: 0.2s;
    color-scheme: dark; 
}

input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

.input-group textarea { font-size: 14px; resize: vertical; }

.input-group input:focus, .input-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 0 8px var(--accent-glow);
}

.modal-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px;}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
    font-size: 14px;
}

.btn-cancel {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}
.btn-cancel:hover { background: rgba(255,255,255,0.05); }

.btn-save {
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 10px var(--accent-glow);
}
.btn-save:hover { background: #00e0ff; box-shadow: 0 0 15px var(--accent-glow); }

.btn-danger {
    background: transparent;
    color: var(--loss-color);
    border: 1px solid var(--loss-color);
}
.btn-danger:hover {
    background: var(--loss-bg);
    box-shadow: 0 0 10px var(--loss-glow);
}

.btn-danger-solid {
    background: var(--loss-color);
    color: white;
    box-shadow: 0 0 10px var(--loss-glow);
}
.btn-danger-solid:hover { background: #ff4d79; box-shadow: 0 0 15px var(--loss-glow); }

/* --- Settings Sidebar Styles --- */
.settings-sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 320px;
    height: 100vh;
    /* Use a solid color instead of the gradient variable here */
    background: #1f2229; 
    border-right: 1px solid var(--border);
    box-shadow: 10px 0 30px rgba(0,0,0,0.8);
    z-index: 200;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 25px;
}

.settings-sidebar.open { left: 0; } /* Slides in */

.sidebar-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.4); /* Slightly lighter dimming effect */
    /* backdrop-filter: blur(3px); <--- DELETED THIS LINE */
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 { color: var(--text-main); font-size: 20px; }

.close-sidebar-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}
.close-sidebar-btn:hover { color: var(--accent); }

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar-menu .btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

/* --- Highlight for Current Month Calendar --- */
.left-panel.is-current-month .calendar-header {
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 0 -4px 15px rgba(0, 240, 255, 0.05), inset 0 1px 0 rgba(255,255,255,0.05);
}

.left-panel.is-current-month .calendar-grid {
    border-color: rgba(0, 240, 255, 0.4);
    border-bottom: none; /* Keeps the seamless connection to the footer */
}

/* NEW: Apply the bottom glow to the footer instead of the grid */
.left-panel.is-current-month .calendar-footer {
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 0 8px 20px rgba(0, 240, 255, 0.1);
}

/* --- Calendar Footer Styles --- */
.calendar-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
    background: var(--panel-bg);
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 0 0 12px 12px; /* Bottom rounded corners live here now! */
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}

.calendar-footer .btn {
    font-size: 13px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-random {
    background: rgba(0, 240, 255, 0.1); 
    border: 1px solid var(--accent); 
    color: var(--accent);
    transition: 0.2s;
}

.btn-random:hover {
    background: rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 10px var(--accent-glow);
}

.project-list-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
    /* This allows the whole list to scroll if you have 10+, but not the items themselves */
    overflow-y: visible; 
}

.project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s ease;
    /* NEW: Ensures the item never forces an internal scrollbar */
    overflow: visible; 
    min-height: 48px;
}

.project-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 240, 255, 0.3);
}

.project-item.active-project {
    background: rgba(0, 240, 255, 0.08);
    border-color: var(--accent);
    box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.1);
}

.project-info {
    flex: 1;
    min-width: 0; /* Critical for text truncation */
    margin-right: 10px;
}

.project-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    /* NEW: If the name is super long, it adds '...' instead of pushing the buttons away */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-actions {
    position: relative;
    flex-shrink: 0; /* Ensures the buttons never get squished */
}

.more-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: 0.2s;
}

.more-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

.project-dropdown {
    position: absolute;
    right: 0;
    top: 100%; /* Puts it right below the button */
    margin-top: 5px;
    background: #1a1d23; /* Solid dark color to prevent transparency issues */
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    z-index: 999; /* Keeps it on top of everything */
    width: 140px;
    display: none;
    flex-direction: column;
    padding: 4px;
}

.project-dropdown.show {
    display: flex;
}

.dropdown-item {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-main);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}

.dropdown-item:hover {
    background: rgba(0, 240, 255, 0.1);
    color: var(--accent);
}

.dropdown-item.delete:hover {
    background: rgba(255, 51, 102, 0.1);
    color: #ff3366;
}

/* --- Empty State Styles --- */
.empty-state-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 60vh; /* Centers it perfectly on the screen */
    text-align: center;
    z-index: 10;
    pointer-events: auto; /* CRITICAL: This allows the new button to be clicked */
}

.empty-title {
    font-size: 56px;
    font-weight: 700;
    color: var(--text-main);
    text-shadow: 0 0 20px var(--accent-glow);
    letter-spacing: -1px;
    margin-bottom: 10px;
}

.empty-subtitle {
    font-size: 20px;
    color: var(--text-muted);
    font-weight: 500;
}

.curved-arrow {
    position: fixed; /* Detaches the arrows from the text */
    color: var(--accent);
    opacity: 0.9;
}

/* Pins exactly against the left edge of the monitor */
.left-arrow {
    top: 50%;
    left: 30px;
    animation: pointBounceLeft 1.5s infinite ease-in-out;
}

@keyframes pointBounceLeft {
    /* Uses translateY to keep it perfectly vertically centered while bouncing horizontally */
    0%, 100% { transform: translateY(-50%) translateX(35px); }
    50% { transform: translateY(-50%) translateX(-10px); }
}

/* --- Sidebar Ribbon Tab --- */
.sidebar-tab {
    position: absolute;
    top: 40px;
    right: -64px; 
    width: 64px;
    height: 76px; 
    
    /* THE FIX: Match the sidebar's solid background exactly */
    background: #1f2229; 
    
    border: 1px solid var(--border);
    border-left: none; 
    border-radius: 0 16px 16px 0; 
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 20px 4px 20px rgba(0,0,0,0.2);
    color: var(--text-main);
    z-index: 10; 
}

/* Add this to move the "Portfolios" title down slightly so it aligns with the tab */
.sidebar-header {
    margin-top: 10px; 
}

.sidebar-tab svg {
    width: 34px;  
    height: 34px;
    transition: transform 0.3s ease;
}

.settings-sidebar.open .sidebar-tab svg {
    transform: rotate(90deg);
}

/* --- LANDING PAGE STYLES --- */
.landing-page {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 80vh;
}

.landing-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 60px;
}

.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: 40px;
}

.hero-title {
    font-size: 64px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 25px;
    letter-spacing: -2px;
    position: static; /* Overrides your dashboard h1 settings */
    transform: none;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-muted);
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 40px;
}

.hero-btn {
    font-size: 18px;
    padding: 15px 35px;
    border-radius: 8px;
}

.hero-preview {
    margin-top: 60px;
    width: 100%;
    max-width: 800px;
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    /* Creates a cool fade-out effect at the bottom so it looks like a sneak peek */
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

@keyframes spin { 
    to { transform: rotate(360deg); } 
}