/*
 |--------------------------------------------------------------
 | Project custom styles
 |--------------------------------------------------------------
 */

:root {
  --app-primary: #0d6efd; /* مقدار پیش‌فرض - توسط لیاوت داینامیک override می‌شود */
  --app-bg: #f6f8fb;
  --sidebar-link: #334155;
}

html, body {
  scroll-behavior: smooth;
}

body {
  font-family: Vazirmatn, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: var(--app-bg);
}

/* Ensure form controls inherit font */
button, input, optgroup, select, textarea {
  font-family: inherit;
}

/* Font Awesome v4/v5-style compatibility
   Allows using icons as: <i class="fa fa-xxx"></i>
   Prefer FA5 Free; fall back to FA6 Free if present locally */

 

/* Layout helpers */
.min-h-main {
  min-height: calc(100vh - 6rem);
}

/* Cards (auth and common) */
.auth-card {
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.brand-avatar {
  width: 56px;
  height: 56px;
  object-fit: cover;
}

/* Consistent tiny avatar size for tables/lists */
.avatar-34 {
  width: 34px;
  height: 34px;
  object-fit: cover;
}

/* Standard admin preview size (tables/lists) */
.avatar-60 {
  width: 60px;
  height: 60px;
  object-fit: cover;
}

/* Admin shell & sidebar */
.admin-shell {
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  flex: 0 0 260px; /* prevent collapsing in flex container on desktop */
}

.sidebar .nav-link {
  color: var(--sidebar-link);
  transition: padding .12s ease, background-color .12s ease, color .12s ease;
}

.sidebar .nav-link.active {
  background-color: var(--app-primary);
  color: #fff;
}

/* Increase padding for active sidebar items (blue background area) */
#adminSidebar .nav-link.active {
  padding-right: .75rem !important;
  padding-left: .75rem !important;
}
#adminSidebar .nav-link.active:hover,
#adminSidebar .nav-link.active:focus {
  padding-right: .75rem !important;
  padding-left: .75rem !important;
}

/* Hover padding for sidebar links (keep base px-0 in markup; add slight space on hover) */
#adminSidebar .nav-link:hover,
#adminSidebar .nav-link:focus {
  padding-right: .5rem !important;
  padding-left: .5rem !important;
}

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    top: 56px; /* navbar height */
    bottom: 0;
    z-index: 1030;
    transform: translateX(100%);
    transition: transform .2s ease-in-out;
    background: #fff;
  }
  .sidebar.show {
    transform: translateX(0);
  }
}

/* Example utility overrides */
.text-primary {
  color: var(--app-primary) !important;
}

/* Bootstrap primary button: Instagram-like gradient (global override) */
:root {
  --ig-primary-gradient: linear-gradient(45deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5);
}

.btn-primary {
  color: #fff !important;
  border-color: transparent !important;
  background-color: transparent !important;
  background-image: var(--ig-primary-gradient) !important;
  background-size: 140% 140%;
  background-position: 50% 50%;
  box-shadow: 0 6px 18px rgba(214, 41, 118, 0.18);
}

.btn-primary:hover {
  color: #fff !important;
  border-color: transparent !important;
  background-color: transparent !important;
  background-image: var(--ig-primary-gradient) !important;
  background-position: 65% 35%;
  filter: saturate(1.08) brightness(1.02);
}

.btn-check:focus + .btn-primary,
.btn-primary:focus,
.btn-primary:focus-visible {
  color: #fff !important;
  border-color: transparent !important;
  background-color: transparent !important;
  background-image: var(--ig-primary-gradient) !important;
  box-shadow:
    0 6px 18px rgba(214, 41, 118, 0.18),
    0 0 0 0.25rem rgba(214, 41, 118, 0.22) !important;
}

.btn-check:active + .btn-primary,
.btn-check:checked + .btn-primary,
.btn-primary.active,
.btn-primary:active,
.show > .btn-primary.dropdown-toggle {
  color: #fff !important;
  border-color: transparent !important;
  background-color: transparent !important;
  background-image: var(--ig-primary-gradient) !important;
  filter: saturate(1.02) brightness(0.96);
  box-shadow: 0 6px 18px rgba(214, 41, 118, 0.12);
}

.btn-primary:disabled,
.btn-primary.disabled {
  color: rgba(255, 255, 255, 0.92) !important;
  border-color: transparent !important;
  background-color: transparent !important;
  background-image: var(--ig-primary-gradient) !important;
  opacity: 0.55 !important;
  filter: grayscale(0.12) saturate(0.8);
  box-shadow: none;
}

/* Action buttons: unified styling */
.action-buttons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.action-buttons form {
  margin: 0;
}
.action-btn {
  /* Icon-only, fixed-size action buttons across admin tables */
  width: 34px;
  height: 34px;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  line-height: 1;
  font-size: 0.95rem;
  text-decoration: none;

  /* Variant-driven colors */
  background: var(--action-bg, transparent) !important;
  border-color: var(--action-border, rgba(15, 23, 42, 0.18)) !important;
  color: var(--action-color, #0f172a) !important;
  box-shadow: none !important;
}
.action-btn:hover,
.action-btn:focus {
  background: var(--action-hover-bg, rgba(15, 23, 42, 0.06)) !important;
  border-color: var(--action-hover-border, rgba(15, 23, 42, 0.28)) !important;
  color: var(--action-hover-color, #0f172a) !important;
  transform: translateY(-0.5px);
}
.action-btn:active {
  transform: translateY(0);
}
.action-btn i {
  margin: 0 !important;
}

/* Action button variants (exact, consistent palette) */
.action-btn--view {
  --action-bg: rgba(37, 99, 235, 0.08);
  --action-border: rgba(37, 99, 235, 0.28);
  --action-color: #1d4ed8;
  --action-hover-bg: rgba(37, 99, 235, 0.14);
  --action-hover-border: rgba(37, 99, 235, 0.4);
  --action-hover-color: #1e40af;
}
.action-btn--edit {
  --action-bg: rgba(99, 102, 241, 0.08);
  --action-border: rgba(99, 102, 241, 0.28);
  --action-color: #4f46e5;
  --action-hover-bg: rgba(99, 102, 241, 0.14);
  --action-hover-border: rgba(99, 102, 241, 0.4);
  --action-hover-color: #4338ca;
}
.action-btn--toggle {
  --action-bg: rgba(245, 158, 11, 0.12);
  --action-border: rgba(245, 158, 11, 0.35);
  --action-color: #b45309;
  --action-hover-bg: rgba(245, 158, 11, 0.18);
  --action-hover-border: rgba(245, 158, 11, 0.48);
  --action-hover-color: #92400e;
}
.action-btn--delete {
  --action-bg: rgba(239, 68, 68, 0.1);
  --action-border: rgba(239, 68, 68, 0.32);
  --action-color: #dc2626;
  --action-hover-bg: rgba(239, 68, 68, 0.16);
  --action-hover-border: rgba(239, 68, 68, 0.44);
  --action-hover-color: #b91c1c;
}

/* Shared image editor for all image upload inputs. */
body.image-editor-open {
  overflow: hidden;
}

.image-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  direction: rtl;
}

.image-editor-modal.is-open {
  display: flex;
}

.image-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(6px);
}

.image-editor-dialog {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-height: min(94vh, 920px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ig-text, #1f2937);
  background: var(--ig-surface, #ffffff);
  border: 1px solid var(--ig-border, rgba(15, 23, 42, 0.12));
  border-radius: 1.25rem;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  outline: none;
}

.image-editor-header,
.image-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-color: var(--ig-border, rgba(15, 23, 42, 0.1));
}

.image-editor-header {
  border-bottom: 1px solid var(--ig-border, rgba(15, 23, 42, 0.1));
}

.image-editor-footer {
  border-top: 1px solid var(--ig-border, rgba(15, 23, 42, 0.1));
}

.image-editor-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.image-editor-header p {
  margin: 0.25rem 0 0;
  color: var(--ig-muted, #64748b);
  font-size: 0.86rem;
}

.image-editor-icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--ig-border, rgba(15, 23, 42, 0.1));
  border-radius: 999px;
  color: inherit;
  background: var(--ig-surface-soft, #f8fafc);
  font-size: 1.35rem;
  line-height: 1;
}

.image-editor-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  padding: 1rem;
  overflow: auto;
}

.image-editor-stage {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border: 1px dashed var(--ig-border, rgba(15, 23, 42, 0.16));
  border-radius: 1rem;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.13) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.13) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.13) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.13) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.image-editor-frame {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2);
}

.image-editor-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #fff;
}

.image-editor-crop {
  position: absolute;
  border: 2px solid #ffffff;
  box-shadow:
    0 0 0 9999px rgba(15, 23, 42, 0.42),
    0 0 0 1px rgba(15, 23, 42, 0.7);
  cursor: move;
  touch-action: none;
}

.image-editor-crop::before,
.image-editor-crop::after {
  content: "";
  position: absolute;
  inset: 33.333% 0 auto;
  height: 1px;
  background: rgba(255, 255, 255, 0.72);
}

.image-editor-crop::after {
  inset: 66.666% 0 auto;
}

.image-editor-crop span {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--app-primary, #0d6efd);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.28);
  touch-action: none;
}

.image-editor-crop [data-handle="nw"] {
  top: -9px;
  left: -9px;
  cursor: nwse-resize;
}

.image-editor-crop [data-handle="ne"] {
  top: -9px;
  right: -9px;
  cursor: nesw-resize;
}

.image-editor-crop [data-handle="sw"] {
  bottom: -9px;
  left: -9px;
  cursor: nesw-resize;
}

.image-editor-crop [data-handle="se"] {
  right: -9px;
  bottom: -9px;
  cursor: nwse-resize;
}

.image-editor-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.image-editor-section {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid var(--ig-border, rgba(15, 23, 42, 0.1));
  border-radius: 1rem;
  background: var(--ig-surface-soft, #f8fafc);
}

.image-editor-section strong {
  font-size: 0.92rem;
}

.image-editor-section label {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  color: var(--ig-muted, #64748b);
  font-size: 0.84rem;
}

.image-editor-section input[type="range"] {
  width: 100%;
  accent-color: var(--app-primary, #0d6efd);
}

.image-editor-chip-row,
.image-editor-tool-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.image-editor-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.image-editor-chip-row button,
.image-editor-tool-grid button {
  border: 1px solid var(--ig-border, rgba(15, 23, 42, 0.12));
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  color: inherit;
  background: var(--ig-surface, #fff);
  font-size: 0.83rem;
}

.image-editor-chip-row button.is-active {
  color: #fff;
  border-color: transparent;
  background: var(--app-primary, #0d6efd);
}

.image-editor-footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

[data-theme="dark"] .image-editor-backdrop {
  background: rgba(0, 0, 0, 0.72);
}

[data-theme="dark"] .image-editor-frame canvas {
  background: #0f172a;
}

@media (max-width: 767.98px) {
  .image-editor-modal {
    align-items: stretch;
    padding: 0;
  }

  .image-editor-dialog {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .image-editor-header,
  .image-editor-footer {
    padding: 0.85rem;
  }

  .image-editor-body {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .image-editor-stage {
    min-height: 240px;
    padding: 0.75rem;
  }

  .image-editor-tool-grid {
    grid-template-columns: 1fr 1fr;
  }

  .image-editor-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .image-editor-footer .btn,
  .image-editor-footer-actions {
    width: 100%;
  }

  .image-editor-footer-actions .btn {
    flex: 1 1 0;
  }
}

/* Current shared image editor implementation. */
.image-editor-modal:not([hidden]) {
  display: flex;
}

.image-editor-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(6px);
}

.image-editor-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-height: min(94vh, 920px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ig-text, #1f2937);
  background: var(--ig-surface, #ffffff);
  border: 1px solid var(--ig-border, rgba(15, 23, 42, 0.12));
  border-radius: 1.25rem;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  outline: none;
}

.image-editor-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ig-border, rgba(15, 23, 42, 0.1));
}

.image-editor-modal__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.image-editor-modal__subtitle,
.image-editor-modal__hint {
  margin: 0.25rem 0 0;
  color: var(--ig-muted, #64748b);
  font-size: 0.86rem;
}

.image-editor-modal__icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--ig-border, rgba(15, 23, 42, 0.1));
  border-radius: 999px;
  color: inherit;
  background: var(--ig-surface-soft, #f8fafc);
  font-size: 1.35rem;
  line-height: 1;
}

.image-editor-modal__body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  padding: 1rem;
  overflow: auto;
}

.image-editor-modal__stage-wrap {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border: 1px dashed var(--ig-border, rgba(15, 23, 42, 0.16));
  border-radius: 1rem;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.13) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.13) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.13) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.13) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.image-editor-modal__stage {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2);
}

.image-editor-modal__stage canvas {
  width: 100%;
  max-width: min(100%, 74vw);
  max-height: 70vh;
  height: auto;
  display: block;
  background: #fff;
}

.image-editor-crop-box {
  position: absolute;
  border: 2px solid #ffffff;
  box-shadow:
    0 0 0 9999px rgba(15, 23, 42, 0.42),
    0 0 0 1px rgba(15, 23, 42, 0.7);
  cursor: move;
  touch-action: none;
}

.image-editor-crop-box::before,
.image-editor-crop-box::after {
  content: "";
  position: absolute;
  inset: 33.333% 0 auto;
  height: 1px;
  background: rgba(255, 255, 255, 0.72);
}

.image-editor-crop-box::after {
  inset: 66.666% 0 auto;
}

.image-editor-crop-box__handle {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--app-primary, #0d6efd);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.28);
  touch-action: none;
}

.image-editor-crop-box__handle--nw {
  top: -9px;
  left: -9px;
  cursor: nwse-resize;
}

.image-editor-crop-box__handle--ne {
  top: -9px;
  right: -9px;
  cursor: nesw-resize;
}

.image-editor-crop-box__handle--sw {
  bottom: -9px;
  left: -9px;
  cursor: nesw-resize;
}

.image-editor-crop-box__handle--se {
  right: -9px;
  bottom: -9px;
  cursor: nwse-resize;
}

.image-editor-modal__controls {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.image-editor-modal__group {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid var(--ig-border, rgba(15, 23, 42, 0.1));
  border-radius: 1rem;
  background: var(--ig-surface-soft, #f8fafc);
}

.image-editor-modal__group-title {
  font-size: 0.92rem;
  font-weight: 800;
}

.image-editor-modal__button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.image-editor-modal__button-row--footer {
  justify-content: flex-end;
}

.image-editor-range {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  color: var(--ig-muted, #64748b);
  font-size: 0.84rem;
}

.image-editor-range input[type="range"] {
  width: 100%;
  accent-color: var(--app-primary, #0d6efd);
}

[data-theme="dark"] .image-editor-modal__backdrop {
  background: rgba(0, 0, 0, 0.72);
}

[data-theme="dark"] .image-editor-modal__stage canvas {
  background: #0f172a;
}

@media (max-width: 767.98px) {
  .image-editor-modal__dialog {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .image-editor-modal__header {
    padding: 0.85rem;
  }

  .image-editor-modal__body {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .image-editor-modal__stage-wrap {
    min-height: 240px;
    padding: 0.75rem;
  }

  .image-editor-modal__stage canvas {
    max-width: calc(100vw - 1.5rem);
    max-height: 52vh;
  }

  .image-editor-modal__button-row--footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .image-editor-modal__button-row--footer .btn {
    width: 100%;
  }
}


