/* Smart Dashboard Loader */

/* Prevent scrolling when dashboard loader is active */
body.dashboard-loader-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Optional: Add smooth transition */
body {
    transition: overflow 0.3s ease;
}

.dashboard-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.dashboard-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Add this too */
}

.dashboard-loader-content {
    text-align: center;
    max-width: 300px;
    padding: 20px;
}

.dashboard-loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.dashboard-loader-text {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.dashboard-loader-subtext {
    font-size: 14px;
    color: #7f8c8d;
    line-height: 1.4;
}

.dashboard-loader-progress {
    width: 100%;
    height: 4px;
    background: #ecf0f1;
    border-radius: 2px;
    margin-top: 15px;
    overflow: hidden;
}

.dashboard-loader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading states for dashboard elements */
.dashboard-loading .stat-card,
.dashboard-loading .dashboard-card {
    opacity: 0.6;
    pointer-events: none;
}

/* Exchange rate specific loading */
.exchange-rate-loading {
    position: relative;
}

.exchange-rate-loading::after {
    content: '🔄';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 12px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Full row card for historical chart */
.full-row-card {
    grid-column: 1 / -1;
    width: 100%;
}

/* Adjust grid layout for different screen sizes */
@media (min-width: 600px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .full-row-card {
        grid-column: 1 / -1;
    }
}

@media (min-width: 900px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .full-row-card {
        grid-column: 1 / -1;
    }
}

/* Ensure the chart container in full-row card is properly sized */
.full-row-card .chart-container {
    height: 250px;
}

/* Portfolio History Chart Styles */
.chart-period-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    justify-content: center;
}

.period-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: black;
}

.period-btn.active {
    background: #158c74;
    color: white;
    border-color: #158c74;
}

.period-btn:hover:not(.active) {
    background: #e9f5ff;
    border-color: #e9f5ff;
    color: black;
}

.history-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
    gap: 10px;
}

.stat-item {
    text-align: center;
    flex: 1;
    min-width: 80px;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

/* Chart container adjustments */
.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

/* ===== HEADER License Badge ===== */
.header span.premium {
    position: absolute;
    right: 10px;
    top: 15px;
    transform: none; /* Removed translateY(-50%) */
    background-color: rgba(255, 225, 225, 0.22);
    padding: 2px 10px 2px 20px;
    border-radius: 15px;
    font-size: 4px;
    font-weight: normal;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.header span.premium::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background-color: #00ff0d;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(77, 255, 48, 0.7);
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    padding: 10px 10px 2px 10px;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 99999;
    text-align: center;
}

.header .title {
    display: inline-flex;
    align-items: center;
    gap: 8px; /* space between icon and text */
    font-size: 1.2rem;
}

.header .title i {
    font-size: 1.3rem;
}

/* Hide visual in-app notifications but keep push notifications active */
#notification-container {
    display: none !important;
    visibility: hidden !important;
}

/* Enhanced TTS Controls for Mobile */
@media (max-width: 480px) {
    .tts-controls {
        padding: 10px;
        flex-direction: column;
        gap: 8px;
    }
    
    .tts-btn {
        min-width: 100%;
        padding: 12px;
        font-size: 14px;
    }
    
    #ttsStatus {
        order: 3;
        margin-left: 0;
        text-align: center;
        font-size: 12px;
    }
}

/* Capacitor/Android specific fixes */
.capacitor .tts-controls,
.android .tts-controls {
    background: #e8f4f8;
    border-left: 4px solid #2ecc71;
}

/* Loading state for TTS button */
.tts-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fa-spin {
    animation: fa-spin 1s infinite linear;
}

@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Capacitor-specific styling if needed */
.capacitor-tts .tts-controls {
    background: #e8f4f8 !important;
    border-left-color: #2ecc71 !important;
}

/* TTS Controls Styles - Enhanced */
.tts-controls {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 15px 0 !important;
    padding: 15px !important;
    background: #f8f9fa !important;
    border-radius: 8px !important;
    border-left: 4px solid #3498db !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
}

.tts-controls.visible {
    display: flex !important;
}

.tts-btn {
    border: none;
    padding: 10px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
}

.tts-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.tts-btn:active {
    transform: translateY(0);
}

#ttsPlayBtn {
    background: #3498db;
    color: white;
}

#ttsPlayBtn:hover {
    background: #2980b9;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

#ttsStopBtn {
    background: #e74c3c;
    color: white;
    display: none;
}

#ttsStopBtn:hover {
    background: #c0392b;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

#ttsStatus {
    font-size: 13px;
    color: #666;
    font-style: italic;
    margin-left: auto;
    min-width: 120px;
    text-align: center;
}

/* Responsive TTS controls */
@media (max-width: 768px) {
    .tts-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }
    
    .tts-btn {
        width: 100%;
        margin-bottom: 8px;
        min-width: auto;
    }
    
    #ttsStatus {
        margin-left: 0;
        text-align: center;
        margin-top: 5px;
        order: 3;
    }
}

#notification-container {
    position: fixed !important;
    top: 80px !important;
    right: 15px !important;
    z-index: 10000 !important;
    max-width: 400px !important;
    pointer-events: none !important;
}

.in-app-notification {
    pointer-events: auto !important;
}

/* In-app notifications - Purple/Pink Theme */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 380px;
}

.in-app-notification {
    background: linear-gradient(135deg, #8B5FBF 0%, #D53F8C 100%);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(139, 95, 191, 0.3);
    margin-bottom: 15px;
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    position: relative;
    overflow: hidden;
}

/* === FIX: Align Notification Layout === */
.in-app-notification {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 90%;
    max-width: 400px;
    margin: 0 auto;
    text-align: left;
    word-break: normal;
    white-space: normal;
}

.in-app-notification .notification-header,
.in-app-notification .notification-body,
.in-app-notification .notification-footer {
    display: block;
    width: 100%;
}

.in-app-notification .notification-body {
    word-wrap: break-word;
    text-align: left;
    line-height: 1.4;
    white-space: normal;
}

.in-app-notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.notification-header {
    padding: 16px 20px 8px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.notification-header strong {
    color: white;
    font-size: 15px;
    font-weight: 600;
    margin-right: 10px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.notification-header button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    color: white;
    padding: 2px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.notification-header button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.notification-body {
    padding: 8px 20px 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.5;
}

.notification-footer {
    padding: 12px 20px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.notification-footer small {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.notification-footer button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    font-weight: 500;
}

.notification-footer button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Progress bar for auto-dismiss */
.in-app-notification {
    position: relative;
}

.in-app-notification::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    transform-origin: left;
    animation: progressBar 5s linear forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes progressBar {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* Different notification types */
.in-app-notification.success {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.in-app-notification.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.in-app-notification.error {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

/* Hover effect */
.in-app-notification:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(139, 95, 191, 0.4);
    transition: all 0.3s ease;
}

/* Ensure notification container stacks to the right and notifications keep stable width */
#notification-container{
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    right: 20px;
    top: 20px;
    pointer-events: none;
    box-sizing: border-box;
}

/* Force notifications to use a readable width and wrap naturally */
.in-app-notification{
    width: 360px;
    max-width: calc(100% - 32px);
    box-sizing: border-box;
    word-break: normal;
    white-space: normal;
    pointer-events: auto; /* allow clicks on controls */
}

/* Inner flex child must allow wrapping */
.in-app-notification > div { min-width: 0; }


/* === Rest of your CSS continues unchanged === */


/* ===== Variables & Base Styles ===== */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #0e3b32;
    --text-color: #333;
    --bg-color: #f8f9fa;
    /*--card-bg: white;*/
    --border-color: #ddd;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-color);
    color: var(--text-color);
    padding-bottom: 60px;
    padding-top: 50px;
    overflow-x: hidden;
}

/* ===== Header & Navigation ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    padding: 10px 10px 2px 10px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 99999;
}

.headertext {
    font-family: 'Times New Roman', Times, serif;
    font-size: 17px;
    font-weight: bold;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--primary-color);
    display: flex;
    z-index: 100;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
}

.nav-item {
    flex: 1;
    text-align: center;
    padding: 9px 5px 2px 5px;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.nav-item.active {
    background: #40668e;
    color: white;
}

.nav-item:hover {
    background: #4a7badab;
}

.nav-item i {
    display: block;
    font-size: 15px;
    margin-bottom: 3px;
    z-index: 99999;
}

/* ===== Content Sections ===== */
.content {
    display: none;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin: 10px;
    max-width: 100%;
    overflow-x: hidden;
}

.content.active {
    display: block;
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 10px;
    width: 100%;
    padding: 0 10px;
    box-sizing: border-box;
    margin: 0 auto;
}

@media (min-width: 600px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 0;
    }
}

@media (min-width: 900px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== Cards ===== */
.dashboard-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    margin: 0 auto;
}

.dashboard-card h3 {
    margin-top: 0;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    font-size: 1.1rem;
}

.dashboard-card label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-card {
    background: linear-gradient(135deg, var(--secondary-color), #16a085);
    color: black;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    margin: 0 auto;
}

.stat-card h2 {
    margin: 0;
    font-size: 1.8rem;
}

.stat-card #total-value {
    color: white;
}

.stat-card p {
    margin: 5px 0 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

/* ===== Charts & Visualizations ===== */
.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* ===== Lists ===== */
.breakdown-list {
    list-style: none;
    padding: 0;
    font-size: 0.9rem;
}

.breakdown-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.breakdown-list li:last-child {
    border-bottom: none;
}

#category-growth-list li span:last-child {
    font-weight: bold;
    font-size: 0.95rem;
}

.currency-value {
    font-weight: bold;
    color: #27ae60;
}

/* ===== Tables ===== */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    background: var(--card-bg);
    position: relative;
    max-width: 100%;
}

#portfolio-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

#portfolio-table th,
#portfolio-table td {
    padding: 10px;
    text-align: left;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

#portfolio-table th {
    background: var(--primary-color);
    color: white;
    position: sticky;
    top: 0;
    z-index: 3;
}

/* Frozen column styles */
#portfolio-table tbody td:first-child {
    position: sticky;
    left: 0;
    background: var(--card-bg);
    background-color: #e0ebf7;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    z-index: 2;
    min-width: 120px;
    font-weight: bold;
}

#portfolio-table thead th:first-child {
    left: 0;
    z-index: 4;
    background: var(--primary-color);
}

#portfolio-table tr td:first-child {
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

/* ===== Forms & Inputs ===== */
.form-group {
    margin-bottom: 15px;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

button {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #40668e;
}

.actions button {
    padding: 5px 8px;
    font-size: 0.8rem;
    margin-right: 5px;
    width: auto;
}

#current-user-id {
    background-color: #f0f0f0;
    cursor: not-allowed;
}

/* ===== Suggestions Dropdown ===== */
#suggestions {
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    max-height: 150px;
    overflow: auto;
    position: absolute;
    width: calc(100% - 10px);
    display: none;
    z-index: 1000;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#suggestions div {
    padding: 8px;
    cursor: pointer;
    background-color: #e8ecff;
}

#suggestions div:hover {
    background: #f0f0f0;
}

/* ===== Notifications ===== */
.notification {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.notification.show {
    opacity: 1;
}

.notification.error {
    background: #e74c3c;
}

/* ===== Loading Indicators ===== */
#ace.verifying {
    color: #3498db;
}

#ace.verifying:after {
    content: '...';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

#refresh-status {
    font-size: 0.8rem;
    margin-left: 10px;
    color: #27ae60;
}

#loading-rates {
    font-size: 8px;
    color: gray;
    margin-left: 10px;
}

/* ===== Conditional Elements ===== */
#saveemail,
#savebtn {
    display: none;
}

body:not(.user-connected) #saveemail,
body:not(.user-connected) #savebtn {
    display: block;
}

/* Loading animation styles */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 100000000 !important; /* Much higher z-index */
}

.loader-overlay.active {
    visibility: visible;
    opacity: 1;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #3498db;
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: rotation 1s linear infinite;
    z-index: 100000001;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    margin-top: 16px;
    font-size: 16px;
    color: #333;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100000002;
}
/* Button loading state */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-right-color: transparent;
    animation: rotation 1s linear infinite;
}

/* ===== Analysis Section Styles ===== */
.analysis-nav {
    display: flex;
    flex-direction: row;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}


.analysis-tab {
    display: none;

}

.analysis-tab.active {
    display: block;
}

.analysis-container {
    padding: 15px;
    max-width: 800px;
    margin: 0 auto;
}

.analysis-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.analysis-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.analysis-card.in-portfolio {
    border-left: 4px solid #27ae60;
}

.analysis-card.expanded .analysis-full {
    display: block;
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.portfolio-health-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.analysis-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #2c3e50;
    line-height: 1.4;
}

.analysis-meta {
    font-size: 13px;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.analysis-summary {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
    font-size: 14px;
}

.analysis-source {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #7f8c8d;
}

.analysis-symbol {
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.sentiment-positive { background: #e8f5e8; color: #27ae60; }
.sentiment-negative { background: #fee; color: #e74c3c; }
.sentiment-neutral { background: #eef; color: #3498db; }

.analysis-date {
    color: #7f8c8d;
    font-size: 12px;
}

.analysis-keywords {
    margin-bottom: 15px;
}

.keyword-tag {
    display: inline-block;
    background: #f1f1f1;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-right: 5px;
    color: #666;
}

.read-more-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.health-score {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.health-good { background: #e8f5e9; color: #2e7d32; }
.health-fair { background: #fff3e0; color: #ef6c00; }
.health-poor { background: #ffebee; color: #c62828; }

/*.refresh-health-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    max-width: 30%;
    white-space: nowrap;
}*/

.toggle-btn {
    background: #40668e;
    border: none;
    color: white;
    cursor: pointer;
    margin-top: 15px;
    font-size: 14px;
    font-weight: 600;
}

.toggle-btn:hover {
    text-decoration: none;
}

.analysis-full {
    display: none;
    font-size: 15px;
    color: #2c3e50;
    line-height: 1.7;
    padding-top: 15px;
    border-top: 1px solid #eee;
    margin-top: 15px;
}

.recommendation-list {
    margin: 15px 0;
    padding-left: 0;
}

.recommendation-list li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.analysis-loading {
    text-align: center;
    padding: 30px;
    color: #7f8c8d;
}

.no-analysis {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
}

.no-analysis i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
    color: #bdc3c7;
}

.refresh-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.refresh-btn:hover {
    background: #2980b9;
}

.analysis-time-info {
    text-align: center;
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 10px;
    font-style: italic;
}

/* Search */
.search-container {
    margin-bottom: 20px;
}

#analysis-search {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Load More */
.load-more-container {
    text-align: center;
    margin: 20px 0;
}

.load-more-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.load-more-btn:hover {
    background: #2980b9;
}

/* Article Detail View */
.article-detail-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;

}

.article-detail-view.active {
    transform: translateX(0);
}

.article-detail-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.back-button {
    background: #144c85;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.article-detail-content {
    max-width: 800px;
    margin: 0 auto;
}

.article-full-content {
    font-size: 16px;
    line-height: 1.6;
    color: #34495e;
    margin-bottom: 30px;
}

.article-full-content p {
    margin-bottom: 15px;
}

.suggested-readings {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 30px;
}

.suggested-readings h4 {
    margin-top: 0;
    color: #2c3e50;
    margin-bottom: 15px;
}

.suggested-list {
    list-style: none;
    padding: 0;
}

.suggested-list li {
    margin-bottom: 10px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid #3498db;
}

.suggested-list li:hover {
    background: #e9f5ff;
}

/* Custom Modal Styles */
.custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.custom-modal-content {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    width: 80%;
    max-width: 400px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-modal h3 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.custom-modal p {
    margin: 15px 0;
    color: #34495e;
    font-size: 1rem;
}

.custom-modal-input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.custom-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.custom-modal-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    background-color: #ff0000;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.custom-modal-button.secondary {
    background-color: #196cc5;
}

.custom-modal-button:hover {
    background-color: #a62525;
}

.custom-modal-button.secondary:hover {
    background-color: #004794;
}


@media (max-width: 750px) {
    .analysis-nav {
        flex-direction: row;
        justify-content: space-between; /* keeps them spaced */
        flex-wrap: nowrap;             /* prevents breaking into 2nd line */
        overflow-x: auto;              /* allows horizontal scroll if too many */
    }

    .analysis-nav-btn { /*breaks dashboard*/
        flex: 1;
        min-width: auto;
        text-align: center;
        border: none;
        white-space: nowrap;
        margin: 0 5px;
        background: #40668e;
    }

    .analysis-nav-btn.active { /*breaks dashboard*/
        color: white;
        background: #2c3e50;
    }

    .article-detail-view {
        padding: 15px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

hr {
    border: none;
    border-top: 0.1px solid gray; /* very fine line */
    margin: 0;
}

.recommendation-note {
  background: #f9fafb;          /* light gray background */
  border-left: 4px solid var(--primary-color); /* blue left border */
  padding: 12px 16px;
  margin: 10px 0;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
}

.recommendation-list ul {
  list-style-type: none; /* removes default bullets */
  padding-left: 0;       /* removes default left padding */
  margin-left: 0;        /* removes default left margin */
}

/* icon style */
.red-icon {
  color: red;
  margin-right: 8px;
  font-size: 12px;
}

.green-icon {
  color: green;
  margin-right: 8px;
  font-size: 12px;

      .add-analysis-btn { /*breaks dashboard*/
        flex: 1;
        min-width: auto;
        text-align: center;
        border: none;
        white-space: nowrap; 
    }

        .del-analysis-btn { /*breaks dashboard*/
        flex: 1;
        min-width: auto;
        text-align: center;
        border: none;
        white-space: nowrap;
    }
}}

/* Media Queries for Large Screens*/
@media (min-width: 750px) {
    .analysis-nav {
        flex-direction: row;
        justify-content: space-between; /* keeps them spaced */
        flex-wrap: nowrap;             /* prevents breaking into 2nd line */
        overflow-x: auto;              /* allows horizontal scroll if too many */
    }

    .analysis-nav-btn { /*breaks dashboard*/
        flex: 1;
        min-width: auto;
        text-align: center;
        border: none;
        white-space: nowrap;
        margin: 0 5px;
        background: #40668e;
    }

    .analysis-nav-btn.active {
        background: #2c3e50;
        color: white;
    }

    .article-detail-view {
        padding: 15px;
    }
    
.recommendation-note {
  background: #f9fafb;          /* light gray background */
  border-left: 4px solid var(--primary-color); /* blue left border */
  padding: 12px 16px;
  margin: 10px 0;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
}

.recommendation-list ul {
  list-style-type: none; /* removes default bullets */
  padding-left: 0;       /* removes default left padding */
  margin-left: 0;        /* removes default left margin */
}

/* icon style */
.red-icon {
  color: red;
  margin-right: 8px;
  font-size: 12px;
}

.green-icon {
  color: green;
  margin-right: 8px;
  font-size: 12px;
}

hr {
    border: none;
    border-top: 0.1px solid gray; /* very fine line */
    margin: 0;
    
}
}

/* For the Manage Analysis section */
#manageAnalysisDiv .analysis-nav {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 10px;
}

#manageAnalysisDiv .analysis-nav-btn {
    white-space: nowrap;
    min-width: 120px;
    text-align: center;
}

        /* Custom styles for the milky login modal */
        .login-modal {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 999999;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background-color: #f8f4e9; /* Milky color */
            padding: 30px;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            width: 90%;
            max-width: 400px;
            text-align: center;
        }
        
        .login-modal h2 {
            margin-bottom: 20px;
            color: #333;
        }
        
        .login-modal input {
            padding: 12px;
            font-size: 1rem;
            width: 100%;
            text-align: center;
            border: 1px solid #ccc;
            border-radius: 6px;
            margin-bottom: 15px;
            box-sizing: border-box;
        }
        
        .login-modal .button-container {
            display: flex;
            gap: 10px;
            width: 100%;
            justify-content: center;
        }
        
        .login-modal button {
            padding: 12px 20px;
            border: none;
            border-radius: 6px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            width: 100px;
        }
        
        .login-modal .login-btn {
            background: linear-gradient(135deg, #4CAF50, #2E7D32);
            color: white;
            box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3), 0 0 15px rgba(76, 175, 80, 0.4);
        }
        
        .login-modal .get-key-btn {
            background: linear-gradient(135deg, #9e9e9e, #616161);
            color: white;
            white-space: nowrap;
        }
        
        .login-modal .info-text {
            font-size: 12px;
            background: rgba(255,255,255,0.8);
            padding: 10px;
            border-radius: 6px;
            margin-top: 15px;
            line-height: 1.4;
            text-align: justify;
        }
        
        .login-modal .info-text a {
            color: brown;
            text-decoration: none;
        }
        
        #ace {
            color: red;
            margin-top: 10px;
        }
        
        /* Video background with white overlay */
        .video-background {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 99997;
            overflow: hidden;
             background: #f1f1f1;
        }
        
        .video-background::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(255, 255, 255, 0.5); /* White overlay with 50% transparency */
            z-index: -1;
        }
        
        .video-background video {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            z-index: -2;
        }


        /* Add this CSS to your existing style.css */
        .video-background video {
            opacity: 0;
            transition: opacity 0.5s ease-in;
        }
        
        .video-background video.playing {
            opacity: 1;
        }
        
        /* Hide video controls completely */
        .video-background video::-webkit-media-controls {
            display: none !important;
        }
        
        .video-background video::-webkit-media-controls-enclosure {
            display: none !important;}


/* Custom Instrument Select Styles */
.custom-select-container {
    position: relative;
    margin-bottom: 15px;
}

.custom-select {
    position: relative;
    width: 100%;
}

.select-selected {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.select-selected:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(26, 188, 156, 0.1);
}

.select-selected:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.2);
}

.select-selected i {
    transition: transform 0.3s ease;
}

.select-items {
    position: absolute;
    background-color: white;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.custom-select.open .select-items {
    max-height: 300px;
    overflow-y: auto;
}

.custom-select.open .select-selected i {
    transform: rotate(180deg);
}

.select-option {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease;
}

.select-option:hover {
    background-color: #f8f9fa;
}

.select-option i {
    margin-right: 10px;
    width: 16px;
    text-align: center;
    color: var(--secondary-color);
}

.select-option.selected {
    background-color: rgba(26, 188, 156, 0.1);
    color: var(--secondary-color);
    font-weight: 500;
}

/* Hide the native select but keep it for form submission */
#type {
    position: absolute;
    opacity: 0;
    height: 0;
    width: 0;
}

/* ===== Portfolio Table Action Buttons ===== */
#portfolio-table .actions {
    display: flex;
    gap: 5px;
    justify-content: center;
    min-width: 120px;
}

#portfolio-table .actions button {
    flex: 1;
    min-width: 60px;
    max-width: 70px;
    padding: 6px 8px;
    font-size: 0.8rem;
    margin: 0;
    text-align: center;
    white-space: nowrap;
}

#portfolio-table .actions button:first-child {
    background-color: #2c3e50;
}

#portfolio-table .actions button:last-child {
    background-color: #e74c3c;
}

#portfolio-table .actions button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Ensure table cells have proper spacing */
#portfolio-table td.actions {
    padding: 8px 5px !important;
}


/* Enhanced notification styles for portfolio alerts */
.notification-portfolio-gain {
    border-left-color: #27ae60 !important;
    background: #f0fff0 !important;
}

.notification-portfolio-loss {
    border-left-color: #e74c3c !important;
    background: #fff0f0 !important;
}

.notification-portfolio-critical {
    border-left-color: #c0392b !important;
    background: #ffe6e6 !important;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

/* Change percentage badge */
.change-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 8px;
}

.change-positive {
    background: #27ae60;
    color: white;
}

.change-negative {
    background: #e74c3c;
    color: white;
}

