:root {
    --eco-pri: #839d03;
    --eco-pri-soft: rgba(131, 157, 3, 0.1);
    --eco-bg: #F2F2F7;
    --eco-card: rgba(255, 255, 255, 0.8);
    --eco-text: #1C1C1E;
    --eco-text-sec: #8E8E93;
    --eco-glass: none;
    --eco-radius: 18px;
    --eco-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.eco-dashboard-v6 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--eco-text);
    max-width: 1000px;
    margin: 20px auto;
    position: relative;
    padding-bottom: 0px;
    overflow-x: hidden;
    /* Prevent page-wide horizontal scroll */
}

/* Glassmorphism Cards */
.eco-glass-card {
    background: var(--eco-card);
    backdrop-filter: var(--eco-glass);
    -webkit-backdrop-filter: var(--eco-glass);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--eco-radius);
    padding: 24px;
    box-shadow: var(--eco-shadow);
    margin-bottom: 20px;

    /* Performance Optimizations for Smooth Scroll (GPU Kick) */
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
    will-change: transform, opacity;
}

/* Navigation Carousel Container */
.eco-nav-carousel-container {
    position: relative;
    display: flex;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 5px;
    gap: 5px;
    margin-bottom: 15px;
}

.eco-nav-v6 {
    display: flex;
    flex: 1;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    width: 100%;
    cursor: grab;
    user-select: none;
}

.eco-nav-v6:active,
.eco-nav-v6.active-drag {
    cursor: grabbing !important;
}

.eco-nav-v6::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.eco-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--eco-text-sec);
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.2s, background-color 0.2s, color 0.2s;
    cursor: pointer;
    white-space: nowrap;
    /* Prevent text wrap */
}

.eco-nav-item.active {
    background: #fff;
    color: var(--eco-text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.eco-nav-item i,
.eco-nav-item .material-symbols-outlined {
    font-size: 20px;
    opacity: 0.9;
}

.material-symbols-outlined {
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24;
    vertical-align: middle;
}

/* Global Loading Spinner (Photo Match) */
.eco-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 1000000;
    z-index: 1000000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.eco-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.eco-spinner-premium {
    width: 70px;
    height: 70px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #839d03;
    border-radius: 50%;
    animation: eco-spin 1s linear infinite;
    display: block;
    margin: 40px auto;
    /* Centered with more breathing room */
}

.eco-loading-text {
    font-weight: 500;
    color: #666;
    font-size: 16px;
    font-family: inherit;
}

@keyframes eco-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Nav Arrows */
.eco-nav-arrow {
    background: none;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--eco-text-sec);
    transition: all 0.2s;
    border-radius: 8px;
}

.eco-nav-arrow:hover {
    background: rgba(255, 255, 255, 0.8);
    color: var(--eco-pri);
}

/* Sub-navigation (Filters) */
.eco-subnav-item {
    font-weight: 700;
    transition: transform 0.2s, background-color 0.2s;
}

.eco-subnav-item.active {
    background: #fff !important;
    color: var(--eco-text) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.eco-subnav-item:hover:not(.active) {
    background: rgba(0, 0, 0, 0.08) !important;
}

/* Header & Wallet */
.eco-header-v6 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.eco-user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    /* Hỗ trợ rớt dòng cho badges */
}

.eco-profile-main {
    display: flex;
    align-items: center;
    gap: 15px;
}

.eco-user-profile img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: var(--eco-shadow);
    object-fit: cover;
    /* Fix squashed avatar */
}

.eco-greeting {
    font-size: 14px;
    color: var(--eco-text-sec);
    margin-bottom: 2px;
}

.eco-username {
    font-size: 24px;
    font-weight: 800;
}

.eco-wallet-v6 {
    text-align: right;
}

.eco-balance-label {
    font-size: 12px;
    color: var(--eco-text-sec);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.eco-balance-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--eco-pri);
    display: block;
}

/* Grid System */
.eco-grid-v6 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* Action Icons */
.eco-btn-circle {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--eco-text);
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, background-color 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.03);
    cursor: pointer;
}

.eco-btn-circle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    background: var(--eco-pri-soft);
}

.eco-btn-circle .material-icons {
    font-size: 20px;
}

.eco-team-avatar img {
    width: 54px !important;
    height: 54px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid #fff !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
    flex-shrink: 0;
}

/* Mission & Lists */
.eco-list-v6 {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.eco-list-item {
    display: flex;
    flex-wrap: wrap;
    /* Universal wrap */
    align-items: center;
    padding: 15px 20px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 1px;
    transition: background-color 0.2s;
    position: relative;
}

.eco-list-item:hover {
    background: #fff;
}

.eco-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--eco-pri-soft);
    color: var(--eco-pri);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 20px;
    flex-shrink: 0;
}

.eco-item-main {
    flex: 1;
}

.eco-item-title {
    font-weight: 700;
    font-size: 15px;
}

.eco-item-sub {
    font-size: 12px;
    color: var(--eco-text-sec);
}

.eco-item-right {
    text-align: right;
}

.eco-amount-v6 {
    font-weight: 800;
    font-size: 16px;
}

/* Views */
.eco-view {
    display: none;
}

.eco-view.active {
    display: block;
    animation: ecoFadeIn 0.4s ease;
}

@keyframes ecoFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Bottom Bar */
/* Mobile Sync: Use Top Carousel Instead of Bottom Bar */
@media (max-width: 768px) {
    .eco-nav-carousel-container {
        position: sticky;
        top: 0;
        z-index: 100;
        margin: 0 -15px 20px -15px;
        border-radius: 0;
        background: #ffffff;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .eco-nav-arrow {
        display: flex;
        /* Show arrows on mobile */
        width: 30px;
        height: 30px;
        font-size: 16px;
    }

    .eco-nav-v6 {
        padding: 5px 15px;
    }
}

/* Remove old fixed bottom bar */
@media (max-width: 600px) {
    .eco-nav-v6.fixed-bottom {
        /* In case there's an explicit class, otherwise we override the generic selector if needed */
        display: none !important;
    }
}

/* Mobile Responsive Optimizations */
@media (max-width: 600px) {
    .eco-header-v6 {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .eco-user-profile {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .eco-profile-main {
        justify-content: center;
        width: 100%;
        margin-bottom: 5px;
        margin-top: 15px;
    }

    .eco-user-badges {
        width: 100%;
        justify-content: center !important;
        margin-top: 12px !important;
        padding-top: 12px;
        border-top: 1px solid rgba(0, 0, 0, 0.03);
    }

    .eco-wallet-v6 {
        text-align: center;
        width: 100%;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        padding-top: 15px;
    }

    .eco-nav-item {
        padding: 8px 15px !important;
        font-size: 13px !important;
        flex: 0 0 auto !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center;
        gap: 5px;
    }
}

/* Alerts & Notices */
.eco-alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    animation: ecoFadeIn 0.3s ease;
}

.eco-alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.eco-alert.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.eco-alert.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.eco-page-link {
    transition: all 0.2s ease;
}

.eco-page-link:hover:not(.active) {
    background: #eee !important;
    transform: translateY(-2px);
}

.eco-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    display: inline-block;
}

.badge-orange {
    background: #ff8d00;
}

.badge-green {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-red {
    background: #ffebee;
    color: #c62828;
}

/* --- RESPONSIVE OPTIMIZATIONS --- */
@media (max-width: 768px) {
    .eco-grid-v6 {
        grid-template-columns: 1fr;
    }

    .eco-glass-card {
        padding: 16px;
    }

    .eco-header-v6 {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .eco-user-profile img {
        width: 50px;
        height: 50px;
    }

    .eco-username {
        font-size: 20px;
    }

    /* Table Responsive Enforcement */
    .eco-table-wrapper {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .eco-table {
        min-width: 700px !important;
        width: max-content !important;
    }

    .eco-table th {
        white-space: nowrap !important;
    }

    .eco-product-info {
        min-width: 280px;
    }

    .eco-product-info strong {
        white-space: normal !important;
        word-break: break-word;
    }

    /* Link Generator Responsive */
    .eco-glass-card form div {
        flex-direction: column;
        gap: 5px;
    }

    .eco-link-generator-v6 form input,
    .eco-link-generator-v6 form button {
        width: 100% !important;
        margin-bottom: 10px;
    }

    .eco-item-main {
        overflow: hidden;
    }

    .eco-item-sub {
        max-width: 150px !important;
    }
}

@media (max-width: 480px) {
    .eco-nav-item {
        padding: 10px 8px;
        font-size: 11px;
    }

    .eco-amount-v6 {
        font-size: 14px;
    }

    .eco-nav-v6 {
        bottom: 10px;
        left: 10px;
        right: 10px;
    }
}

/* Link Input with Icon */
.eco-link-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.eco-link-input-wrapper .material-symbols-outlined {
    position: absolute;
    left: 10px;
    color: #999;
}

.eco-link-input-wrapper input {
    padding-left: 35px !important;
}

.eco-file-label {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

/* Pagination */
.eco-pagination {
    margin-top: 30px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.eco-pagination a,
.eco-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    text-decoration: none !important;
    color: #555;
    background: #fff;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 600;
}

.eco-pagination a:hover {
    background: var(--eco-pri-soft);
}

.eco-pagination .current {
    background: var(--eco-pri);
    color: #fff;
    border-color: var(--eco-pri);
}

/* Focusable Hidden Input for Validation Balloons */
.eco-focusable-hidden {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    pointer-events: none;
}

/* Dashboard V16.7 Status Labels */
.status-success {
    background: rgba(39, 174, 96, 0.1) !important;
    color: #27ae60 !important;
    border: 1px solid #27ae60 !important;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 10px;
}

.status-cancelled {
    background: rgba(231, 76, 60, 0.1) !important;
    color: #e74c3c !important;
    border: 1px solid #e74c3c !important;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 10px;
}

.status-pending {
    background: rgba(243, 156, 18, 0.1) !important;
    color: #f39c12 !important;
    border: 1px solid #f39c12 !important;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 10px;
}

/* Popup Thumbnail Rigidity */
.eco-popup-thumb {
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    object-fit: cover !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
    background: #f8f9fa !important;
    border: 1px solid #eee !important;
    aspect-ratio: 1 / 1 !important;
}

/* Order Detail Popup Enhancements */
.eco-popup-thumb {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #eee;
    display: block;
}

#modal-order-content-v2::-webkit-scrollbar {
    width: 6px;
}

#modal-order-content-v2::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#modal-order-content-v2::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

#modal-order-content-v2::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* Global Avatar Fix for List Items */
.eco-list-item img {
    object-fit: cover;
    width: 100%;
}

/* --- SHARED COMPONENTS SCOPED --- */
.eco-dashboard-v6 .eco-notification-list {
    margin-bottom: 25px;
}

.eco-dashboard-v6 .eco-notification-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 12px;
    transition: transform 0.2s ease;
}

.eco-dashboard-v6 .eco-notification-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.8);
}

.eco-dashboard-v6 .eco-notice-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.eco-dashboard-v6 .eco-notice-content {
    flex: 1;
}

.eco-dashboard-v6 .eco-notice-title {
    margin: 0 0 5px 0;
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

.eco-dashboard-v6 .eco-notice-text {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 8px;
}

.eco-dashboard-v6 .eco-notice-text p {
    margin: 0 0 10px 0;
}

.eco-dashboard-v6 .eco-notice-text p:last-child {
    margin-bottom: 0;
}

.eco-dashboard-v6 .eco-notice-date {
    font-size: 11px;
    color: #999;
    font-weight: 500;
}

.eco-dashboard-v6 .eco-notice-alert {
    border-left: 4px solid #dc3545;
}

.eco-dashboard-v6 .eco-notice-update {
    border-left: 4px solid #28a745;
}

.eco-dashboard-v6 .eco-notice-info {
    border-left: 4px solid #2271b1;
}

.eco-dashboard-v6 .eco-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    display: inline-block;
}

.eco-dashboard-v6 .eco-badge.badge-blue {
    background: #3498db;
}

.eco-dashboard-v6 .eco-badge.badge-orange {
    background: #e67e22;
}

.eco-dashboard-v6 .eco-alert {
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
}

.eco-dashboard-v6 .eco-alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.eco-dashboard-v6 .eco-alert.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.eco-dashboard-v6 .eco-alert.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}