/* 
 * Báo Cáo Video – Standalone Page Styles (Dark Mode TikTok GenZ)
 * Design system tokens and base components are in shared.css 
 */

body {
    display: flex;
    flex-direction: column;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}
  
/* ─── SUMMARY STRIP ─────────────────────────────────── */
.summary-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    padding: 20px 24px;
}
  
.summary-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-card);
    padding: 16px 18px;
    box-shadow: var(--shadow-glass);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.4s ease backwards;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 3px;
    background: linear-gradient(90deg, var(--tiktok-cyan), var(--neon-purple));
}

.summary-card:nth-child(1)::before { background: linear-gradient(90deg, var(--tiktok-cyan), #00F5D4); }
.summary-card:nth-child(2)::before { background: linear-gradient(90deg, #00F5D4, #FFD93D); }
.summary-card:nth-child(3)::before { background: linear-gradient(90deg, #9B59B6, var(--tiktok-red)); }
.summary-card:nth-child(4)::before { background: linear-gradient(90deg, var(--tiktok-red), var(--tiktok-cyan)); }
.summary-card:nth-child(5)::before { background: linear-gradient(90deg, #FFD93D, var(--tiktok-red)); }

.summary-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-glow), var(--shadow-glass);
}
  
.summary-card:nth-child(1) { animation-delay: 0.05s; }
.summary-card:nth-child(2) { animation-delay: 0.1s; }
.summary-card:nth-child(3) { animation-delay: 0.15s; }
.summary-card:nth-child(4) { animation-delay: 0.2s; }
.summary-card:nth-child(5) { animation-delay: 0.25s; }
  
.sc-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    font-size: 20px;
    flex-shrink: 0;
    color: white;
}
  
.summary-card:nth-child(1) .sc-icon { background: rgba(37, 244, 238, 0.2); color: var(--tiktok-cyan); border: 1px solid rgba(37, 244, 238, 0.3); }
.summary-card:nth-child(2) .sc-icon { background: rgba(0, 245, 212, 0.2); color: #00F5D4; border: 1px solid rgba(0, 245, 212, 0.3); }
.summary-card:nth-child(3) .sc-icon { background: rgba(155, 89, 182, 0.2); color: #9B59B6; border: 1px solid rgba(155, 89, 182, 0.3); }
.summary-card:nth-child(4) .sc-icon { background: rgba(254, 44, 85, 0.2); color: var(--tiktok-red); border: 1px solid rgba(254, 44, 85, 0.3); }
.summary-card:nth-child(5) .sc-icon { background: rgba(255, 217, 61, 0.2); color: #FFD93D; border: 1px solid rgba(255, 217, 61, 0.3); }
  
.sc-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sc-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-sec);
    text-transform: uppercase;
}
.sc-value {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}
.sc-trend {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sc-trend.neutral { color: var(--text-sec); }
  
/* ─── MAIN TABLE AREA ───────────────────────────────── */
.table-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: 0 24px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-glass);
    overflow: hidden;
    animation: fadeInUp 0.5s ease 0.3s backwards;
}
  
.table-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.3);
}
.table-header-bar h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.table-header-bar h2 i {
    color: var(--tiktok-red);
}
  
.table-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}
  
.date-range-badge {
    font-size: 12px;
    font-weight: 700;
    color: var(--tiktok-cyan);
    background: var(--tiktok-cyan-dim);
    border: 1px solid rgba(37, 244, 238, 0.3);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
}
  
/* ─── TABLE ─────────────────────────────────────────── */
.table-scroll {
    flex: 1;
    overflow: auto;
}
  
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    min-width: 1000px;
}
  
thead {
    position: sticky;
    top: 0;
    z-index: 10;
}
  
thead th {
    background: var(--bg-surface);
    color: var(--text-sec);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
    text-align: center;
    user-select: none;
    position: relative;
    backdrop-filter: blur(8px);
}
  
thead th.sortable {
    cursor: pointer;
    transition: background 0.2s;
}
thead th.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}
thead th.sortable i {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.4;
    transition: opacity 0.2s;
}
thead th.sorted-asc i,
thead th.sorted-desc i {
    opacity: 1;
    color: var(--tiktok-cyan);
}
  
.col-stt { width: 40px; min-width: 40px; }
.col-name { width: 150px; min-width: 120px; text-align: left !important; }
  
tbody td {
    padding: 14px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: transparent;
    transition: background 0.2s;
}

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

tbody tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.1);
}
  
tbody tr.expanded td {
    background: rgba(254, 44, 85, 0.05);
}

/* Format specific cells */
td.cell-name, th.col-name {
    text-align: left !important;
}
.video-id-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
}

.video-id-cell .expand-icon {
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    transition: all 0.2s ease;
}
.video-id-cell .expand-icon:hover {
    background: rgba(255,255,255,0.1);
    color: var(--tiktok-cyan);
}

.video-id-cell .expand-icon.rotated {
    transform: rotate(90deg);
    color: var(--tiktok-red);
}

.video-id-link {
    color: var(--tiktok-cyan);
    text-decoration: none;
    font-weight: 700;
}
.video-id-link:hover {
    text-decoration: underline;
}

.money-cell, .col-gmv {
    font-weight: 600;
    color: #00F5D4;
}

.col-com {
    font-weight: 700;
    color: var(--tiktok-red);
}

.pct-cell {
    font-weight: 600;
}

.product-count-badge {
    background: rgba(155, 89, 182, 0.2);
    color: #E0B0FF;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
}

/* Colors for sub-table */
.product-detail-row td {
    padding: 0 !important;
    background: rgba(0,0,0,0.2) !important;
}

.product-detail-content {
    padding: 10px 20px 20px 50px;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-sub-table {
    width: 100%;
    margin-top: 10px;
    background: rgba(30, 30, 42, 0.4);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-glass);
}

.product-sub-table th {
    background: rgba(0,0,0,0.5);
    color: var(--text-sec);
    padding: 10px;
}

.product-sub-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.product-name-cell {
    text-align: left !important;
    max-width: 300px;
}

.detail-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 12px;
}
.detail-label i { color: var(--tiktok-red); }

/* Quick Dates filter button override */
.quick-date-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-glass);
    background: var(--bg-surface);
    color: var(--text-sec);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.quick-date-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
}
.quick-date-btn.active {
    background: var(--tiktok-cyan-dim);
    border-color: rgba(37, 244, 238, 0.3);
    color: var(--tiktok-cyan);
}

/* Responsive Overrides */
@media (max-width: 1200px) {
    .summary-strip {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .summary-strip {
        grid-template-columns: repeat(2, 1fr);
        padding: 16px;
    }
    
    .table-wrapper {
        margin: 0 16px 16px;
    }
}

@media (max-width: 480px) {
    .summary-strip {
        grid-template-columns: 1fr;
    }
}

/* Sticky Columns for Mobile/Tablet */
@media (max-width: 1024px) {
    .col-stt {
        position: sticky;
        left: 0;
        z-index: 2;
        background-color: var(--bg-surface);
    }
    .col-name {
        position: sticky;
        left: 40px;
        z-index: 2;
        background-color: var(--bg-surface);
        box-shadow: 2px 0 5px rgba(0,0,0,0.2); /* Shadow to separate from scrolling content */
    }
    
    thead th.col-stt, thead th.col-name {
        z-index: 12;
        background-color: var(--bg-surface);
    }
    
    /* Ensure total row sticky columns align */
    tr.row-total td.col-stt, tr.row-total td.col-name {
        background-color: rgba(255, 255, 255, 0.1) !important;
        backdrop-filter: blur(8px);
    }
}
