@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;600;800&display=swap');

:root {
    --bg-main: #f0f2f5;
    --accent-orange: #f97316;
    --accent-orange-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --text-primary: #1f2937;
    --text-muted: #6b7280;
    --card-inner-bg: rgba(255, 255, 255, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Lexend', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden; 
    overflow-y: auto;
    width: 100%;
}

/* Vibrant Mesh Background */
.mesh-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: #f0f2f5;
    background-image: 
        radial-gradient(at 0% 0%, hsla(25,100%,79%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,100%,89%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,83%,1) 0, transparent 50%), 
        radial-gradient(at 0% 100%, hsla(339,49%,83%,1) 0, transparent 50%), 
        radial-gradient(at 50% 100%, hsla(25,100%,79%,1) 0, transparent 50%), 
        radial-gradient(at 100% 100%, hsla(225,100%,89%,1) 0, transparent 50%);
}

.dashboard-container {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 40px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    padding: 2.5rem;
}

/* Header & Navbar */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--accent-orange-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Market Indices Bar */
.indices-bar {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.index-card {
    background: var(--card-inner-bg);
    padding: 0.8rem 1.2rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    min-width: 160px;
}

.index-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.index-value {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 4px 0;
}

.index-change.up { color: #10b981; }
.index-change.down { color: #ef4444; }

/* Content Area Split */
.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2.5rem;
    flex: 1;
    min-height: 0; /* Quan trọng để flex child có thể scroll */
    overflow: hidden;
}

.timeline-area {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Timeline Scroll Area */
.timeline-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 1rem;
}

.timeline-scroll::-webkit-scrollbar, .dividend-list::-webkit-scrollbar { width: 6px; }
.timeline-scroll::-webkit-scrollbar-thumb, .dividend-list::-webkit-scrollbar-thumb { 
    background: rgba(0,0,0,0.05); 
    border-radius: 10px; 
}

.timeline-item {
    background: var(--card-inner-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.timeline-item * {
    max-width: 100%;
}

.timeline-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.7);
}

/* Sidebar / Registration */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0;
    overflow: hidden;
}

.sidebar-card {
    background: var(--accent-orange-gradient);
    color: white;
    padding: 2rem;
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(249, 115, 22, 0.2);
}

.sidebar-card h3 { margin-bottom: 1rem; }
.sidebar-card p { opacity: 0.9; font-size: 0.9rem; margin-bottom: 1.5rem; }

.input-glass {
    width: 100%;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 1rem;
    border-radius: 16px;
    color: white;
    outline: none;
    margin-bottom: 1rem;
}

.input-glass::placeholder { color: rgba(255,255,255,0.7); }

.btn-white {
    width: 100%;
    background: white;
    color: var(--accent-orange);
    border: none;
    padding: 1rem;
    border-radius: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
}

.btn-white:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

/* Desktop First Layout and Breakpoints */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .dashboard-container {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 100vh;
        margin: 0;
        padding: 1.5rem 1rem;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: none;
        box-shadow: none;
        border-radius: 0;
        overflow: visible;
    }

    .sidebar {
        order: 1;
        margin-bottom: 2rem;
    }

    .timeline-area {
        order: 2;
    }
}

@media (max-width: 640px) {
    header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .indices-bar {
        gap: 8px;
        margin-bottom: 1.5rem;
    }

    .index-card {
        min-width: 120px;
        padding: 0.6rem;
    }

    .index-name {
        font-size: 0.65rem;
    }

    .index-value {
        font-size: 0.75rem;
        letter-spacing: -0.3px;
    }

    .timeline-item {
        padding: 1rem;
        border-radius: 20px;
    }

    .sidebar-card {
        width: 100%;
        padding: 1.5rem 1.2rem;
        border-radius: 24px;
    }
    
    .sidebar-card h3 {
        font-size: 1.1rem;
    }
    
    .sidebar-card p {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }

    .input-glass, .btn-white {
        padding: 0.8rem;
        font-size: 0.9rem;
        border-radius: 12px;
    }
}

/* Badges */
.ticker {
    background: white;
    color: var(--accent-orange);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 800;
    margin-right: 5px;
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content.glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 3rem;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.profile-header {
    text-align: center;
    margin-bottom: 2rem;
}

.avatar-large {
    font-size: 3rem;
    background: #f3f4f6;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1rem;
}

.status-badge {
    background: #e5e7eb;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    margin-top: 5px;
    display: inline-block;
}

.status-badge.active {
    background: #dcfce7;
    color: #10b981;
}

.profile-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-danger {
    margin-top: 1rem;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 1rem;
    border-radius: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-danger:hover {
    background: #ef4444;
    color: white;
}
