/*
 * manager-ideas.css  —  رفد Manager Ideas panel
 * Prefix: mi-
 * Navy: #1a2d4d  ·  Mint: #3ecfb2  ·  RTL / Tahoma
 */

/* ═══════════════════════════════════
   Panel overlay
═══════════════════════════════════ */
.mi-panel {
  position: fixed; inset: 0; z-index: 9500;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  direction: rtl;
}
.mi-panel.mi-hidden { display: none !important; }

.mi-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.46);
  opacity: 0;
  transition: opacity 0.28s ease;
  cursor: pointer;
}
.mi-panel.mi-open .mi-backdrop { opacity: 1; }

/* ═══════════════════════════════════
   Drawer (slides from right)
═══════════════════════════════════ */
.mi-drawer {
  position: absolute; top: 0; bottom: 0; right: 0;
  width: min(520px, 100vw);
  background: #fff;
  display: flex; flex-direction: column;
  transform: translateX(102%);
  transition: transform 0.29s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -6px 0 28px rgba(26, 45, 77, 0.18);
  overflow: hidden;
}
.mi-panel.mi-open .mi-drawer { transform: translateX(0); }

.mi-scroll-lock { overflow: hidden; }

/* ── Drawer header ── */
.mi-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  background: linear-gradient(135deg, #1a2d4d 0%, #243e6e 100%);
  flex-shrink: 0;
  gap: 10px;
}
.mi-head-start { display: flex; align-items: center; gap: 10px; }
.mi-head-icon  { font-size: 22px; }
.mi-head-title { margin: 0; font-size: 17px; font-weight: bold; color: #fff; white-space: nowrap; }
.mi-head-end   { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.mi-close-btn {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  font-size: 15px; display: flex; align-items: center; justify-content: center;
  transition: background .2s; flex-shrink: 0;
}
.mi-close-btn:hover { background: rgba(255,255,255,.3); }

/* ── Body scroll area ── */
.mi-body {
  flex: 1; overflow-y: auto; background: #f2f5fb;
}

/* ═══════════════════════════════════
   Filter tabs
═══════════════════════════════════ */
.mi-tabs {
  display: flex; flex-wrap: nowrap; gap: 4px;
  padding: 14px 14px 10px;
  background: #fff;
  border-bottom: 1px solid #e5ecf7;
  overflow-x: auto; scrollbar-width: none;
  position: sticky; top: 0; z-index: 5;
}
.mi-tabs::-webkit-scrollbar { display: none; }

.mi-tab {
  flex-shrink: 0; padding: 6px 13px; border: none; border-radius: 20px;
  background: #eef2fa; color: #4a6285;
  font-family: inherit; font-size: 12.5px;
  cursor: pointer; white-space: nowrap;
  transition: background .18s, color .18s;
  display: inline-flex; align-items: center; gap: 5px;
}
.mi-tab:hover { background: #dce6f5; }
.mi-tab-active { background: #1a2d4d !important; color: #fff !important; }

.mi-tab-badge {
  background: rgba(255,255,255,.22); color: inherit;
  border-radius: 10px; padding: 1px 6px; font-size: 11px; line-height: 1.6;
}

/* ═══════════════════════════════════
   Cards grid
═══════════════════════════════════ */
.mi-cards {
  display: grid; grid-template-columns: 1fr;
  gap: 12px; padding: 14px 12px 28px;
}
@media (min-width: 560px) { .mi-cards { grid-template-columns: 1fr 1fr; } }

.mi-card {
  display: flex; border-radius: 12px; overflow: hidden; cursor: pointer;
  background: #fff; border: 1px solid #dce8f5;
  box-shadow: 0 2px 8px rgba(26,45,77,.07);
  transition: box-shadow .18s, transform .18s;
}
.mi-card:hover { box-shadow: 0 6px 22px rgba(26,45,77,.14); transform: translateY(-2px); }
.mi-card:focus { outline: 2px solid #3ecfb2; outline-offset: 2px; }

.mi-card-stripe { width: 5px; flex-shrink: 0; }
.mi-card-body   { flex: 1; padding: 13px 13px 11px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.mi-card-header { display: flex; align-items: center; justify-content: space-between; }
.mi-card-title  {
  font-size: 13.5px; font-weight: bold; color: #1a2d4d;
  margin: 0; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mi-card-desc {
  font-size: 12px; color: #5b718f; margin: 0; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mi-card-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 11px; color: #8099bb; margin-top: auto;
}
.mi-card-actions {
  display: flex; gap: 5px; margin-top: 4px;
}

/* ═══════════════════════════════════
   Icon buttons
═══════════════════════════════════ */
.mi-icon-btn {
  background: #eef2fa; border: none; border-radius: 8px;
  width: 29px; height: 29px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px;
  transition: background .14s, transform .14s;
}
.mi-icon-btn:hover     { background: #dce6f5; transform: scale(1.1); }
.mi-icon-danger:hover  { background: #fff0f2 !important; }

/* ═══════════════════════════════════
   Status pills & priority chips
═══════════════════════════════════ */
.mi-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: bold;
  white-space: nowrap;
}
.mi-s-new      { background: #e3f0ff; color: #1565c0; }
.mi-s-review   { background: #fff8e1; color: #f57f17; }
.mi-s-progress { background: #fff3e0; color: #e65100; }
.mi-s-done     { background: #e8f5e9; color: #2e7d32; }
.mi-s-rejected { background: #fce4ec; color: #c62828; }

/* card stripe colors */
.mi-card-stripe.mi-p-low      { background: #66bb6a; }
.mi-card-stripe.mi-p-medium   { background: #42a5f5; }
.mi-card-stripe.mi-p-high     { background: #ffa726; }
.mi-card-stripe.mi-p-critical { background: #ef5350; }

/* priority chips in form */
.mi-prio-opt   { display: inline-flex; align-items: center; }
.mi-prio-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.mi-prio-chip {
  display: inline-flex; align-items: center; padding: 5px 14px; border-radius: 20px;
  font-size: 12.5px; font-weight: bold; cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .14s, box-shadow .14s;
}
.mi-prio-opt input:checked + .mi-prio-chip { border-color: #1a2d4d; box-shadow: 0 0 0 2px rgba(26,45,77,.18); }
.mi-prio-chip.mi-p-low      { background: #e8f5e9; color: #2e7d32; }
.mi-prio-chip.mi-p-medium   { background: #e3f2fd; color: #1565c0; }
.mi-prio-chip.mi-p-high     { background: #fff3e0; color: #e65100; }
.mi-prio-chip.mi-p-critical { background: #fce4ec; color: #c62828; }

/* priority badges in detail view */
.mi-prio-badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 20px; font-size: 11.5px; font-weight: bold; white-space: nowrap;
}
.mi-prio-badge.mi-p-low      { background: #e8f5e9; color: #2e7d32; }
.mi-prio-badge.mi-p-medium   { background: #e3f2fd; color: #1565c0; }
.mi-prio-badge.mi-p-high     { background: #fff3e0; color: #e65100; }
.mi-prio-badge.mi-p-critical { background: #fce4ec; color: #c62828; }

/* ═══════════════════════════════════
   Empty / loading states
═══════════════════════════════════ */
.mi-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 60px 24px; color: #8099bb; text-align: center;
}
.mi-empty-icon { font-size: 52px; opacity: .55; }

.mi-spinner {
  display: inline-block; width: 24px; height: 24px;
  border: 3px solid #dce8f5; border-top-color: #3ecfb2;
  border-radius: 50%; animation: mi-spin .75s linear infinite;
}
.mi-spinner-sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes mi-spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════
   Detail view
═══════════════════════════════════ */
.mi-detail { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.mi-back-btn {
  background: none; border: none; color: #3ecfb2;
  font-family: inherit; font-size: 13px; font-weight: bold;
  cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 4px;
  align-self: flex-start;
}
.mi-back-btn:hover { color: #1a2d4d; }

.mi-detail-head  { display: flex; flex-direction: column; gap: 8px; }
.mi-detail-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.mi-detail-title {
  margin: 0; font-size: 19px; font-weight: bold; color: #1a2d4d; line-height: 1.35;
}
.mi-detail-meta  { font-size: 12px; color: #8099bb; margin: 0; }

.mi-detail-body {
  background: #f2f5fb; border-radius: 10px; padding: 15px;
  font-size: 13.5px; line-height: 1.75; color: #2c3e60;
}

/* ── Action block ── */
.mi-action-block {
  background: #fff; border-radius: 12px; padding: 16px;
  border: 1px solid #dce8f5; display: flex; flex-direction: column; gap: 14px;
}
.mi-change-section { display: flex; flex-direction: column; gap: 10px; }
.mi-change-label   { margin: 0; font-size: 13px; font-weight: bold; color: #1a2d4d; }
.mi-change-btns    { display: flex; flex-wrap: wrap; gap: 8px; }

.mi-status-btn {
  padding: 7px 16px; border: none; border-radius: 8px;
  font-family: inherit; font-size: 12.5px; font-weight: bold; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: filter .14s, transform .12s;
}
.mi-status-btn:hover { filter: brightness(.9); transform: translateY(-1px); }
.mi-status-btn.mi-s-review   { background: #fff8e1; color: #f57f17; }
.mi-status-btn.mi-s-progress { background: #fff3e0; color: #e65100; }
.mi-status-btn.mi-s-done     { background: #e8f5e9; color: #2e7d32; }
.mi-status-btn.mi-s-rejected { background: #fce4ec; color: #c62828; }

.mi-note-inp { font-size: 13px !important; }
.mi-final-note { margin: 0; font-size: 13px; color: #8099bb; font-style: italic; }

/* brief button */
.mi-btn-brief {
  align-self: flex-start; padding: 9px 18px; border: none; border-radius: 8px;
  background: linear-gradient(135deg, #2a9d8f, #3ecfb2); color: #fff;
  font-family: inherit; font-size: 13px; font-weight: bold; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: filter .14s;
}
.mi-btn-brief:hover { filter: brightness(.9); }

/* ── History timeline ── */
.mi-hist-section {
  background: #fff; border-radius: 12px; padding: 16px;
  border: 1px solid #dce8f5;
}
.mi-hist-title { margin: 0 0 14px; font-size: 14px; font-weight: bold; color: #1a2d4d; }

.mi-hist-list    { display: flex; flex-direction: column; }
.mi-hist-row     { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.mi-hist-row:not(:last-child)::after {
  content: ""; position: absolute;
  right: 6px; top: 16px; bottom: 0; width: 2px;
  background: #e5ecf7;
}

.mi-hist-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; margin-top: 3px;
  background: #3ecfb2; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(62,207,178,.45);
}
.mi-hist-content { display: flex; flex-direction: column; gap: 2px; }
.mi-hist-change  { font-size: 13px; font-weight: bold; color: #1a2d4d; }
.mi-hist-note    { font-size: 12px; color: #5b718f; font-style: italic; }
.mi-hist-meta    { font-size: 11px; color: #9bafc8; }
.mi-hist-empty   { color: #9bafc8; font-size: 13px; text-align: center; padding: 20px 0; margin: 0; }

.mi-hist-loading { padding: 24px; }

/* ═══════════════════════════════════
   Buttons (reusable)
═══════════════════════════════════ */
.mi-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 9px 20px; border-radius: 8px; border: none;
  font-family: inherit; font-size: 13.5px; font-weight: bold; cursor: pointer;
  transition: filter .15s, transform .12s;
}
.mi-btn:hover  { filter: brightness(.92); transform: translateY(-1px); }
.mi-btn:active { transform: translateY(0); }
.mi-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.mi-btn-primary { background: linear-gradient(135deg, #1a2d4d, #243e6e); color: #fff; }
.mi-btn-ghost   { background: #eef2fa; color: #4a6285; }
.mi-btn-sm      { padding: 6px 14px; font-size: 12.5px; }

/* ═══════════════════════════════════
   Dialogs
═══════════════════════════════════ */
.mi-dialog {
  position: fixed; inset: 0; margin: auto;
  width: min(540px, 95vw); max-height: 90vh;
  border: none; border-radius: 16px;
  padding: 28px 26px 24px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(26,45,77,.22);
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  direction: rtl; overflow-y: auto;
}
.mi-dialog::backdrop { background: rgba(0, 0, 0, .46); }
.mi-dialog[open] { display: flex; flex-direction: column; }

.mi-dialog-x {
  position: absolute; top: 14px; left: 14px;
  background: #eef2fa; border: none; border-radius: 50%;
  width: 30px; height: 30px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #4a6285; transition: background .15s;
}
.mi-dialog-x:hover { background: #dce6f5; }

.mi-dialog-title { margin: 0 0 18px; font-size: 17px; font-weight: bold; color: #1a2d4d; }

/* ── Form ── */
.mi-form { display: flex; flex-direction: column; gap: 14px; }
.mi-field { display: flex; flex-direction: column; gap: 5px; }
.mi-form-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mi-form-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 6px; }
.mi-prio-row  { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 480px) { .mi-form-row { grid-template-columns: 1fr; } }

.mi-label { font-size: 12.5px; font-weight: bold; color: #1a2d4d; }
.mi-req   { color: #e53935; }

.mi-input {
  width: 100%; box-sizing: border-box;
  padding: 9px 12px; border: 1.5px solid #c8d8ee;
  border-radius: 8px; font-family: inherit; font-size: 13.5px;
  color: #1a2d4d; background: #f8faff;
  transition: border-color .15s, background .15s; outline: none;
}
.mi-input:focus  { border-color: #3ecfb2; background: #fff; }
.mi-textarea     { resize: vertical; min-height: 96px; }

/* ── Generate Brief dialog ── */
.mi-brief-dialog { width: min(640px, 95vw); }
.mi-brief-note {
  font-size: 12.5px; color: #5b718f; margin: -6px 0 14px; line-height: 1.65;
}
.mi-brief-note strong { color: #c62828; }
.mi-brief-wrap {
  background: #f2f5fb; border-radius: 10px; border: 1px solid #dce8f5;
  padding: 14px; margin-bottom: 16px;
  max-height: 340px; overflow-y: auto; flex: 1;
}
.mi-brief-pre {
  margin: 0; font-family: "Courier New", Courier, monospace;
  font-size: 11.5px; line-height: 1.7; color: #2c3e60;
  white-space: pre-wrap; word-break: break-word;
  direction: ltr; text-align: left;
}

/* ═══════════════════════════════════
   Trigger button (injected into topbar)
═══════════════════════════════════ */
.mi-trigger-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px; border: 1.5px solid rgba(62,207,178,.45);
  background: rgba(62,207,178,.12); color: #fff;
  font-family: inherit; font-size: 12.5px; font-weight: bold; cursor: pointer;
  transition: background .18s, border-color .18s;
  white-space: nowrap;
}
.mi-trigger-btn:hover {
  background: rgba(62,207,178,.25); border-color: rgba(62,207,178,.7);
}
.mi-trigger-icon { font-size: 16px; }

/* ═══════════════════════════════════
   Toast notifications
═══════════════════════════════════ */
#mi-toasts {
  position: fixed; bottom: 24px; right: 24px; z-index: 99999;
  display: flex; flex-direction: column; gap: 8px;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  pointer-events: none;
}
.mi-toast {
  padding: 11px 18px; border-radius: 10px; font-size: 13.5px;
  color: #fff; max-width: 310px;
  transform: translateX(20px); opacity: 0;
  transition: transform .24s ease, opacity .24s ease;
  direction: rtl; pointer-events: all;
  box-shadow: 0 4px 18px rgba(0,0,0,.18);
}
.mi-toast-in        { transform: translateX(0); opacity: 1; }
.mi-toast-success   { background: linear-gradient(135deg, #2a9d8f, #3ecfb2); }
.mi-toast-error     { background: linear-gradient(135deg, #b71c1c, #e53935); }

/* ═══════════════════════════════════
   Mobile overrides
═══════════════════════════════════ */
@media (max-width: 480px) {
  .mi-drawer { width: 100vw; }
  .mi-trigger-lbl { display: none; }
  .mi-trigger-btn { padding: 6px 10px; }
  .mi-dialog {
    padding: 20px 16px 18px;
    border-radius: 16px 16px 0 0;
    top: auto; bottom: 0; left: 0; right: 0;
    max-height: 92vh; width: 100%;
    margin: 0;
  }
  .mi-dialog::backdrop { align-items: flex-end; }
  #mi-toasts { right: 12px; bottom: 16px; left: 12px; }
  .mi-toast  { max-width: 100%; }
}
