/**
 * Atproo EDA AI — Admin CSS
 *
 * The admin panel is built dynamically via buildAdminPanel() in js/admin.js
 * and injects its own <style> block.  This external file provides supplementary
 * overrides and is loaded by index.html so the admin screen background, z-index
 * and layout are correct from the moment the element is appended.
 */

/* Admin screen base */
#admin-screen {
  position: fixed; inset: 0; z-index: 300;
  display: none; flex-direction: row;
  background: #0F1117;
  font-family: Inter, -apple-system, sans-serif;
  color: #F0F4FF;
}

/* These rules match the <style> injected by buildAdminPanel() — duplicate here
   so caching/flash-of-unstyled-content is minimized. */
.adm-nav {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  color: #8899BB; font-size: 12px; font-weight: 500; transition: all .15s;
}
.adm-nav:hover  { background: rgba(255,255,255,.04); color: #F0F4FF; }
.adm-nav.active { background: rgba(239,68,68,.1); color: #EF4444; border: 1px solid rgba(239,68,68,.15); }

.adm-card { background: #161B27; border: 1px solid rgba(255,255,255,.07); border-radius: 10px; padding: 16px; }
.adm-stat { background: #1C2333; border-radius: 8px; padding: 14px; }

.adm-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.adm-table th { padding: 10px 12px; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: #4A5570; border-bottom: 1px solid rgba(255,255,255,.07); }
.adm-table td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.04); color: #8899BB; vertical-align: middle; }
.adm-table tr:hover td { background: rgba(255,255,255,.02); color: #F0F4FF; }

.adm-badge { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 50px; font-size: 10px; font-weight: 700; }
.adm-btn   { padding: 7px 14px; border-radius: 7px; font-size: 11px; font-weight: 700; cursor: pointer; border: none; transition: all .15s; font-family: inherit; }

/* New in Full Edition: shared form controls used across the added sections
   (Promo Codes, Notifications, Security, Auto Save, Site Settings, etc.) */
.adm-input { width: 100%; background: #0F1117; border: 1px solid rgba(255,255,255,.07); border-radius: 8px; padding: 9px 12px; color: #F0F4FF; font-size: 13px; outline: none; font-family: inherit; }
.adm-label { font-size: 11px; color: #4A5570; display: block; margin-bottom: 5px; }

/* Toggle switch (used on the Auto Save page) */
.adm-toggle { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.adm-toggle input { opacity: 0; width: 0; height: 0; }
.adm-toggle .slider { position: absolute; cursor: pointer; inset: 0; background: rgba(255,255,255,.1); border-radius: 24px; transition: .2s; }
.adm-toggle .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.adm-toggle input:checked + .slider { background: #00E5A0; }
.adm-toggle input:checked + .slider:before { transform: translateX(18px); }

/* ═══════════════════════════════════════════════════════
   MOBIL MOSLASHUV (avval umuman yo'q edi — 230px sidebar
   tor ekranlarda kontentni siqib qo'yardi)
   ═══════════════════════════════════════════════════════ */

/* Desktop: gamburger tugma va orqa fon (backdrop) hech qachon ko'rinmaydi */
.adm-mobile-toggle, .adm-mobile-close, .adm-sidebar-backdrop, .adm-mobile-exit {
  display: none;
}

@media (max-width: 860px) {
  #admin-screen { overflow: hidden; }

  /* Sidebar — ekrandan tashqarida boshlanadi, "☰" bosilganda suzib kiradi */
  #admin-screen .adm-sidebar {
    position: fixed !important;
    top: 0; bottom: 0; left: 0;
    width: 78vw !important;
    max-width: 280px;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 8px 0 32px rgba(0,0,0,.35);
  }
  #admin-screen .adm-sidebar.open { transform: translateX(0); }

  .adm-sidebar-backdrop {
    display: block;
    position: fixed; inset: 0; z-index: 19;
    background: rgba(0,0,0,.5);
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
  }
  .adm-sidebar-backdrop.on { opacity: 1; pointer-events: auto; }

  .adm-mobile-toggle { display: flex !important; }
  .adm-mobile-close  { display: flex !important; }

  /* Yuqori panelda joy tejash uchun ba'zi elementlarni yashiramiz —
     "Ilovaga qaytish" pastdagi doimiy tugmaga ko'chadi. */
  .adm-hide-mobile { display: none !important; }

  .adm-mobile-exit {
    display: block;
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 15;
    background: rgba(0,229,160,.14); border: 1px solid rgba(0,229,160,.3);
    border-radius: 12px; padding: 12px; text-align: center;
    color: #00E5A0; font-size: 13px; font-weight: 800; cursor: pointer;
  }
  #admin-screen > div[style*="flex:1"] { padding-bottom: 64px; }

  /* Kontent qismida joy tejash */
  #adm-content { padding: 14px !important; }
  .adm-card { padding: 12px !important; }

  /* Qo'llab-quvvatlash sahifasi (ro'yxat + suhbat) — yon-yonma emas, tepa-past */
  #adm-content > div[style*="display:flex"][style*="height:calc(100vh"] {
    flex-direction: column !important;
    height: auto !important;
  }
  #adm-support-list { max-height: 240px; }
  #adm-support-thread { min-height: 240px; }

  /* Kenglik-qattiq-belgilangan kartalar tor ekranda to'liq kenglikni egallasin */
  .adm-card[style*="width:300px"] { width: 100% !important; }

  /* Jadvallar gorizontal skroll bilan (ustunlar siqilib, matn kesilib qolmasin) */
  .adm-table { display: block; overflow-x: auto; white-space: nowrap; }
}