/* [V17.2] Premium Affiliate Management UI - Stats, Links & Event-Centric History */

.eco-dashboard-v6 .eco-affiliate-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 30px;
}

/* Affiliate Summary Banner - Split Design */
.eco-dashboard-v6 .eco-aff-banner {
    background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
    border-radius: 24px;
    padding: 30px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    position: relative;
    overflow: hidden;
}

.eco-dashboard-v6 .eco-aff-banner::after {
    content: '';
    position: absolute;
    right: -30px;
    top: -30px;
    width: 150px;
    height: 150px;
    background: rgba(255,255,255,0.1);
    border-radius: 40px;
    transform: rotate(25deg);
}

.eco-dashboard-v6 .eco-aff-main-stats {
    display: flex;
    gap: 50px;
    position: relative;
    z-index: 2;
}

.eco-dashboard-v6 .eco-aff-stat-group {
    display: flex;
    flex-direction: column;
}

.eco-dashboard-v6 .eco-aff-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.8;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.eco-dashboard-v6 .eco-aff-stat-value {
    font-size: 32px;
    font-weight: 900;
}

.eco-dashboard-v6 .eco-aff-stat-sub {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 4px;
}

/* Secondary Metrics Grid */
.eco-dashboard-v6 .eco-aff-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.eco-dashboard-v6 .eco-aff-metric-card {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}

.eco-dashboard-v6 .eco-aff-metric-card:hover {
    transform: translateY(-3px);
}

.eco-dashboard-v6 .eco-aff-metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eco-dashboard-v6 .eco-aff-metric-info .lab {
    font-size: 11px;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.eco-dashboard-v6 .eco-aff-metric-info .val {
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
}

/* Smart Link Tool - V17.5 Refinement */
.eco-dashboard-v6 .eco-link-tool-card {
    background: #fff;
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.05);
}

.eco-dashboard-v6 .eco-link-input-group {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    align-items: stretch;
}

.eco-dashboard-v6 .eco-link-input-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.eco-dashboard-v6 .eco-link-input-wrap .material-icons {
    position: absolute;
    left: 14px;
    color: #94a3b8;
    font-size: 18px;
    pointer-events: none;
}

.eco-dashboard-v6 .eco-link-input-wrap input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px 16px 12px 42px;
    border-radius: 12px;
    font-size: 14px;
    color: #334155;
    transition: border-color 0.2s, background-color 0.2s;
}

.eco-dashboard-v6 .eco-link-input-wrap input:focus {
    background: #fff;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

.eco-dashboard-v6 .eco-input-hint {
    position: absolute;
    bottom: -18px;
    left: 14px;
    font-size: 10px;
    color: #94a3b8;
    white-space: nowrap;
}

.eco-dashboard-v6 .eco-input-hint span {
    color: #6366f1;
    font-weight: 700;
}

.eco-dashboard-v6 .eco-link-btn-premium {
    background: linear-gradient(135deg, #a3c104 0%, #839d03 100%);
    color: #fff;
    border: none;
    width: auto;
    min-width: 120px;
    height: 45px;
    padding: 0 20px;
    border-radius: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(131, 157, 3, 0.2);
    flex: 0 0 auto;
}

.eco-dashboard-v6 .eco-link-btn-premium:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(131, 157, 3, 0.3);
}

.eco-dashboard-v6 .eco-link-btn-premium:active {
    transform: translateY(0);
}

/* Event-Centric History List - V17.5 COMPACT & LOGICAL */
.eco-dashboard-v6 .eco-aff-history-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: #f1f5f9;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.eco-dashboard-v6 .eco-aff-history-item {
    background: #fff;
    transition: background-color 0.1s;
}

.eco-dashboard-v6 .eco-aff-history-item:hover {
    background: #f8fafc;
}

.eco-dashboard-v6 .eco-aff-item-main {
    padding: 10px 16px; 
    display: grid;
    grid-template-columns: 36px 1fr 110px 100px 32px;
    align-items: center;
    gap: 15px;
    cursor: pointer;
}

.eco-dashboard-v6 .eco-aff-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eco-dashboard-v6 .eco-aff-item-icon .material-icons {
    font-size: 18px;
}

.eco-dashboard-v6 .eco-aff-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0; /* Prevent overflow */
}

.eco-dashboard-v6 .eco-aff-item-title {
    font-weight: 700;
    color: #1e293b;
    font-size: 13px;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 4px; /* Reduced gap since badge has its own margin */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eco-dashboard-v6 .eco-aff-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #eff6ff;
    color: #1d4ed8;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 10px;
    border-radius: 20px;
    border: 1px solid rgba(29, 78, 216, 0.1);
    margin-left: 8px;
    white-space: nowrap;
}

.eco-dashboard-v6 .eco-aff-item-time {
    font-size: 10px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.eco-dashboard-v6 .eco-aff-item-amount {
    text-align: right;
    white-space: nowrap;
}

.eco-dashboard-v6 .eco-aff-item-amount .val {
    font-size: 15px;
    font-weight: 900;
    color: #0f172a; /* Slightly darker */
    letter-spacing: -0.5px;
}

.eco-dashboard-v6 .eco-aff-item-amount .val.revoked {
    color: #94a3b8;
    text-decoration: line-through;
}

.eco-dashboard-v6 .eco-status-box {
    display: flex;
    justify-content: center;
}

.eco-dashboard-v6 .eco-status-box .st {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(0,0,0,0.03);
    white-space: nowrap;
}

.eco-dashboard-v6 .eco-aff-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.eco-dashboard-v6 .eco-aff-toggle-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: background-color 0.2s, transform 0.2s;
}

.eco-dashboard-v6 .eco-aff-history-item.is-open .eco-aff-toggle-btn {
    background: var(--eco-pri, #839d03);
    color: #fff;
    border-color: var(--eco-pri, #839d03);
}

/* Timeline Design */
.eco-dashboard-v6 .eco-aff-item-timeline {
    padding: 0 20px 0 75px;
    background: #fafafb;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease, opacity 0.2s ease;
    opacity: 0;
}

.eco-dashboard-v6 .eco-aff-history-item.is-open .eco-aff-item-timeline {
    padding: 15px 20px 20px 75px;
    max-height: 1000px;
    opacity: 1;
    border-top: 1px solid #f1f5f9;
}

.eco-dashboard-v6 .eco-aff-history-item.is-open .toggle-icon {
    transform: rotate(180deg);
}

.eco-dashboard-v6 .eco-aff-item-timeline::before {
    content: '';
    position: absolute;
    left: 40px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.eco-dashboard-v6 .eco-timeline-node {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.eco-dashboard-v6 .node-dot {
    position: absolute;
    left: -39px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    z-index: 2;
}

.eco-dashboard-v6 .node-content {
    display: flex;
    flex-direction: column;
}

.eco-dashboard-v6 .node-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.eco-dashboard-v6 .node-bot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #94a3b8;
    font-weight: 600;
}

.eco-dashboard-v6 .node-amt {
    font-weight: 800;
}

/* Specific state: Revoked history item Refinement */
.eco-dashboard-v6 .eco-aff-history-item.is-revoked {
    background: #fff;
    border-left: 4px solid #ef4444;
}

.eco-dashboard-v6 .eco-aff-history-item.is-revoked .eco-aff-item-title,
.eco-dashboard-v6 .eco-aff-history-item.is-revoked .eco-aff-item-icon {
    filter: grayscale(1) opacity(0.6);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .eco-dashboard-v6 .eco-aff-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        padding: 20px;
    }
    
    .eco-dashboard-v6 .eco-aff-main-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .eco-dashboard-v6 .eco-link-input-group {
        flex-direction: column;
    }
    
    .eco-dashboard-v6 .eco-link-btn-premium {
        width: 100%;
        height: 45px;
    }

    .eco-dashboard-v6 .eco-link-input-group {
        gap: 20px; /* More space for hints on mobile */
    }

    .eco-dashboard-v6 .eco-input-hint {
        bottom: -15px;
    }

    .eco-dashboard-v6 .eco-aff-item-main {
        grid-template-columns: 36px 1fr auto;
        grid-template-rows: auto auto auto;
        gap: 6px 12px;
        padding: 12px;
    }

    .eco-dashboard-v6 .eco-aff-item-icon {
        grid-row: 1 / 2;
    }

    .eco-dashboard-v6 .eco-aff-item-info {
        grid-column: 2 / 3;
        grid-row: 1 / 3;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .eco-dashboard-v6 .eco-aff-item-title {
        font-size: 12px;
        white-space: normal; /* Allow title to wrap slightly if very long */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .eco-dashboard-v6 .eco-aff-item-time {
        flex-wrap: wrap;
        gap: 6px;
    }

    .eco-dashboard-v6 .eco-ov-deadline-badge {
        margin-left: 0;
        font-size: 10px;
        padding: 1px 6px;
        white-space: nowrap;
    }

    .eco-dashboard-v6 .eco-aff-item-amount {
        grid-column: 3 / 4;
        grid-row: 1 / 2;
        text-align: right;
    }

    .eco-dashboard-v6 .eco-aff-item-amount .val {
        font-size: 13px;
    }

    .eco-dashboard-v6 .eco-status-box {
        grid-column: 2 / 4;
        grid-row: 3 / 4;
        justify-content: flex-start;
        margin-top: 4px;
    }

    .eco-dashboard-v6 .eco-aff-actions {
        grid-column: 3 / 4;
        grid-row: 2 / 4;
        align-self: flex-end;
    }
}

/* --- V17.5 NEW REFINED CLASSES --- */

/* 1. Header & Quick Filters */
.eco-dashboard-v6 .eco-filter-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* 2. Modern Deadline Badges */
.eco-dashboard-v6 .eco-ov-deadline-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: #fff7ed;
    color: #c2410c;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid rgba(194, 65, 12, 0.1);
    margin-left: 8px;
    vertical-align: middle;
}

.eco-dashboard-v6 .eco-ov-deadline-badge .material-icons {
    font-size: 14px;
}

/* 2. Banner Refinements */
.eco-dashboard-v6 .eco-aff-banner .eco-aff-total {
    text-align: right;
    position: relative;
    z-index: 2;
}

.eco-dashboard-v6 .eco-aff-total .label {
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.8;
    letter-spacing: 1px;
}

.eco-dashboard-v6 .eco-aff-total .value {
    font-size: 38px;
    font-weight: 900;
    line-height: 1;
    margin: 5px 0;
}

.eco-dashboard-v6 .eco-aff-total .sub {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.2);
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
}

/* 3. Per-Link Stats Table */
.eco-dashboard-v6 .eco-aff-stats-card {
    margin-top: 20px;
}

.eco-dashboard-v6 .eco-aff-stats-table-wrapper {
    overflow-x: auto;
}

.eco-dashboard-v6 .eco-aff-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.eco-dashboard-v6 .eco-aff-stats-table tr {
    border-bottom: 1px solid #f9f9f9;
}

.eco-dashboard-v6 .eco-aff-stats-table thead tr {
    border-bottom: 1px solid #eee;
    text-align: left;
}

.eco-dashboard-v6 .eco-aff-stats-table th {
    padding: 10px 5px;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
}

.eco-dashboard-v6 .eco-aff-stats-table td {
    padding: 12px 5px;
}

.eco-dashboard-v6 .eco-aff-stats-table .stat-link-name {
    font-weight: 600;
    color: #1e293b;
}

.eco-dashboard-v6 .eco-aff-stats-table .stat-link-url {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 400;
}

.eco-dashboard-v6 .eco-aff-stats-table .stat-rate {
    color: #10b981 !important;
    font-weight: 700;
}

/* 4. Rank & Progress Card */
.eco-dashboard-v6 .eco-rank-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.eco-dashboard-v6 .eco-rank-badge {
    background: linear-gradient(to right, #8b5cf6, #6d28d9);
    color: #fff;
    font-size: 10px;
    padding: 5px 14px;
    border-radius: 20px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.2);
    text-transform: uppercase;
}

.eco-dashboard-v6 .eco-rank-stat-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.eco-dashboard-v6 .eco-rank-stat-box {
    flex: 1;
    min-width: 150px;
    background: #f8fafc;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
}

.eco-dashboard-v6 .eco-rank-stat-box.is-leader {
    background: rgba(139, 92, 246, 0.05);
    border-color: rgba(139, 92, 246, 0.1);
}

.eco-dashboard-v6 .eco-rank-stat-box .lab {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.eco-dashboard-v6 .eco-rank-stat-box.is-leader .lab {
    color: #7c3aed;
}

.eco-dashboard-v6 .eco-rank-stat-box .val {
    font-size: 22px;
    font-weight: 900;
    color: #1e293b;
}

.eco-dashboard-v6 .eco-rank-stat-box.is-leader .val {
    color: #6d28d9;
}

.eco-dashboard-v6 .eco-cookie-info-box {
    margin-top: 25px;
    padding: 20px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #f1f5f9;
    font-size: 13px;
}

.eco-dashboard-v6 .eco-cookie-info-box .header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.eco-dashboard-v6 .eco-cookie-icon-wrap {
    width: 36px;
    height: 36px;
    background: #fff7ed;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eco-dashboard-v6 .eco-cookie-icon-wrap .material-icons {
    color: #f97316;
    font-size: 20px;
}

.eco-dashboard-v6 .eco-cookie-info-box .title {
    font-weight: 800;
    color: #1e293b;
}

.eco-dashboard-v6 .eco-cookie-info-box .title span {
    color: #f97316;
}

.eco-dashboard-v6 .eco-cookie-info-box .desc {
    font-size: 11px;
    color: #94a3b8;
}

.eco-dashboard-v6 .eco-cookie-details {
    padding-left: 48px;
    color: #64748b;
    line-height: 1.7;
    font-size: 12px;
}

.eco-dashboard-v6 .eco-cookie-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.eco-dashboard-v6 .eco-cookie-row span:last-child {
    font-weight: 700;
}

.eco-dashboard-v6 .eco-cookie-row.bonus span:last-child {
    color: #10b981;
}

/* 5. Smart Link Tool Refinements */
.eco-dashboard-v6 .eco-link-tool-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.eco-dashboard-v6 .eco-link-tool-icon {
    width: 32px;
    height: 32px;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eco-dashboard-v6 .eco-link-tool-title {
    font-weight: 800;
    font-size: 15px;
    color: #1e293b;
}

/* 6. List Management Refinements */
.eco-dashboard-v6 .eco-list-item.is-system-link {
    background: #f8fafc;
    border-bottom: 2px solid #fff;
}

.eco-dashboard-v6 .eco-list-item.is-system-link .eco-item-icon {
    background: #fff;
    color: #4338ca;
    border: 1px solid #eef2ff;
}

.eco-dashboard-v6 .eco-list-item .eco-item-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.eco-dashboard-v6 .eco-list-item .system-badge {
    font-size: 9px;
    background: #e0e7ff;
    color: #4338ca;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 800;
    text-transform: uppercase;
}

/* 7. History List Refinements - Modern Unified Header */
.eco-dashboard-v6 .eco-list-header-row.is-history {
    margin-bottom: 15px;
}

.eco-dashboard-v6 .eco-header-main-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.eco-dashboard-v6 .eco-stats-summary-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    color: #64748b;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
}

.eco-dashboard-v6 .eco-stats-summary-badge .material-icons {
    font-size: 14px;
    color: #94a3b8;
}

.eco-dashboard-v6 .eco-stats-summary-badge b {
    color: #1e293b;
    font-weight: 800;
}

.eco-dashboard-v6 .eco-history-empty {
    padding: 60px 20px;
    text-align: center;
    color: #94a3b8;
}

/* --- [REFACTOR V18.7.16] CLEAN CODE STANDARDS --- */

/* 1. Refactored Pagination (Replacing inline styles) */
.eco-dashboard-v6 .eco-aff-page-btn {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    background: #fff;
    color: #64748b;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.eco-dashboard-v6 .eco-aff-page-btn.is-active {
    background: var(--eco-pri, #4338ca);
    color: #fff;
    border-color: var(--eco-pri, #4338ca);
    box-shadow: 0 2px 4px rgba(67, 56, 202, 0.2);
}

.eco-dashboard-v6 .eco-aff-page-btn:hover:not(.is-active) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

/* 2. Layout Utilities */
.eco-m-b-40 {
    margin-bottom: 40px !important;
}

/* 3. Event History Container Refinements (From Overview Standard) */
.eco-dashboard-v6 .eco-ov-pagination {
    padding: 15px;
    display: flex;
    justify-content: center;
    gap: 8px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.eco-dashboard-v6 .eco-ov-pagination-link {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    text-decoration: none;
    font-weight: 700;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    transition: all 0.2s;
}

.eco-dashboard-v6 .eco-ov-pagination-link.is-active {
    background: var(--eco-pri, #839d03);
    color: #fff;
    border-color: var(--eco-pri, #839d03);
}

.eco-dashboard-v6 .eco-ov-pagination-link:not(.is-active):hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
