/* ══════════════════════════════════════════════════════════════
   MINDSUP AI — usage.css (Usage Report Page)
   Brand: Charcoal #1f271b, White #fbfffe, Purple #741054
   ══════════════════════════════════════════════════════════════ */
   :root {
    --black: #1f271b; 
    --black-hover: #2a332c; 
    --white: #fbfffe;
    
    --purple: #741054; 
    --purple-light: #9c1b74; 
    --purple-dark: #580c40;
    
    --bg: #151a12; 
    --gray-100: #f2f5f4;
    --gray-200: #e0e5e3;
    --gray-400: #a3aba8;
    --gray-600: #575e5a;
    
    --bdr: rgba(116, 16, 84, 0.15); 
    --bdr-mid: rgba(116, 16, 84, 0.3);
    
    --sh-sm: 0 2px 8px rgba(0,0,0,.05); 
    --sh-md: 0 8px 24px rgba(0,0,0,.08); 
    --sh-purple: 0 4px 16px rgba(116, 16, 84, 0.2);
    
    --font-body: 'Vazirmatn', sans-serif;
    --font-code: 'JetBrains Mono', monospace;
    
    --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 24px;
    --t: .2s cubic-bezier(.22,1,.36,1);
    --sidebar-w: 260px;
    --topbar-h: 70px;
  }
  
  *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
  body{
    font-family:var(--font-body); background:var(--gray-100); color:var(--black);
    direction:rtl; display:flex; min-height:100dvh; overflow-x:hidden;
  }
  a{text-decoration:none;color:inherit}
  button{cursor:pointer;font-family:inherit;border:none;background:none;outline:none}
  ul{list-style:none}
  ::-webkit-scrollbar{width:6px;height:6px;}
  ::-webkit-scrollbar-track{background:transparent}
  ::-webkit-scrollbar-thumb{background:var(--gray-200);border-radius:3px}
  ::-webkit-scrollbar-thumb:hover{background:var(--gray-400)}
  
  /* ─── SIDEBAR & BASE LAYOUT (SHARED WITH DASHBOARD) ─── */
  .ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.4; }
  .amb-1 { position: absolute; border-radius: 50%; filter: blur(100px); width: 50vw; height: 50vw; background: rgba(116,16,84,0.08); top: -20%; right: -10%; animation: ambDrift 15s ease-in-out infinite alternate; }
  
  .sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); height: 100dvh; background: var(--black); border-left: 1px solid rgba(255,255,255,0.05); display: flex; flex-direction: column; z-index: 200; transition: transform var(--t); }
  .sidebar-head { height: 70px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.05); }
  .logo-link { display: flex; align-items: center; gap: 10px; }
  .logo-badge { background: var(--purple); color: var(--white); font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 4px; }
  .logo-name { font-weight: 800; font-size: 18px; color: var(--white); }
  .logo-tagline { display: block; font-size: 10px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 1px; }
  .sidebar-close-btn { color: var(--gray-400); display: none; }
  
  .main-nav { flex: 1; padding: 20px 16px; display: flex; flex-direction: column; gap: 4px; }
  .nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--gray-200); font-size: 14px; transition: var(--t); }
  .nav-item svg { color: var(--gray-400); transition: var(--t); }
  .nav-item:hover { background: var(--black-hover); color: var(--white); }
  .nav-item.active { background: rgba(116,16,84,0.2); color: var(--purple-light); font-weight: 700; }
  .nav-item.active svg { color: var(--purple-light); }
  
  .sidebar-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,0.05); }
  .sf-user { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md); background: rgba(255,255,255,0.05); }
  .sf-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--purple); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--white); flex-shrink: 0; }
  .sf-info { flex: 1; min-width: 0; }
  .sf-name { display: block; font-size: 13px; font-weight: 700; color: var(--white); }
  .sf-plan { font-size: 11px; color: var(--gray-400); }
  .sf-plan-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--purple-light); margin-left: 4px; }
  
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 150; opacity: 0; transition: var(--t); }
  
  .dashboard-wrapper { flex: 1; display: flex; flex-direction: column; z-index: 1; height: 100dvh; overflow-y: auto; }
  
  /* ─── TOPBAR ─── */
  .topbar { height: 70px; min-height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; background: var(--white); border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 100; }
  .tb-left, .tb-right { display: flex; align-items: center; gap: 16px; }
  .tb-btn { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--gray-100); color: var(--gray-600); display: flex; align-items: center; justify-content: center; transition: var(--t); }
  .tb-btn:hover { background: rgba(116,16,84,0.1); color: var(--purple); }
  .page-title { font-size: 18px; font-weight: 800; color: var(--black); }
  
  .date-filter { font-family: var(--font-body); padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--gray-200); background: var(--white); color: var(--black); font-size: 13px; outline: none; cursor: pointer; }
  .date-filter:focus { border-color: var(--purple); }
  .btn-outline { background: transparent; border: 1px solid var(--gray-200); color: var(--black); border-radius: var(--r-sm); font-size: 13px; font-weight: 700; transition: var(--t); }
  .btn-outline:hover { background: var(--gray-100); border-color: var(--purple); color: var(--purple); }
  
  /* ─── BENTO GRID & CARDS ─── */
  .bento-container { padding: 24px; display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; }
  .glass-panel { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--r-xl); box-shadow: var(--sh-sm); overflow: hidden; transition: var(--t); }
  .glass-panel:hover { border-color: rgba(116, 16, 84, 0.3); box-shadow: var(--sh-md); transform: translateY(-2px); }
  
  .span-12 { grid-column: span 12; }
  .span-8 { grid-column: span 8; }
  .span-6 { grid-column: span 6; }
  .span-4 { grid-column: span 4; }
  .span-3 { grid-column: span 3; }
  
  /* Stats Cards */
  .stat-box { padding: 24px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; }
  .stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
  .stat-title { font-size: 13px; color: var(--gray-600); font-weight: 600; }
  .stat-val { font-size: 28px; font-weight: 900; font-family: var(--font-code); color: var(--black); }
  .stat-trend { font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 4px; display: inline-block; align-self: flex-start; }
  .stat-trend.up { background: rgba(16, 163, 127, 0.1); color: #10a37f; }
  .stat-trend.down { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
  
  /* ─── CSS CHART ─── */
  .chart-section { padding: 24px; display: flex; flex-direction: column; }
  .card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
  .card-head h3 { font-size: 16px; font-weight: 800; color: var(--black); }
  
  .css-chart { flex: 1; display: flex; gap: 16px; min-height: 250px; position: relative; padding-top: 20px;}
  .chart-y-axis { display: flex; flex-direction: column; justify-content: space-between; color: var(--gray-400); font-size: 11px; font-family: var(--font-code); padding-bottom: 24px; text-align: left; }
  .chart-bars { flex: 1; display: flex; justify-content: space-around; align-items: flex-end; border-bottom: 1px solid var(--gray-200); padding-bottom: 8px; position: relative; }
  
  /* خطوط راهنمای افقی نمودار */
  .chart-bars::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: linear-gradient(to bottom, var(--gray-100) 1px, transparent 1px);
    background-size: 100% 25%; z-index: 0; pointer-events: none;
  }
  
  .bar-group { display: flex; flex-direction: column; align-items: center; gap: 12px; height: 100%; justify-content: flex-end; z-index: 1; width: 12%; }
  .bar { width: 100%; max-width: 40px; background: linear-gradient(to top, var(--purple-dark), var(--purple-light)); border-radius: 6px 6px 0 0; height: 0; /* انیمیشن با JS اعمال می‌شود */ transition: height 1s ease-out, filter 0.2s; position: relative; cursor: pointer; }
  .bar:hover { filter: brightness(1.2); }
  .bar-group span { font-size: 11px; color: var(--gray-600); }
  
  /* Tooltip نمودار */
  .tooltip { position: absolute; top: -35px; left: 50%; transform: translateX(-50%); background: var(--black); color: var(--white); font-size: 10px; padding: 4px 8px; border-radius: 4px; opacity: 0; pointer-events: none; transition: opacity 0.2s; white-space: nowrap; font-family: var(--font-code); z-index: 10;}
  .tooltip::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -4px; border-width: 4px; border-style: solid; border-color: var(--black) transparent transparent transparent; }
  .bar:hover .tooltip { opacity: 1; }
  
  /* ─── BREAKDOWN SECTION ─── */
  .breakdown-section { padding: 24px; }
  .breakdown-list { display: flex; flex-direction: column; gap: 20px; }
  .bd-item { display: flex; flex-direction: column; gap: 8px; }
  .bd-info { display: flex; align-items: center; gap: 8px; font-size: 13px; }
  .bd-dot { width: 10px; height: 10px; border-radius: 50%; }
  .bd-info strong { color: var(--black); flex: 1; }
  .bd-percent { font-weight: 700; color: var(--gray-600); font-family: var(--font-code); }
  .bd-bar { width: 100%; height: 6px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
  .bd-fill { height: 100%; border-radius: 4px; width: 0; transition: width 1s ease-out; }
  
  /* ─── LOG TABLE ─── */
  .log-section { padding: 24px; }
  .log-actions { display: flex; gap: 12px; }
  .log-search { padding: 8px 12px; border: 1px solid var(--gray-200); border-radius: var(--r-sm); font-family: var(--font-body); font-size: 13px; outline: none; background: var(--gray-100); }
  .log-search:focus { border-color: var(--purple); background: var(--white); }
  
  .table-responsive { overflow-x: auto; margin-top: 16px; }
  .log-table { width: 100%; border-collapse: collapse; text-align: right; }
  .log-table th { font-size: 12px; color: var(--gray-400); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
  .log-table td { padding: 16px; font-size: 13px; color: var(--black); border-bottom: 1px solid var(--gray-100); white-space: nowrap; font-weight: 500; }
  .log-table tr:hover td { background: rgba(116, 16, 84, 0.02); }
  
  .badge { padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; font-family: var(--font-code); }
  .badge.gpt { background: rgba(16, 163, 127, 0.1); color: #10a37f; }
  .badge.claude { background: rgba(204, 120, 92, 0.1); color: #cc785c; }
  .badge.mj { background: rgba(116, 16, 84, 0.1); color: var(--purple); }
  .badge.gemini { background: rgba(66, 133, 244, 0.1); color: #4285f4; }
  
  .status { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
  .status.ok { background: #e6f6f1; color: #10a37f; }
  .status.err { background: #fee2e2; color: #ef4444; }
  
  /* ─── RESPONSIVE ─── */
  @media (max-width: 1200px) {
    .span-3 { grid-column: span 6; }
    .span-8, .span-4 { grid-column: span 12; }
  }
  
  @media (max-width: 768px) {
    .sidebar { position: fixed; right: 0; top: 0; transform: translateX(100%); z-index: 300; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close-btn { display: block; }
    .sidebar-overlay.visible { display: block; opacity: 1; }
    
    .bento-container { padding: 16px; gap: 16px; }
    .span-3 { grid-column: span 12; }
    .topbar { padding: 0 16px; }
  }
  
  @media (min-width: 769px) {
    #sidebarToggle { display: none; }
  }