/* ===== CSS Variables (Theming) ===== */
:root {
    --bg-body: #0b0d11;
    --bg-card: #14181f;
    --bg-input: #1a1d24;
    --border-color: #2a2d36;
    --border-light: #1f2630;
    --text-primary: #e8eaf0;
    --text-secondary: #8b8fa3;
    --text-muted: #6b7080;
    --text-body: #b0b5c5;
    --shadow: rgba(0,0,0,0.6);
    --accent: #4F8CFF;
    --green: #00FF9D;
    --red: #FF4D6D;
    --header-bg: rgba(11,13,17,0.95);
    --suggestion-bg: #1e1e2f;
    --suggestion-border: #333;
}

/* Light theme overrides */
body.light-mode {
    --bg-body: #f5f7fa;
    --bg-card: #ffffff;
    --bg-input: #f0f2f5;
    --border-color: #d0d5dd;
    --border-light: #e2e6ec;
    --text-primary: #1a1d24;
    --text-secondary: #4a4f5a;
    --text-muted: #6b7080;
    --text-body: #2d313a;
    --shadow: rgba(0,0,0,0.1);
    --header-bg: rgba(255,255,255,0.95);
    --suggestion-bg: #ffffff;
    --suggestion-border: #d0d5dd;
}

/* ===== Reset & Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    padding-top: 70px;
    transition: background 0.3s, color 0.3s;
}

/* ===== Header ===== */
.public-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: var(--header-bg);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    transition: background 0.3s, border-color 0.3s;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}
.logo-img { height: 40px; }
.header-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-right: 1.5rem;
    font-size: 0.95rem;
    transition: color 0.2s;
}
.header-nav a:hover,
.header-nav a.active {
    color: var(--text-primary);
}
.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.auth-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
}
.auth-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.auth-btn-primary:hover { background: #3a7ae0; }

.selector-area {
    max-width: 800px;
    margin: 2rem auto 1rem;
    padding: 0 1rem;
}
.selector-inner {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content:center;
}

.form-group {
     max-width:340px;
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    position: relative;
}
.form-group label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
     text-align:left;
    font-size:.82rem;
    font-weight:700;
    letter-spacing:1.2px;
    margin-bottom:6px;
}
.form-group select,
.form-group input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    outline: none;
    width: 100%;
    transition: background 0.3s, border-color 0.3s, color 0.3s;
    height:48px;
    border-radius:10px;
    font-size:15px;
    font-weight:500;
}
.form-group select:disabled,
.form-group input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--suggestion-bg);
    border: 1px solid var(--suggestion-border);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
    box-shadow: 0 8px 20px var(--shadow);
    display: none;
}
.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
}
.suggestion-item:hover {
    background: var(--border-light);
}
.suggestion-name {
    color: var(--text-primary);
}
.suggestion-ticker {
    color: var(--text-muted);
    font-size: 0.85em;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Data Cards ===== */
.data-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin: 1.5rem auto;
    max-width: 1200px;
    transition: background 0.3s, border-color 0.3s;
}
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem 1.5rem;
}
.overview-item {
    display: flex;
    flex-direction: column;
}
.overview-item .label{
    font-size:11px;
    font-weight:700;
    letter-spacing:.9px;
    text-transform:uppercase;
    color:var(--text-muted);
}
.overview-item .value{
    font-size:20px;
    font-weight:700;
    line-height:1.35;
    color:var(--text-primary);
    word-break:break-word;
    overflow-wrap:anywhere;
}
.overview-item .value.positive { color: var(--green); }
.overview-item .value.negative { color: var(--red); }

/* ===== Metrics Grid ===== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    max-width: 1200px;
    margin: 1rem auto;
}
.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    transition: background 0.3s, border-color 0.3s;
}
.metric-card .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
}
.metric-card .value {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.2rem;
    color: var(--text-primary);
}
.metric-card .value.positive { color: var(--green); }
.metric-card .value.negative { color: var(--red); }

/* ===== Company Details ===== */
.company-details {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.company-details .summary,
.company-details .info {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.5rem;
    transition: background 0.3s, border-color 0.3s;
}
.company-details .summary h3 {
    margin-bottom: 0.8rem;
    color: var(--text-primary);
}
.company-details .summary p {
    line-height: 1.6;
    color: var(--text-body);
}
.company-details .info ul {
    list-style: none;
    padding: 0;
}
.company-details .info li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-body);
}
.company-details .info li:last-child { border-bottom: none; }
.company-details .info .label {
    color: var(--text-muted);
    font-size: 0.8rem;
    display: inline-block;
    width: 120px;
}

/* ===== Feature Locks ===== */
.feature-locks {
    max-width: 1200px;
    margin: 3rem auto 2rem;
    padding: 0 1rem;
    text-align: center;
}
.feature-locks h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}
.feature-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}
.feature-tile {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 130px;
    color: var(--text-primary);
}
.feature-tile:hover {
    background: var(--border-light);
    border-color: var(--accent);
    transform: translateY(-3px);
}
.feature-cta {
    margin-top: 1.5rem;
    color: var(--text-secondary);
}
.feature-cta a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.feature-cta a:hover { text-decoration: underline; }

/* ===== Welcome Message ===== */
.welcome-message {
    text-align: center;
    padding: 4rem 1rem;
    max-width: 600px;
    margin: 0 auto;
}
.welcome-message h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}
.welcome-message p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ===== Responsive (Mobile) ===== */
@media (max-width: 768px) {
    .public-header {
        padding: 0 1rem;
        height: 60px;
        flex-wrap: wrap;
    }
    .header-left {
        gap: 0.5rem;
    }
    .header-nav a {
        font-size: 0.8rem;
        margin-right: 0.8rem;
    }
    .logo-img { height: 32px; }
    .header-right {
        gap: 0.4rem;
    }
    .auth-btn {
        padding: 0.3rem 0.8rem;
        font-size: 0.75rem;
    }
    .selector-inner{
        flex-direction:column;
        align-items:center;
        justify-content:center;
        gap:18px;
    }
    .form-group{
        flex:none;
        width:100%;
        max-width:330px;
    }
    .data-card {
        padding: 1rem;
        margin: 1rem 0.5rem;
    }
    .overview-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.3rem 0.8rem;
    }
    .overview-item .value {
        font-size: 1rem;
    }
    .metrics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        padding: 0 0.5rem;
    }
    .company-details {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 0.5rem;
    }
    .company-details .summary,
    .company-details .info {
        padding: 1rem;
    }
    .company-details .info .label {
        width: 80px;
    }
    .feature-tile {
        min-width: 100px;
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    .welcome-message h2 {
        font-size: 1.5rem;
    }
    .suggestions-box {
        max-height: 150px;
    }
    .suggestion-item {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .overview-grid {
        grid-template-columns: 1fr;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .header-nav a {
        margin-right: 0.5rem;
        font-size: 0.7rem;
    }
    .auth-btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }
}