/* =========================================
   NEPSE ANALYST TERMINAL - MASTER STYLESHEET
   ========================================= */

:root {
    /* Centralized Color Palette */
    --glass: rgba(15, 23, 42, 0.85);
    --accent: #22d3ee;
    --text: #f1f5f9;
    --text-muted: #cbd5e1;
    --profit: #10b981;
    --loss: #ef4444;
    --symbol: #3b82f6;
    --border: rgba(255, 255, 255, 0.1);
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

/* Update your body selector in homePage.css */
body {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    /* Set a dark fallback color while JS loads the random image */
    background-color: #0f172a; 
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* --- UTILITIES & SEARCH --- */
.hidden-links { display: none; }

#date { 
    color: var(--accent); 
    letter-spacing: 2px; 
    margin-bottom: 30px; 
    font-weight: 600; 
}

.search-container { 
    width: 100%; 
    max-width: 800px; 
    margin-bottom: 40px; 
}

.search-container input {
    width: 100%; 
    padding: 15px 25px; 
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.2);
    background: var(--glass); 
    backdrop-filter: blur(5px); 
    color: white; 
    font-size: 1.1rem; 
    outline: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* --- BUTTONS --- */
.see-more-btn {
    margin-top: auto; 
    background: rgba(34, 211, 238, 0.1);
    color: var(--accent);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 5px;
    padding: 8px 15px;
    font-size: 0.85rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

/* Hover effects only apply to devices with a mouse (prevents mobile sticky tap bugs) */
@media (max-width: 768px) {
    .term-table {
        font-size: 0.75rem; /* Shrink text slightly for mobile data density */
    }
    .term-table th, .term-table td {
        padding: 8px 10px; /* Tighter padding */
    }
}

/* --- PREMIUM ANALOG CLOCK --- */
.analog-clock {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(10, 15, 25, 0.7); 
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px); 
    position: relative;
    margin-bottom: 15px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6), 0 4px 15px rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.clock-tick {
    position: absolute; width: 2px; height: 8px;
    background: rgba(255, 255, 255, 0.3);
    top: 4px; left: 50%; transform-origin: 50% 76px;
}

.clock-tick.main-tick {
    width: 3px; height: 12px; background: var(--accent);
    box-shadow: 0 0 5px var(--accent);
}

.hand {
    position: absolute; bottom: 50%; left: 50%;
    transform-origin: bottom center; border-radius: 10px;
    z-index: 10; transition: transform 0.05s cubic-bezier(0.4, 2.08, 0.55, 0.44); 
}

.hour-hand { width: 4px; height: 40px; background: #ffffff; margin-left: -2px; box-shadow: 0 0 4px rgba(0,0,0,0.5); }
.minute-hand { width: 3px; height: 60px; background: var(--text-muted); margin-left: -1.5px; box-shadow: 0 0 4px rgba(0,0,0,0.5); }
.second-hand { width: 2px; height: 70px; background: var(--accent); margin-left: -1px; z-index: 11; box-shadow: 0 0 6px var(--accent); }
.second-hand::after {
    content: ''; position: absolute; width: 2px; height: 15px;
    background: var(--accent); bottom: -15px; left: 0; border-radius: 2px;
}

.center-dot {
    position: absolute; width: 10px; height: 10px;
    background: #1e293b; border: 2px solid var(--accent);
    border-radius: 50%; z-index: 12; box-shadow: 0 0 10px var(--accent);
}

/* --- DASHBOARD LAYOUT (Upgraded to CSS Grid) --- */
.dashboard {
    display: grid;
    /* Auto-fits as many 290px columns as possible, ensuring perfect alignment */
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 25px;
    max-width: 1300px;
    margin: 0 auto 40px auto;
    width: 100%;
}

.category {
    position: relative;
    min-height: 350px; 
    width: 100%; /* Now controlled by the grid */
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cat-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1; background-size: cover; background-position: center;
    filter: brightness(0.4) saturate(1.2);
}

.cat-content {
    position: relative; z-index: 2; padding: 20px;
    height: 100%; min-height: 350px; 
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.8) 100%);
    display: flex; flex-direction: column;
}

.category h2 {
    font-size: 0.9rem; color: var(--accent); text-transform: uppercase;
    letter-spacing: 1px; margin-bottom: 15px;
    border-bottom: 1px solid rgba(34, 211, 238, 0.3); padding-bottom: 5px;
}

.links { list-style: none; }
.links li { margin-bottom: 8px; }
.links a {
    color: var(--text-muted); text-decoration: none;
    font-size: 0.95rem; display: block; padding: 5px 0; transition: 0.2s;
}
.links a:hover { color: white; padding-left: 5px; }

/* --- TERMINAL GREETING --- */
.terminal-greeting {
    text-align: center; margin: 0 auto; padding: 25px;
    background: var(--glass); backdrop-filter: blur(8px); 
    border: 1px solid var(--border); border-radius: 12px;
    width: 100%; max-width: 800px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4); 
}

.terminal-greeting h1 { font-size: 2rem; color: var(--text); margin-bottom: 8px; font-weight: 600; letter-spacing: 1px; }
.terminal-greeting .highlight { color: var(--accent); text-shadow: 0 0 10px rgba(34, 211, 238, 0.4); }
.terminal-greeting p { font-size: 0.95rem; color: var(--text-muted); font-family: monospace; }

/* --- ACTIVE PORTFOLIO TABLE WIDGET --- */
.portfolio-widget {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(20, 25, 35, 0.7); 
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Responsive Table Container with Custom Scrollbar */
.table-container {
    width: 100%;
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    border-radius: 6px;
    border: 1px solid #334155; 
}

/* Custom Webkit Scrollbar */
.table-container::-webkit-scrollbar { height: 8px; }
.table-container::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.5); border-radius: 4px; }
.table-container::-webkit-scrollbar-thumb { background: rgba(34, 211, 238, 0.5); border-radius: 4px; }
.table-container::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.term-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px; /* Prevents column squishing */
    text-align: left;
}

.term-table th, .term-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #334155;
}

/* --- THE STICKY TICKER COLUMN (Bulletproof Mobile Fix) --- */
.term-table th:first-child,
.term-table td:first-child {
    position: -webkit-sticky; /* CRITICAL: Forces iPhones to respect the sticky layout */
    position: sticky;
    left: 0;
    /* Ensure this matches your table's background exactly so text doesn't vanish */
    background-color: #141923; 
    z-index: 10; /* Bumped up to ensure it never hides behind other scrolling data */
    border-right: 2px solid #334155; 
}

/* Ensure the top-left header stays above absolutely everything */
.term-table th:first-child {
    z-index: 11; 
}

/* Table Typography & Colors */
.loading-text { text-align: center; color: var(--text-muted); font-style: italic; padding: 30px !important; }
.profit { color: var(--profit); font-weight: bold; }
.loss { color: var(--loss); font-weight: bold; }
.symbol-badge { font-weight: 800; color: var(--symbol); }

/* --- MOBILE SPECIFIC TWEAKS --- */
@media (max-width: 768px) {
    .cat-content { padding: 12px !important; }
    
    #portfolio-summary span {
        display: block;
        margin-bottom: 6px;
        margin-right: 0 !important;
    }
    #portfolio-summary span:last-child { margin-bottom: 0; }
}



/* --- TRADER REMINDERS & RULES WIDGET --- */
.remember-points-widget {
    grid-column: 1 / -1;
    margin-top: 20px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(20, 25, 35, 0.7); /* Perfect match with portfolio-widget */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.remember-points-content {
    padding: 20px;
    position: relative;
    z-index: 2;
}

.remember-points-title {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    color: var(--accent); /* Uses cyan terminal accent */
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.rule-card {
    background: rgba(15, 23, 42, 0.5); /* Semi-transparent terminal background */
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.rule-card .card-tag {
    font-weight: bold;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 6px;
}

/* Color codes mapping to your CSS Theme Palette */
.rule-card .card-tag.risk { color: var(--loss); }        /* Red */
.rule-card .card-tag.execution { color: var(--profit); } /* Green */
.rule-card .card-tag.psychology { color: var(--symbol); } /* Blue */

.rule-card p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
}


/* --- TRADER REMINDERS WIDGET CONFIG --- */
.remember-points-widget {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(20, 25, 35, 0.7); 
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.remember-points-title {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    color: var(--accent);
}

.rules-grid {
    display: grid;
    /* Clean grid matrix: tracks flex smoothly across varying resolutions */
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 20px;
    width: 100%;
}

.rule-card {
    background: rgba(15, 23, 42, 0.6);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.rule-card .card-tag {
    font-weight: 800;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Color Palette Pipeline overrides */
.rule-card .card-tag.risk { color: var(--loss); }
.rule-card .card-tag.execution { color: var(--profit); }
.rule-card .card-tag.psychology { color: var(--symbol); }
.rule-card .card-tag.mistake { color: #f97316; }  /* Alert Orange */
.rule-card .card-tag.system { color: #a855f7; }   /* Dev Purple */

.rule-card p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
}
