/* ============================================================
   Pigz — Components Stylesheet
   ============================================================ */

/* ============ FORMS ============ */
.field { display: block; }
.field > span {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="tel"],
.field input[type="url"],
.field input[type="number"],
.field input[type="date"],
.field input[type="file"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-0);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.field textarea {
  resize: vertical;
  min-height: 80px;
}

/* ============ ALERTS ============ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.7;
}
.alert-error {
  background: rgba(239,68,68,.1);
  border: 1px solid #7f1d1d;
  color: #fca5a5;
}
.alert-success {
  background: rgba(34,197,94,.1);
  border: 1px solid #14532d;
  color: #4ade80;
}
.alert-info {
  background: rgba(59,130,246,.1);
  border: 1px solid #1e3a8a;
  color: #93c5fd;
}
.alert a {
  color: var(--primary-light);
  text-decoration: underline;
}

/* ============================================================
   INPUT WITH ICON
   متن از راست، آیکون در چپ
   ============================================================ */
.input-with-icon {
  position: relative;
  display: block;
}
.input-with-icon input {
  width: 100%;
  padding: 12px 14px 12px 46px;
  background: var(--bg-0);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s, background .2s;
  direction: rtl;
  text-align: right;
  box-sizing: border-box;
}
.input-with-icon input::placeholder {
  color: #4a5878;
  font-size: 13px;
  text-align: right;
  direction: rtl;
}
.input-with-icon input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-1);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
.input-with-icon .input-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  right: auto;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  pointer-events: none;
  transition: opacity .2s, filter .2s;
  opacity: .9;
}
.input-with-icon:focus-within .input-icon {
  opacity: 1;
}

/* ============================================================
   AUTH PAGES (Login / Register)
   ============================================================ */
.auth-section {
  padding: 60px 0 80px;
  min-height: calc(100vh - var(--header-h) - 200px);
  display: flex;
  align-items: center;
}
.auth-container {
  max-width: 460px;
  margin: 0 auto;
}
.auth-card {
  padding: 36px 32px 32px;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.auth-head {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo {
  margin: 0 auto 16px;
  filter: drop-shadow(0 0 16px rgba(59,130,246,.5));
}
.auth-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
}
.auth-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-form .field {
  margin: 0;
}

.auth-submit {
  margin-top: 8px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.auth-switch a {
  color: var(--primary-light);
  font-weight: 600;
  margin-inline-start: 4px;
}
.auth-switch a:hover {
  color: var(--cyan);
}

/* ============================================================
   ADMIN
   ============================================================ */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  margin-top: 20px;
}
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  transition: background .2s, color .2s;
}
.admin-nav a:hover {
  background: var(--bg-3);
  color: var(--text);
}
.admin-nav a.active {
  background: var(--bg-3);
  color: var(--primary-light);
  border-inline-start: 3px solid var(--primary);
}
.admin-nav a .badge {
  margin-inline-start: auto;
  background: var(--accent);
  color: #04140a;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th {
  text-align: right;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table code {
  font-family: var(--font-term);
  color: var(--cyan);
  background: var(--bg-0);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.badge-danger {
  color: #fca5a5;
  border-color: #7f1d1d;
  background: rgba(239,68,68,.1);
}

/* ============================================================
   GLOBAL ICON WHITENING
   همه آیکون‌ها سفید شوند مگر لوگو
   ============================================================ */

/* آیکون‌های SVG */
img[src$=".svg"] {
  filter: brightness(0) invert(1);
}

/* استثنا: لوگو — بدون فیلتر */
img[src*="pigz-logo"],
.brand img,
.auth-logo,
img[alt="Pigz"] {
  filter: none !important;
}

/* استثنا: اسکین Pigz */
img[src*="pigz-skin"],
.pigz-center img {
  filter: none !important;
}

/* استثنا: تصاویر محتوا (webp/png/jpg) */
img[src$=".webp"],
img[src$=".jpg"],
img[src$=".jpeg"],
img[src$=".png"] {
  filter: none;
}

/* استثنا: آیکون‌های همکار (آپلودشده) */
.orbit-item img {
  filter: none !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { order: -1; }
  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .admin-nav a { white-space: nowrap; }
}

@media (max-width: 480px) {
  .auth-card { padding: 28px 20px 24px; }
  .auth-title { font-size: 20px; }
}