/* ================================================================
   Admin Usage History — Premium DataTable Styling
   Scoped under: #usage-history-list-container
   ================================================================ */

/* ── Variables ──────────────────────────────────────────────────── */
#usage-history-list-container {
    --uha-accent:    #4680ff;
    --uha-success:   #2ed8b6;
    --uha-warning:   #ffb64d;
    --uha-danger:    #fc6180;
    --uha-purple:    #a855f7;
    --uha-indigo:    #6366f1;
    --uha-teal:      #14b8a6;

    --uha-border:    #eaeaea;
    --uha-bg-muted:  #f8f9fc;
    --uha-text:      #1a1f36;
    --uha-muted:     #6b7280;
    --uha-radius-sm: 6px;
    --uha-radius:    10px;
    --uha-radius-lg: 14px;
}

/* ── Date Range Picker (admin) ───────────────────────────────────── */
.drp-wrap    { position: relative; width: 100%; }
.drp-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 0 12px;
    border: 1px solid var(--uha-border);
    border-radius: var(--uha-radius-sm);
    background: #fff;
    font-size: 13px;
    color: #495057;
    width: 100%;
    height: 38px;
    white-space: nowrap;
    user-select: none;
    transition: border-color .2s;
}
.drp-trigger:hover { border-color: var(--uha-accent); }
.drp-trigger-icon  { color: var(--uha-accent); display: flex; align-items: center; font-size: 15px; }
.drp-trigger-label { flex: 1; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.drp-trigger-caret { color: #adb5bd; display: flex; align-items: center; }

.drp-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1060;
    background: #fff;
    border: 1px solid var(--uha-border);
    border-radius: var(--uha-radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .12);
    flex-direction: row;
    min-width: 620px;
    overflow: hidden;
}
.drp-panel.open { display: flex; }

/* Sidebar */
.drp-sidebar {
    width: 155px;
    flex-shrink: 0;
    border-right: 1px solid #f0f0f0;
    padding: 8px 0;
    background: var(--uha-bg-muted);
}
.drp-sidebar-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    padding: 8px 14px;
    font-size: 12.5px;
    color: var(--uha-muted);
    cursor: pointer;
    outline: none;
    transition: background .15s, color .15s, border-color .15s;
}
.drp-sidebar-item:hover { background: #eef2ff; color: var(--uha-accent); }
.drp-sidebar-item.active {
    background: #eef2ff;
    color: var(--uha-accent);
    font-weight: 700;
    border-left-color: var(--uha-accent);
}

/* Calendars */
.drp-right     { display: flex; flex-direction: column; flex: 1; min-width: 465px; }
.drp-calendars { display: flex; padding: 16px; gap: 20px; }
.drp-month     { flex: 1; }
.drp-cal-head  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.drp-cal-title { font-size: 13px; font-weight: 700; color: var(--uha-text); }
.drp-nav {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 8px;
    color: #adb5bd;
    font-size: 20px;
    line-height: 1;
    border-radius: 4px;
    transition: background .15s, color .15s;
}
.drp-nav:hover { background: #eef2ff; color: var(--uha-accent); }
.drp-nav.invisible { visibility: hidden; }

.drp-grid      { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.drp-day-label { font-size: 10px; font-weight: 700; color: #c0c4ce; padding-bottom: 8px; text-transform: uppercase; }
.drp-day {
    padding: 6px 0;
    font-size: 12px;
    color: var(--uha-text);
    cursor: pointer;
    border-radius: var(--uha-radius-sm);
    transition: background .12s;
}
.drp-day:hover:not(.drp-empty) { background: #eef2ff; color: var(--uha-accent); }
.drp-day.drp-today   { font-weight: 700; color: var(--uha-accent); }
.drp-day.drp-selected{ background: var(--uha-accent) !important; color: #fff !important; border-radius: var(--uha-radius-sm); }
.drp-day.drp-hover   { background: #dbeafe !important; border-radius: 0; }
.drp-day.drp-in-range{ background: #eff6ff; border-radius: 0; color: var(--uha-accent); }
.drp-day.drp-empty   { pointer-events: none; }

/* Footer */
.drp-footer {
    display: flex;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    padding: 10px 16px;
    gap: 10px;
    background: var(--uha-bg-muted);
}
.drp-range-display { flex: 1; font-size: 12px; color: var(--uha-muted); }
.drp-range-display b { color: var(--uha-text); font-weight: 600; }
.drp-btn {
    padding: 6px 16px;
    border-radius: var(--uha-radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    outline: none;
    transition: background .15s, box-shadow .15s;
}
.drp-btn-cancel { background: #fff; border-color: var(--uha-border); color: var(--uha-muted); }
.drp-btn-cancel:hover { background: #f4f5f7; }
.drp-btn-apply  { background: var(--uha-accent); border-color: var(--uha-accent); color: #fff; }
.drp-btn-apply:hover { background: #3a6fe0; box-shadow: 0 4px 10px rgba(70,128,255,.3); }

@media (max-width: 991px) {
    .drp-panel { min-width: 100%; left: 0; right: 0; }
    .drp-right { min-width: 0; }
    .drp-calendars { flex-direction: column; }
}


/* ── Avatar ──────────────────────────────────────────────────────── */
.uh-user-cell {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-width: 220px;
    padding: 4px 0;
}

.uh-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
    letter-spacing: .4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.uh-av-blue   { background: #dbeafe; color: #2563eb; }
.uh-av-purple { background: #f3e8ff; color: #7c3aed; }
.uh-av-teal   { background: #ccfbf1; color: #0f766e; }
.uh-av-rose   { background: #ffe4e6; color: #e11d48; }
.uh-av-amber  { background: #fef3c7; color: #d97706; }
.uh-av-indigo { background: #e0e7ff; color: #4338ca; }
.uh-av-neutral { background: #f3f4f6; color: #9ca3af; font-size: 15px; }

.uh-user-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.uh-user-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--uha-text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
    display: block;
    line-height: 1.3;
    transition: color .15s;
}
.uh-user-name:hover { color: var(--uha-accent); text-decoration: none; }
.uh-unknown { color: var(--uha-muted) !important; font-weight: 600; }

.uh-user-email {
    font-size: 11.5px;
    color: var(--uha-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 190px;
    display: block;
    line-height: 1.3;
}

.uh-user-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 2px;
}

/* Package badge under user */
.uh-user-pkg {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: #f0f4ff;
    color: var(--uha-accent);
    border: 1px solid #dce8ff;
    letter-spacing: .2px;
    width: fit-content;
}
.uh-user-pkg i { font-size: 9px; }
.uh-user-plan-line {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--uha-muted, #64748b);
    margin-top: 3px;
    letter-spacing: .15px;
}
.uh-pkg-platinum { background: #fdf4ff; color: #7c3aed; border-color: #e9d5ff; }
.uh-pkg-gold     { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.uh-pkg-silver   { background: #f8fafc; color: #64748b; border-color: #e2e8f0; }
.uh-pkg-free     { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }

/* ── Date cell ───────────────────────────────────────────────────── */
.uh-date-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 110px;
}
.uh-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--uha-text);
    white-space: nowrap;
}
.uh-time {
    font-size: 11.5px;
    color: var(--uha-muted);
    white-space: nowrap;
}

/* ── Type pill ───────────────────────────────────────────────────── */
.uh-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid transparent;
    letter-spacing: .2px;
}

/* Type colors — vivid, admin-friendly */
.uh-type-teal    { background: #ccfbf1; color: #0f766e; border-color: #99f6e4; }
.uh-type-purple  { background: #f3e8ff; color: #7c3aed; border-color: #ddd6fe; }
.uh-type-rose    { background: #ffe4e6; color: #e11d48; border-color: #fecdd3; }
.uh-type-amber   { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.uh-type-blue    { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.uh-type-indigo  { background: #e0e7ff; color: #4338ca; border-color: #c7d2fe; }
.uh-type-green   { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.uh-type-default { background: var(--uha-bg-muted); color: var(--uha-muted); border-color: var(--uha-border); }

/* ── Model chip ──────────────────────────────────────────────────── */
.uh-model-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--uha-radius-sm);
    background: #f0f4ff;
    border: 1px solid #dce8ff;
    font-size: 11px;
    font-weight: 700;
    color: var(--uha-accent);
    letter-spacing: .4px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uh-na { color: #d0d5dd; font-size: 14px; }

/* ── Token / usage cell ──────────────────────────────────────────── */
.uh-token-val {
    font-size: 13px;
    font-weight: 700;
    color: var(--uha-text);
}

.uh-service-metric {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: #6366f1;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    padding: 3px 9px;
    border-radius: var(--uha-radius-sm);
}

/* ── Credits charged ─────────────────────────────────────────────── */
.uh-cost-free {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 700;
    color: #15803d;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    padding: 3px 9px;
    border-radius: var(--uha-radius-sm);
}
.uh-cost-free i { font-size: 12px; }

.uh-cost-own-key {
    display: inline-flex;
    align-items: center;
    font-size: 11.5px;
    font-weight: 700;
    color: #6d28d9;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 1px solid #ddd6fe;
    padding: 4px 10px;
    border-radius: var(--uha-radius-sm);
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(109, 40, 217, .08);
}

.uh-cost-cell {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
}
.uh-cost-val {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--uha-text);
}
.uh-cost-unit {
    font-size: 11px;
    color: var(--uha-muted);
    font-weight: 600;
}

/* ── Responsive DRP ──────────────────────────────────────────────── */
@media (max-width: 991px) {
    .drp-panel {
        min-width: 96vw;
        left: 0;
        right: 0;
    }
    .drp-right { min-width: 0; }
    .drp-calendars { flex-direction: column; }
}
