:root {
    --bg-color: #f6f8fa;
    --sidebar-bg: #ffffff;
    --main-bg: #f6f8fa;
    --border-color: #d0d7de;
    --grid-line: #e1e4e8;
    --primary-indigo: #10B981;
    /* New Emerald Green */
    --header-bg: #ffffff;
    --text-primary: #24292f;
    --text-muted: #57606a;
    --nav-hover: #f3f4f6;
    --nav-active: rgba(16, 185, 129, 0.1);
    --success-green: #059669;
    --error-red: #cf222e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    background: var(--primary-indigo);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: #fff;
    margin-bottom: 0.25rem;
}

.sidebar-header p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: 0.2s;
}

.nav-links li a:hover {
    background: var(--nav-hover);
}

.nav-links li a.active {
    background: var(--nav-active);
    color: var(--primary-indigo);
    border-right: 3px solid var(--primary-indigo);
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--main-bg);
}

.main-header {
    padding: 1rem 2rem;
    background: var(--primary-indigo);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.menu-trigger {
    display: none;
    /* Show only on mobile */
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 0.3rem 0.6rem;
    border-radius: 0;
    cursor: pointer;
}

.header-info h1 {
    font-size: 1.25rem;
    color: #fff;
    margin-bottom: 0.25rem;
}

.btn-fetch {
    background: var(--primary-indigo);
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Award Section & Table */
.award-section {
    padding: 0.75rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.milestone-notification {
    background-color: rgba(16, 185, 129, 0.08);
    border: none;
    /* Flat design */
    padding: 0.5rem 1rem;
    margin: 0.5rem 1.5rem 0 1.5rem;
    border-radius: 0;
    box-shadow: none;
    animation: fadeInDown 0.5s ease-out;
}

.milestone-content {
    color: #065f46;
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.5;
}

.milestone-text {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.online-checker {
    color: #065f46;
    margin-top: 4px;
    font-size: 0.85rem;
}

.milestone-notification strong {
    color: #047857;
    font-weight: 700;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.award-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.summary-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.chart-container {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 480px;
    /* Thấp nhất 480px */
}

.table-container {
    background: #ffffff;
    border: none;
    /* Removed outer border */
    border-radius: 0;
    overflow-x: auto;
    box-shadow: none;
    /* Optional: remove shadow for total flat look */
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    padding: 1rem 1.2rem;
    border: 1px solid var(--grid-line);
    text-align: center;
    font-size: 0.9rem;
    /* Reverted to original size */
    font-weight: 500;
    /* Match mobile weight */
    color: var(--text-muted);
    /* Match mobile color */
}

thead th {
    background: var(--primary-indigo);
    color: #ffffff;
    padding: 1.3rem 1.2rem;
    /* Increased height */
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 10;
    border: none;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    /* Keep column separator comparable to grid-line */
}

thead th:last-child {
    border-right: none;
    /* No outer right border */
}

.time-col {
    background: transparent;
    /* Match other columns */
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    text-align: center;
    font-weight: 500;
    /* Match global */
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-extra {
    display: none;
}

.show-all .col-extra {
    display: table-cell;
}

/* Voting numbers */
.vote-val {
    font-weight: 500;
    /* Match global */
}

.vote-delta {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    background: rgba(45, 164, 78, 0.1);
    color: var(--success-green);
    border-radius: 0;
    margin-left: 0.5rem;
    font-weight: 400;
}

.delta-none {
    color: var(--text-muted);
    opacity: 0.5;
}

.delta-minus {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    background: rgba(207, 34, 46, 0.1);
    color: var(--error-red);
    border-radius: 0;
    margin-left: 0.5rem;
}

.col-gap {
    font-weight: 600;
}

.row-realtime .col-gap {
    background: transparent !important;
}

.row-latest .col-gap {
    background: transparent !important;
}

.row-realtime {
    background-color: rgba(16, 185, 129, 0.08) !important;
}

.row-realtime .time-col {
    background: transparent !important;
}

.delta-live {
    background: rgba(0, 0, 0, 0.05) !important;
    transition: opacity 0.3s ease;
}

.row-realtime td {
    border-bottom: 2px solid rgba(16, 185, 129, 0.2);
}

.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #10B981;
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse-green 2s infinite;
}

/* #live-clock removed to inherit standard td styles */

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Dropdown & Stats Toggle */
.dropdown {
    position: relative;
    display: inline-block;
}

.btn-stats-toggle {
    background: var(--primary-indigo);
    border: 1px solid var(--primary-indigo);
    color: #ffffff;
    padding: 0.5rem 0.8rem;
    border-radius: 0;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 500;
}

.btn-stats-toggle:hover {
    background: #059669;
    border-color: #059669;
}

.btn-toggle-view {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 500;
}

.btn-toggle-view:hover {
    background: #f3f4f6;
}

.btn-toggle-view.active {
    background: var(--primary-indigo);
    color: #ffffff;
    border-color: var(--primary-indigo);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border: 1px solid var(--border-color);
    border-radius: 0;
    margin-top: 5px;
    overflow: hidden;
}

.dropdown-content a {
    color: var(--text-primary);
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
    transition: 0.2s;
}

.dropdown-content a:hover {
    background-color: #f3f4f6;
    color: var(--primary-indigo);
}

.dropdown-content.show {
    display: block;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(2px);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .menu-trigger {
        display: block;
        padding: 0.35rem 0.75rem;
        font-size: 0.85rem;
        margin-right: 0.5rem;
    }

    .main-header {
        padding: 0.75rem 1rem;
    }

    .award-section {
        padding: 0.5rem 0;
    }

    .table-container {
        border-radius: 0;
        border-right: none;
        border-left: none;
    }

    .award-controls {
        padding: 0 0.5rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Mobile Equal Buttons */
    .award-controls>div {
        width: 100%;
        display: flex !important;
        gap: 4px !important;
        justify-content: space-between;
    }

    .award-controls .dropdown,
    .award-controls>div>button {
        flex: 1;
        min-width: 0;
        /* Allow shrinking */
    }

    .award-controls button.btn-stats-toggle {
        width: 100%;
        padding: 4px 2px !important;
        font-size: 0.65rem !important;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
    }

    /* Mobile Table Optimization */
    .rank-col {
        width: 45px !important;
        padding-left: 0.1rem !important;
        padding-right: 0.1rem !important;
    }

    .rank-col .rank-number {
        font-size: 0.6rem;
        padding: 0.1rem 0.3rem;
        min-width: 25px;
    }

    th,
    td {
        padding: 0.4rem 0.3rem;
        font-size: 0.7rem;
        /* Increased size */
        color: var(--text-muted);
        /* Match time-col color */
        font-weight: 500;
        /* Medium weight */
    }

    thead th {
        padding: 0.6rem 0.3rem;
        /* Slightly taller than data cells but compact */
    }

    .time-col {
        font-size: 0.7rem;
        /* Increased size */
        padding-left: 0.2rem;
        padding-right: 0.2rem;
        white-space: normal;
        line-height: 1.2;
        text-align: center;
        letter-spacing: -0.2px;
        font-weight: 500;
        /* Medium weight */
    }

    .live-dot {
        margin-right: 4px;
    }

    /* #live-clock mobile styles removed */

    .vote-val {
        display: block;
        font-size: 0.7rem;
        /* Increased size */
        font-weight: 500;
        /* Medium weight */
    }

    .vote-delta {
        margin-left: 0;
        margin-top: 2px;
        font-size: 0.65rem;
        display: inline-block;
    }

    /* Fix compression when "Show all" is active */
    .show-all table {
        table-layout: auto;
    }

    .show-all th,
    .show-all td {
        min-width: 100px;
    }

    .milestone-notification {
        margin: 0.4rem 0.5rem 0 0.5rem;
        padding: 0.4rem 0.75rem;
    }

    .milestone-content {
        font-size: 0.85rem;
    }

    .milestone-text {
        padding: 0 0.25rem;
        line-height: 1.4;
    }

    /* Mobile Chart Controls */
    .chart-type-selector {
        flex: 0 0 60%;
        /* Fixed 3/5 width */
        max-width: 60%;
        display: flex;
        gap: 5px;
        min-width: 0;
        /* Prevent overflow */
    }

    .chart-type-selector .btn-toggle-view {
        flex: 1;
        padding: 4px 0;
        font-size: 0.65rem;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
    }

    .chart-interval-note {
        display: block;
        margin-top: 4px;
        font-size: 0.85rem;
        color: var(--text-muted);
        font-weight: 400;
    }
}

.btn-toggle-view {
    background: var(--primary-indigo);
    border: 1px solid var(--primary-indigo);
    color: #fff;
    padding: 0.5rem 0.8rem;
    border-radius: 0;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}

.btn-toggle-view:hover {
    background: #059669;
}

.btn-toggle-chart {
    background: var(--primary-indigo);
    border: 1px solid var(--primary-indigo);
    color: #ffffff;
    padding: 0.5rem 1.25rem;
    border-radius: 0;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.btn-toggle-chart:hover {
    background: #059669;
    border-color: #059669;
}

.app-footer {
    padding: 1.2rem;
    /* Reduced from 1.5rem to lower height ~10px */
    text-align: center;
    color: #ffffff;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    font-weight: 500;
    text-transform: uppercase;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: var(--primary-indigo);
    flex-shrink: 0;
}

/* Custom Chart Legend */
.custom-chart-legend {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 10px 0;
    margin-top: 10px;
    gap: 15px;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.custom-chart-legend::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: 0.2s;
    user-select: none;
    padding: 4px 8px;
    border-radius: 4px;
}

.legend-item:hover {
    background: #f3f4f6;
}

.legend-item.hidden {
    opacity: 0.4;
    text-decoration: line-through;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Leaderboard specific styles */
.rank-number {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: #f3f4f6;
    color: var(--text-muted);
    font-size: 0.85rem;
    min-width: 35px;
    text-align: center;
}

.rank-number.rank-top1 {
    background: #FFD700;
    color: #000;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    font-weight: 800;
}

.rank-number.rank-top2 {
    background: #C0C0C0;
    color: #000;
    font-weight: 700;
}

.rank-number.rank-top3 {
    background: #CD7F32;
    color: #fff;
    font-weight: 700;
}

tr.rank-top1 {
    background-color: rgba(255, 215, 0, 0.05) !important;
}

tr.rank-top2 {
    background-color: rgba(192, 192, 192, 0.05) !important;
}

tr.rank-top3 {
    background-color: rgba(205, 127, 50, 0.05) !important;
}

.legend-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Quick Chat Box */
/* Pinned Message */
.pinned-msg-container {
    padding: 10px 16px;
    background: #ecfdf5;
    /* Light green (emerald 50) */
    border-bottom: 2px solid #d1fae5;
    /* emerald 100 */
    display: none;
    position: relative;
    z-index: 5;
    flex-shrink: 0;
}

.pinned-msg-container.active {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pinned-msg-text {
    font-size: 0.85rem;
    line-height: 1.4;
    color: #24292f;
    word-break: break-word;
    max-height: 10em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 7;
    line-clamp: 7;
    -webkit-box-orient: vertical;
}

.pinned-msg-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.pinned-msg-author {
    font-size: 0.75rem;
    font-weight: 600;
    color: #059669;
    /* Emerald 600 */
}

/* Pseudo element for 📌 icon */
.pinned-msg-author::before {
    content: '📌 ';
}

.unpin-btn {
    background: none;
    border: none;
    color: #f08c00;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    margin-left: auto;
}

.chat-widget {
    position: fixed;
    bottom: 0;
    /* Flush to bottom */
    right: 20px;
    width: 320px;
    height: 450px;
    background: #fff;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, height 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
}

.chat-widget.collapsed {
    height: 48px;
    transform: translateY(0);
}

.chat-header {
    background: var(--primary-indigo);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.chat-header h3 {
    font-size: 0.9rem;
    margin: 0;
    font-weight: 600;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-resize-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: 0.2s;
    padding: 4px;
}

.chat-resize-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.chat-widget.tall {
    height: 700px;
    max-height: 90vh;
}

.chat-widget.tall.collapsed {
    height: 48px;
}

.chat-toggle-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
}

/* Chart Header Styles */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
    margin-right: 10px;
    /* Space between title and buttons */
    white-space: nowrap;
    /* Prevent title breaking drastically if possible */
}

/* Allow title to wrap on mobile only if needed, but we want alignment */
@media (max-width: 992px) {
    .chart-header h3 {
        white-space: normal;
        font-size: 0.9rem;
        flex: 0 0 40%;
        /* Fixed 2/5 width */
        max-width: 40%;
        margin-right: 5px;
    }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f9f9f9;
}

.chat-msg {
    background: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
    max-width: 90%;
    align-self: flex-start;
}

.chat-msg-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-msg-author {
    font-weight: 700;
    color: var(--primary-indigo);
}

.chat-msg-time {
    font-size: 0.65rem;
    opacity: 0.7;
}

.chat-msg-text {
    font-size: 0.85rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-input-area {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-nickname-input {
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 4px;
    outline: none;
}

.chat-message-row {
    display: flex;
    gap: 8px;
}

.chat-message-input {
    flex: 1;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    outline: none;
}

.chat-send-btn {
    background: var(--primary-indigo);
    color: #fff;
    border: none;
    padding: 0 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.chat-send-btn:hover {
    background: #059669;
}

/* Reactions Styles */

.chat-msg {
    position: relative;
    overflow: visible !important;
}

.reaction-btn {
    position: absolute;
    right: -30px;
    bottom: 50%;
    transform: translateY(50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.6;
    /* Hiển thị luôn, mờ mờ */
    transition: 0.2s;
    padding: 0;
}

.chat-msg:hover .reaction-btn,
.reaction-btn:focus,
.reaction-btn:active,
.reaction-picker:hover~.reaction-btn {
    opacity: 1;
}

.reaction-btn:hover {
    transform: translateY(50%) scale(1.2);
}

.reaction-picker {
    position: absolute;
    bottom: 25px;
    left: 0;
    /* Aligned left to avoid overflow on short messages */
    right: auto;
    background: white;
    padding: 5px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 8px;
    z-index: 100;
    animation: popIn 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    white-space: nowrap;
}

.reaction-emoji {
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.reaction-emoji:hover {
    transform: scale(1.3);
}

.reaction-count {
    position: absolute;
    bottom: -15px;
    right: 5px;
    font-size: 0.75rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1px 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.reaction-count:empty {
    display: none;
}

@keyframes popIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.chat-launcher {
    display: none;
}

@media (max-width: 768px) {
    .chat-widget {
        width: 320px;
        max-width: 90%;
        bottom: 0;
        /* Flush to bottom on mobile */
        left: 50%;
        /* Căn giữa */
        transform: translateX(-50%);
        /* Căn giữa */
        right: auto;
        /* Bỏ left để không bị full width */
        height: 50vh;
        /* Giảm chiều cao */
    }

    .chat-widget.collapsed {
        display: none;
    }

    .chat-launcher {
        display: flex;
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
        background: var(--primary-indigo);
        color: #fff;
        border-radius: 50%;
        justify-content: center;
        align-items: center;
        font-size: 1.3rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        z-index: 2100;
        cursor: pointer;
        animation: fadeIn 0.3s ease;
        opacity: 0.7;
        transition: opacity 0.3s, transform 0.2s;
    }

    .chat-launcher:active {
        opacity: 1;
        transform: scale(0.9);
    }
}


@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-video-embed {
    margin-top: 8px;
    width: 400px;
    /* Force flexible container to expand */
    max-width: 100%;
    /* Constraint to parent width to prevent overflow */
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.chat-video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Milestone Card Styles */
.milestone-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.5s ease;
}

.milestone-card {
    background: #fff;
    width: 450px;
    max-width: calc(100% - 16px);
    margin: 0 8px;
    border-radius: 24px;
    padding: 40px 20px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 10001;
    animation: cardEntrance 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardEntrance {
    0% {
        transform: scale(0.5) translateY(50px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.milestone-category-badge {
    display: inline-block;
    background: #000;
    color: #fff;
    padding: 6px 24px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.milestone-category-name {
    font-size: 18px;
    font-weight: 800;
    color: #000;
    line-height: 1.2;
    margin-bottom: 25px;
    text-transform: uppercase;
}

.milestone-image-container {
    width: 80%;
    margin: 0 auto 30px auto;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f0f0f0;
}

.milestone-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}

.milestone-artist-name {
    font-size: 48px;
    font-weight: 900;
    color: #000;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: -1px;
}

.milestone-label-sub {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.milestone-value-text {
    font-size: 34px;
    font-weight: 800;
    color: #000;
    text-transform: uppercase;
    letter-spacing: -1.2px;
    white-space: nowrap;
}

.milestone-btn-close {
    position: absolute;
    top: -55px;
    right: 0px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #fff;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

@media (max-width: 480px) {
    .milestone-artist-name {
        font-size: 38px;
    }

    .milestone-value-text {
        font-size: 26px;
    }

    .milestone-category-name {
        font-size: 14px;
    }
}

/* Chat Image Styles */
.chat-img-embed {
    margin-top: 8px;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.chat-img-embed:hover {
    transform: scale(1.02);
}

.chat-img-embed img {
    width: 100%;
    height: auto;
    display: block;
}

/* Lightbox Styles */
.lightbox-overlay {
    display: none;
    position: fixed;
    z-index: 20000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.lightbox-content {
    margin: auto;
    display: block;
    width: auto;
    max-width: 90%;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.lightbox-close:hover {
    color: #bbb;
}