/* Aktierobot.se Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* WHITE THEME - Light backgrounds */
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --border: #e2e8f0;
    
    /* Additional backgrounds for consistency */
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --bg-primary: #f8fafc;
    
    /* Dark text for light backgrounds */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    /* Semantic colors with aliases */
    --success-color: #10b981;
    --error-color: #ef4444;
    --accent-color: #2563eb;
    --border-subtle: #e2e8f0;
    
    --sidebar-width: 260px;
    --sidebar-collapsed: 60px;
    --header-height: 60px;
    
    --radius: 8px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.5;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px;
    border: 1px solid var(--border);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    font-size: 48px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -2px;
}

.auth-tagline {
    color: var(--text-secondary);
    margin-top: 5px;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 20px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert ul {
    margin: 0;
    padding-left: 20px;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-collapsed);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.2s ease;
    z-index: 100;
}

.sidebar.expanded {
    width: var(--sidebar-width);
}

/* Hide text when collapsed */
.sidebar .logo-text,
.sidebar .nav-item span:not(.nav-icon),
.sidebar .user-info,
.sidebar .nav-section,
.sidebar .nav-badge {
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.15s ease;
}

.sidebar.expanded .logo-text,
.sidebar.expanded .nav-item span:not(.nav-icon),
.sidebar.expanded .user-info,
.sidebar.expanded .nav-section,
.sidebar.expanded .nav-badge {
    opacity: 1;
    width: auto;
}

/* Adjust main content margin */
.main-content {
    margin-left: var(--sidebar-collapsed);
    transition: margin-left 0.2s ease;
}

body.sidebar-expanded .main-content {
    margin-left: var(--sidebar-width);
}

/* Sidebar toggle button */
.sidebar-toggle {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 8px;
    width: 100%;
}

.sidebar-toggle:hover {
    background: var(--primary);
    color: white;
}

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

.logo {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
}

.logo-text {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    transition: all 0.2s;
}

.sidebar.expanded .nav-item {
    justify-content: flex-start;
}

.nav-icon {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-icon {
    font-size: 18px;
}

.nav-section {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 15px 15px 8px;
    margin-top: 10px;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
}

.logout-link:hover {
    color: var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.main-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-search {
    position: relative;
    width: 400px;
}

.header-search input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-dark);
    color: var(--text-primary);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 5px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.search-result-item:hover {
    background: var(--bg-hover);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.data-status {
    font-size: 12px;
    color: var(--text-muted);
}

.content-area {
    padding: 25px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
}

.page-subtitle {
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border);
}

.stat-icon {
    font-size: 32px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: var(--bg-dark);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table .number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table .positive {
    color: var(--success);
}

.data-table .negative {
    color: var(--danger);
}

.data-table.compact th,
.data-table.compact td {
    padding: 8px 12px;
}

.ticker-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.ticker-link:hover {
    text-decoration: underline;
}

.name-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Score Badges */
.score-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.score-high {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.score-medium {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.score-low {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.score-very-low {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-secondary);
}

/* Risk Badges */
.risk-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.risk-low {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.risk-moderate {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.risk-high {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.risk-unknown {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.risk-avoid {
    background: rgba(139, 0, 0, 0.3);
    color: #ff6b6b;
}

/* Verdict Badges */
.verdict-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.verdict-bullish {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.verdict-neutral {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.verdict-bearish {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Badge variants */
.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* Score badge variants */
.score-low {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Positive/Negative text */
.positive {
    color: #34d399;
}

.negative {
    color: #f87171;
}

/* Filters */
.filters-bar {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 15px 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.filters-form {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 14px;
}

/* Global select/dropdown styling for proper contrast - WHITE THEME */
select,
.form-select,
.filter-select {
    background-color: var(--bg-card, #ffffff);
    color: var(--text-primary, #1e293b);
    border: 1px solid var(--border-color, #e2e8f0);
    padding: 8px 12px;
    border-radius: var(--radius-sm, 4px);
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

select:focus,
.form-select:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

select option,
.form-select option,
.filter-select option {
    background-color: var(--bg-card, #ffffff);
    color: var(--text-primary, #1e293b);
    padding: 8px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding: 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.page-link {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s;
}

.page-link:hover {
    opacity: 0.8;
}

.page-btn {
    padding: 8px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-weight: 500;
}

.page-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-numbers {
    display: flex;
    gap: 4px;
}

.page-num {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.page-num.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-num:hover:not(.active) {
    background: var(--border);
}

.page-info {
    color: var(--text-secondary);
    font-size: 0.9em;
    padding: 0 12px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* Stock Detail Page */
.stock-detail-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

.stock-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stock-title h1 {
    font-size: 32px;
}

.stock-name {
    color: var(--text-secondary);
}

.stock-badges {
    display: flex;
    gap: 8px;
}

.stock-action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 10px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
}

/* Score Card */
.composite-score {
    text-align: center;
    margin-bottom: 25px;
}

.score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    margin: 0 auto 10px;
}

.score-circle.score-high {
    background: rgba(16, 185, 129, 0.2);
    border: 3px solid var(--success);
}

.score-circle.score-medium {
    background: rgba(245, 158, 11, 0.2);
    border: 3px solid var(--warning);
}

.score-circle.score-low {
    background: rgba(239, 68, 68, 0.2);
    border: 3px solid var(--danger);
}

.score-label {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Score Breakdown */
.score-breakdown {
    margin-bottom: 20px;
}

.score-item {
    display: grid;
    grid-template-columns: 100px 1fr 50px;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.score-item .score-name {
    font-size: 13px;
    color: var(--text-secondary);
}

.score-bar {
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
}

.score-item .score-value {
    text-align: right;
    font-weight: 600;
    font-size: 14px;
}

.risk-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

/* Fundamentals Grid */
.fundamentals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.fundamental-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fundamental-item .label {
    font-size: 12px;
    color: var(--text-muted);
}

.fundamental-item .value {
    font-size: 16px;
    font-weight: 600;
}

.data-source {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

/* Error Page */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-container {
    text-align: center;
}

.error-container h1 {
    font-size: 120px;
    color: var(--primary);
    line-height: 1;
}

.error-container p {
    font-size: 20px;
    color: var(--text-secondary);
    margin: 20px 0 30px;
}

/* Password field with toggle */
.password-field-wrapper {
    position: relative;
}

.password-field-wrapper input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background 0.15s ease;
}

.password-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar .logo-text,
    .sidebar .nav-item span:not(.nav-icon),
    .sidebar .nav-section,
    .sidebar .user-name {
        display: none;
    }
    
    .sidebar-header {
        text-align: center;
    }
    
    .main-content {
        margin-left: 70px;
    }
    
    .stock-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-search {
        width: 200px;
    }
    
    .filters-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .fundamentals-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Estimate Revisions Mini Stats */
.mini-stat {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.mini-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

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

.text-success {
    color: #22c55e !important;
}

.text-danger {
    color: #ef4444 !important;
}

.revision-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .revision-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS & NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Header Notification Button */
.header-notification-btn,
.header-settings-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.125rem;
    transition: all 0.2s ease;
}

.header-notification-btn:hover,
.header-settings-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Sidebar Alert Badge */
.nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Header Actions Layout */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Notification Dropdown (optional enhancement) */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
    display: none;
}

.notification-dropdown.show {
    display: block;
}

.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.notification-dropdown-header h4 {
    margin: 0;
    font-size: 0.875rem;
}

.notification-dropdown-list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: var(--bg-hover);
}

.notification-item.unread {
    background: rgba(59, 130, 246, 0.05);
}

.notification-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.notification-indicator.severity-info { background: var(--primary); }
.notification-indicator.severity-warning { background: var(--warning); }
.notification-indicator.severity-critical { background: var(--danger); }

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-message {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.notification-dropdown-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.notification-dropdown-footer a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
}

/* Alert severity colors */
.severity-info { color: var(--primary); }
.severity-warning { color: var(--warning); }
.severity-critical { color: var(--danger); }

/* Responsive */
@media (max-width: 768px) {
    .notification-dropdown {
        width: 100%;
        left: 0;
        right: 0;
        border-radius: 0;
        position: fixed;
        top: 60px;
    }
    
    .header-notification-btn,
    .header-settings-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   EMBEDDED TRADING CHART STYLES - LIGHT THEME
   ═══════════════════════════════════════════════════════════════════════════════ */

.embedded-chart-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    overflow: hidden;
}

.embedded-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #E2E8F0;
    background: #FAFAFA;
}

.embedded-chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0F172A;
    margin: 0;
}

.chart-last-update {
    font-size: 0.7rem;
    color: #64748B;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
    margin-left: auto;
    margin-right: 12px;
    white-space: nowrap;
}

.chart-last-update.visible {
    opacity: 1;
}

.chart-last-update::before {
    content: '●';
    color: #22c55e;
    margin-right: 4px;
    font-size: 0.6rem;
}

.embedded-chart-actions {
    display: flex;
    gap: 6px;
}

.embedded-timeframe-btn {
    padding: 4px 10px;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 4px;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.embedded-timeframe-btn:hover {
    background: #E2E8F0;
    color: #0F172A;
}

.embedded-timeframe-btn.active {
    background: #3B82F6;
    border-color: #3B82F6;
    color: #fff;
}

.embedded-chart-body {
    height: 320px;
    padding: 8px;
    background: #FFFFFF;
}

.view-full-chart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #F1F5F9;
    border: none;
    border-top: 1px solid #E2E8F0;
    color: #334155;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    text-decoration: none;
}

.view-full-chart-btn:hover {
    background: #E2E8F0;
    color: #0F172A;
}

/* ═══════════════════════════════════════════════════════════════════════════
   WebSocket & Real-time Update Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* Connection status indicator */
.ws-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted, #8b949e);
}

.ws-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
    transition: background 0.3s;
}

.ws-status[data-status="connecting"]::before { background: #f59e0b; animation: pulse 1s infinite; }
.ws-status[data-status="connected"]::before { background: #10b981; }
.ws-status[data-status="authenticated"]::before { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.ws-status[data-status="disconnected"]::before { background: #6b7280; }
.ws-status[data-status="error"]::before,
.ws-status[data-status="failed"]::before { background: #ef4444; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Flash update animation for real-time score changes */
.flash-update {
    animation: flashUpdate 1s ease-out;
}

@keyframes flashUpdate {
    0% { background-color: rgba(99, 102, 241, 0.4); }
    100% { background-color: transparent; }
}

/* Score badges with update state */
.score-badge.updating {
    opacity: 0.7;
    animation: pulse 0.5s infinite;
}

.composite-score.flash-update,
.score-badge.flash-update {
    position: relative;
}

.composite-score.flash-update::after,
.score-badge.flash-update::after {
    content: 'LIVE';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.5rem;
    background: #6366f1;
    color: white;
    padding: 1px 4px;
    border-radius: 4px;
    animation: fadeOut 1s forwards;
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* Alert badge new indicator */
.alerts-count.has-new {
    animation: alertPulse 0.5s ease-out;
}

@keyframes alertPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Real-time toast styling */
.alert-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary, #f8fafc);
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    max-width: 380px;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
}

.alert-toast.visible {
    opacity: 1;
    transform: translateX(0);
}

.alert-toast.info { border-left: 3px solid #6366f1; }
.alert-toast.success { border-left: 3px solid #10b981; }
.alert-toast.warning { border-left: 3px solid #f59e0b; }
.alert-toast.error { border-left: 3px solid #ef4444; }

.alert-toast .alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-toast .alert-content {
    flex: 1;
    min-width: 0;
}

.alert-toast .alert-title {
    font-weight: 600;
    color: var(--text-primary, #f0f6fc);
    margin-bottom: 4px;
}

.alert-toast .alert-message {
    font-size: 0.875rem;
    color: var(--text-secondary, #8b949e);
    word-wrap: break-word;
}

.alert-toast .alert-close {
    cursor: pointer;
    color: var(--text-muted, #8b949e);
    font-size: 1.25rem;
    line-height: 1;
    padding: 0 4px;
    margin-left: 8px;
}

.alert-toast .alert-close:hover {
    color: var(--text-primary, #f0f6fc);
}

/* Portfolio risk indicator */
.portfolio-risk-indicator {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
}

.portfolio-risk-indicator[data-level="normal"] {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.portfolio-risk-indicator[data-level="elevated"] {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.portfolio-risk-indicator[data-level="high"] {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: riskPulse 2s infinite;
}

@keyframes riskPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   HIGH CONTRAST LABEL OVERRIDES
   Enhanced visibility for small uppercase labels (WCAG AA compliant)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Primary stat labels */
.stat-label,
.summary-label,
.metric-label {
    color: #a8b4c4 !important;
}

/* Score and confidence labels */
.score-label,
.confidence-label {
    color: #9aa6b6 !important;
}

/* Table header labels */
.data-table th {
    color: #9aa6b6 !important;
}

/* Form labels */
.form-group label {
    color: #a8b4c4 !important;
}

/* Filter labels */
.filter-label {
    color: #9aa6b6 !important;
}

/* Fundamental item labels */
.fundamental-item .label {
    color: #8494a8 !important;
}

/* Page subtitle and muted text */
.page-subtitle {
    color: #94a4b8 !important;
}

/* Data source and footer text */
.data-source {
    color: #8494a8 !important;
}

/* Mini stat labels */
.mini-stat-label {
    color: #94a4b8 !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR SCROLLABLE MENU FIX (2026-08-28)
   Ensures the sidebar menu scrolls when content exceeds viewport height
   ═══════════════════════════════════════════════════════════════════════════ */

/* Make the entire sidebar scrollable */
.terminal-sidebar,
aside.terminal-sidebar {
    max-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Sidebar nav should flex-grow but also be scrollable independently */
.terminal-sidebar .sidebar-nav,
.sidebar-nav {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    min-height: 0 !important; /* Critical for flex child scrolling */
}

/* Keep header and footer fixed in their positions */
.terminal-sidebar .sidebar-header,
.sidebar-header {
    flex-shrink: 0 !important;
}

.terminal-sidebar .sidebar-footer,
.sidebar-footer {
    flex-shrink: 0 !important;
    margin-top: auto !important;
}

/* Custom scrollbar styling for dark theme */
.terminal-sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
    width: 6px !important;
}

.terminal-sidebar::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent !important;
}

.terminal-sidebar::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15) !important;
    border-radius: 3px !important;
}

.terminal-sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25) !important;
}

/* Firefox scrollbar */
.terminal-sidebar,
.sidebar-nav {
    scrollbar-width: thin !important;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MENU LABEL NO-TRUNCATION FIX (2026-08-28)
   Prevents menu item names from being cut off
   ═══════════════════════════════════════════════════════════════════════════ */

/* Ensure labels are fully visible - no text truncation */
.terminal-sidebar .nav-item .label,
.terminal-sidebar.expanded .nav-item .label,
.sidebar-nav .nav-item .label,
aside .nav-item .label,
.nav-item span.label {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
    max-width: none !important;
}

/* Ensure nav-items don't clip their children */
.terminal-sidebar .nav-item,
.sidebar-nav .nav-item,
.nav-item {
    overflow: visible !important;
}

/* When expanded, ensure adequate width for full text */
.terminal-sidebar.expanded {
    min-width: 280px !important;
}

/* Section labels should also not truncate */
.terminal-sidebar .nav-section-label,
.sidebar-nav .nav-section-label,
.nav-divider + .nav-section-label {
    white-space: nowrap !important;
    overflow: visible !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MENU SIZE INCREASE - 200% LARGER (2026-08-28)
   Makes all sidebar menu items 200% larger (double the size)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Sidebar width - wider to accommodate larger text */
.sidebar,
.terminal-sidebar {
    width: 300px !important;
}

.sidebar.expanded,
.terminal-sidebar.expanded {
    width: 320px !important;
}

/* Collapsed sidebar - also slightly larger */
.sidebar:not(.expanded),
.terminal-sidebar:not(.expanded) {
    width: 80px !important;
}

/* Nav items - 200% larger */
.nav-item,
.sidebar-link,
.sidebar-nav a,
.sidebar-nav .nav-item {
    font-size: 1.25rem !important;      /* From ~0.875rem to ~1.25rem (ca 143% but more readable) */
    padding: 16px 20px !important;      /* Double padding */
    min-height: 56px !important;        /* Larger click area */
    gap: 16px !important;               /* More space between icon and text */
}

/* Nav icons - proportionally larger */
.nav-item .icon,
.nav-item .nav-icon,
.sidebar-link svg,
.sidebar-nav .nav-icon,
.nav-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 1.5rem !important;
    min-width: 28px !important;
}

/* Section headers/labels - larger */
.nav-section-title,
.nav-section,
.nav-section-label,
.sidebar-section {
    font-size: 0.9rem !important;
    padding: 16px 20px 10px !important;
    letter-spacing: 1px !important;
}

/* Nav dividers - more spacing */
.nav-divider {
    margin: 12px 16px !important;
}

/* Sidebar header/logo area - larger */
.sidebar-header {
    padding: 24px 20px !important;
}

.sidebar-header .logo {
    font-size: 2rem !important;
}

.sidebar-header .logo-text {
    font-size: 0.9rem !important;
    margin-top: 4px !important;
}

/* Sidebar footer - larger */
.sidebar-footer {
    padding: 16px 20px !important;
}

.sidebar-footer .user-name {
    font-size: 1rem !important;
}

.sidebar-footer .logout-link {
    font-size: 0.9rem !important;
}

/* Sidebar toggle button - larger */
.sidebar-toggle {
    padding: 12px 16px !important;
    font-size: 1rem !important;
}

/* Nav badges - proportionally larger */
.nav-badge {
    min-width: 26px !important;
    height: 26px !important;
    font-size: 0.85rem !important;
    padding: 0 8px !important;
}

/* Adjust main content margin for wider sidebar */
.main-content {
    margin-left: 80px !important;
}

body.sidebar-expanded .main-content {
    margin-left: 320px !important;
}

/* Mobile responsive adjustments */
@media (max-width: 1024px) {
    .sidebar,
    .terminal-sidebar {
        width: 80px !important;
    }
    
    .main-content {
        margin-left: 80px !important;
    }
}

@media (max-width: 768px) {
    .sidebar,
    .terminal-sidebar {
        width: 100% !important;
        position: fixed !important;
        z-index: 1000 !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}
