@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #090d16;
    --bg-secondary: #111827;
    --bg-glass: rgba(17, 24, 39, 0.65);
    --bg-glass-card: rgba(17, 24, 39, 0.45);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(255, 255, 255, 0.15);
    
    --accent-primary: #6366f1;
    --accent-primary-glow: rgba(99, 102, 241, 0.4);
    --accent-success: #10b981;
    --accent-success-glow: rgba(16, 185, 129, 0.4);
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(139, 92, 246, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* App Header */
header {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 50%, #34d399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo i {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #6366f1 0%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background: var(--bg-glass-card);
    border-color: var(--border-glass);
}

/* App Layout Grid */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Glassmorphism Card Style */
.glass-card {
    background: var(--bg-glass-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: var(--border-glass-hover);
    box-shadow: 0 12px 40px 0 rgba(99, 102, 241, 0.05);
    transform: translateY(-2px);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
}

.card-title i {
    color: var(--accent-primary);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input, .input-wrapper select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.input-wrapper input:focus, .input-wrapper select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
    background: rgba(0, 0, 0, 0.3);
}

.input-suffix {
    position: absolute;
    right: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    pointer-events: none;
}

.input-wrapper input.with-suffix {
    padding-right: 3rem;
}

/* Premium Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, #7c3aed 0%, var(--accent-primary) 100%);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, #34d399 0%, var(--accent-success) 100%);
}

.btn-secondary {
    background: var(--bg-glass-card);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-muted);
}

.btn-block {
    width: 100%;
}

/* Quick Slider values styles */
.slider-group {
    margin-top: 0.25rem;
}
.slider-group input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    margin: 10px 0;
}
.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-primary-glow);
    transition: var(--transition-smooth);
}
.slider-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
}

.metric-value.highlight-green {
    color: var(--accent-success);
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metric-value.highlight-purple {
    color: var(--accent-primary);
    background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metric-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Visualization Panel */
.chart-container {
    position: relative;
    height: 380px;
    margin: 1rem 0;
    width: 100%;
}

/* Table Design */
.table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.15);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-glass);
    padding: 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Stock Badges and Ratings */
.stock-ticker {
    font-weight: 800;
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    display: inline-block;
}

.score-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.score-badge.high {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.score-badge.medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Portfolio Allocation Card Specifics */
.allocator-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    transition: var(--transition-smooth);
}

.allocator-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-glass-hover);
}

.allocator-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.allocator-slider {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
    max-width: 250px;
}

.allocator-slider span {
    font-weight: 700;
    min-width: 45px;
    text-align: right;
    font-size: 0.95rem;
}

.allocator-slider input {
    flex-grow: 1;
}

.allocator-amount {
    font-weight: 700;
    color: var(--accent-success);
    min-width: 110px;
    text-align: right;
    font-size: 0.95rem;
}

.allocation-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--border-glass);
}

.allocation-total {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.allocation-total strong {
    color: var(--text-primary);
    font-size: 1.05rem;
}

.allocation-total.error strong {
    color: var(--accent-danger);
}

.allocation-total.success strong {
    color: var(--accent-success);
}

/* Tabs System */
.tabs-header {
    display: flex;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 1.5rem;
    padding-bottom: 0.25rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
    position: relative;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 10%;
    width: 80%;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 3px;
    box-shadow: 0 0 10px var(--accent-primary-glow);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

/* Custom Alert / Tip Box */
.alert-box {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.alert-box.success {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-box i {
    font-size: 1.25rem;
    margin-top: 0.15rem;
}

.alert-box.success i {
    color: var(--accent-success);
}

.alert-box.info i {
    color: var(--accent-primary);
}

.alert-content h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}

.alert-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* DCA Guide Cards */
.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.guide-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 1.5rem;
    transition: var(--transition-smooth);
}

.guide-card:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.02);
}

.guide-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.guide-card.success .guide-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-success);
}

.guide-card h4 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.guide-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Market Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    margin-left: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition-smooth);
}
.status-badge.online {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-success);
    border: 1px solid rgba(16, 185, 129, 0.25);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.1);
}
.status-badge.online i {
    animation: pulse 1.8s infinite;
}
.status-badge.offline {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-warning);
    border: 1px solid rgba(245, 158, 11, 0.25);
}
@keyframes pulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjust */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    .nav-links {
        width: 100%;
        justify-content: center;
    }
    .container {
        margin: 1rem auto;
    }
}

/* Floating AI Chat Widget styling */
#ai-chat-widget {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1000;
}

.chat-btn-wrapper {
    animation: floatBtn 4s ease-in-out infinite;
    will-change: transform;
}

@keyframes floatBtn {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

#chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #7c3aed 100%);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.6rem;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    position: relative;
}

#chat-toggle-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.6);
}

.chat-btn-glow::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    animation: ringGlow 2s infinite;
}

@keyframes ringGlow {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

.notification-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
}

#chat-window {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 20px 0 0 20px;
    border: none;
    border-left: 1px solid var(--border-glass);
    z-index: 1001;
    box-shadow: -8px 0 32px 0 rgba(0, 0, 0, 0.4);
    background: rgba(11, 17, 30, 0.98);
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: translateX(0);
    opacity: 1;
    will-change: transform, opacity;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease;
}

#chat-window.hidden {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

.chat-header {
    background: rgba(17, 24, 39, 0.8);
    border-bottom: 1px solid var(--border-glass);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-ai-icon {
    font-size: 1.4rem;
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
}

.chat-status {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

#chat-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

#chat-close-btn:hover {
    color: var(--accent-danger);
}

#chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    will-change: scroll-position;
}

.chat-msg {
    display: flex;
    max-width: 80%;
}

.chat-msg.bot {
    align-self: flex-start;
}

.chat-msg.user {
    align-self: flex-end;
}

.msg-bubble {
    padding: 0.75rem 1rem;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.chat-msg.bot .msg-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    border-top-left-radius: 2px;
}

.chat-msg.user .msg-bubble {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #4f46e5 100%);
    color: white;
    border-top-right-radius: 2px;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px dashed var(--border-glass);
    background: rgba(0, 0, 0, 0.1);
}

.suggest-badge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 50px;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.suggest-badge:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.chat-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-glass);
    background: rgba(17, 24, 39, 0.8);
    display: flex;
    gap: 0.75rem;
}

#chat-input {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
    font-family: inherit;
}

#chat-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

#chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--accent-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

#chat-send-btn:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    #chat-window {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
}
