/* ============================================================
   assets/css/style.css  –  آریاساسول CVC Panel  
   طراحی: حرفه‌ای، سازمانی، RTL
   به‌روزرسانی شده با فونت IRANYekanX
   ============================================================ */

/* -- فونت ایران‌یکان (IRANYekanX) محلی ----------------------------------- */
@font-face {
  font-family: 'IRANYekanX';
  src: url('../fonts/IRANYekanX-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IRANYekanX';
  src: url('../fonts/IRANYekanX-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IRANYekanX';
  src: url('../fonts/IRANYekanX-DemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IRANYekanX';
  src: url('../fonts/IRANYekanX-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IRANYekanX';
  src: url('../fonts/IRANYekanX-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IRANYekanX';
  src: url('../fonts/IRANYekanX-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* -- متغیرها ------------------------------------------------ */
:root {
  --brand-primary:   #1a3a6c;
  --brand-secondary: #0f6eb4;
  --brand-accent:    #e8a020;
  --brand-light:     #e8f0fb;

  --bg-page:         #f0f4f9;
  --bg-card:         #ffffff;
  --bg-sidebar:      #0e2347;
  --bg-sidebar-active: #1a3a6c;

  --text-primary:    #1a2840;
  --text-secondary:  #4a5e7a;
  --text-muted:      #8899b0;
  --text-on-dark:    #dde6f4;

  --border-color:    #d4dde9;
  --border-focus:    #0f6eb4;

  --status-draft:    #8899b0;
  --status-review:   #e8a020;
  --status-progress: #0f6eb4;
  --status-approved: #1a9e5c;
  --status-rejected: #d0382a;
  --status-hold:     #7c4dab;

  --shadow-sm:  0 1px 4px rgba(10,30,70,.08);
  --shadow-md:  0 4px 16px rgba(10,30,70,.12);
  --shadow-lg:  0 8px 32px rgba(10,30,70,.16);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --sidebar-w: 260px;
  --topbar-h:  64px;

  --transition: .2s ease;
}

/* -- ریست --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'IRANYekanX', 'Segoe UI', Tahoma, sans-serif;
  direction: rtl;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}
a { color: var(--brand-secondary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-primary); }
img { max-width: 100%; display: block; }
ul { list-style: none; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ============================================================
   AUTH PAGES (login / register)
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0e2347 0%, #1a3a6c 50%, #0f6eb4 100%);
  padding: 1.5rem;
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.75rem;
  justify-content: center;
}
.auth-logo-icon {
  width: 48px; height: 48px;
  background: var(--brand-primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.4rem; font-weight: 700;
}
.auth-logo-text { font-size: 1.1rem; font-weight: 700; color: var(--brand-primary); }
.auth-logo-sub  { font-size: .75rem; color: var(--text-muted); }
.auth-title { font-size: 1.3rem; font-weight: 700; color: var(--brand-primary); margin-bottom: .5rem; text-align: center; }
.auth-subtitle { font-size: .85rem; color: var(--text-muted); text-align: center; margin-bottom: 1.75rem; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .4rem;
}
.form-label .req { color: var(--status-rejected); margin-right: .2rem; }
.form-control {
  display: block; width: 100%;
  padding: .6rem .9rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(15,110,180,.15);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238899b0' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left .75rem center; padding-left: 2rem; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }
.form-error { font-size: .78rem; color: var(--status-rejected); margin-top: .3rem; }

/* checkbox & radio */
.form-check { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; cursor: pointer; }
.form-check input { width: 16px; height: 16px; accent-color: var(--brand-secondary); cursor: pointer; }
.form-check-label { font-size: .88rem; color: var(--text-secondary); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.4rem;
  border: none; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary   { background: var(--brand-secondary); color: #fff; }
.btn-primary:hover   { background: var(--brand-primary); color: #fff; }
.btn-secondary { background: var(--bg-card); color: var(--brand-secondary); border: 1.5px solid var(--brand-secondary); }
.btn-secondary:hover { background: var(--brand-light); }
.btn-accent    { background: var(--brand-accent); color: #fff; }
.btn-accent:hover    { background: #c4881a; }
.btn-danger    { background: var(--status-rejected); color: #fff; }
.btn-danger:hover    { background: #a82e22; }
.btn-sm { padding: .38rem .9rem; font-size: .8rem; }
.btn-lg { padding: .8rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  margin-bottom: 1rem;
  border-right: 4px solid transparent;
}
.alert-success { background: #e6f9f0; color: #156a3e; border-color: #1a9e5c; }
.alert-danger  { background: #fdecea; color: #9a2319; border-color: #d0382a; }
.alert-warning { background: #fef8ec; color: #8a5c10; border-color: #e8a020; }
.alert-info    { background: var(--brand-light); color: #0d4d80; border-color: var(--brand-secondary); }

/* ============================================================
   LAYOUT: SIDEBAR + MAIN
   ============================================================ */
.app-wrapper { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex; flex-direction: column;
  position: fixed; top: 0; right: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
}
.sidebar-brand-icon {
  width: 38px; height: 38px;
  background: #0e2347;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.sidebar-brand-name { font-size: .88rem; font-weight: 700; color: #fff; line-height: 1.3; }
.sidebar-brand-sub  { font-size: .7rem; color: rgba(255,255,255,.4); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem 0; }
.nav-section-label {
  font-size: .68rem; font-weight: 700;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .6rem 1.25rem .3rem;
  margin-top: .25rem;
}
.nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem 1.25rem;
  color: var(--text-on-dark);
  font-size: .88rem; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active {
  background: var(--bg-sidebar-active);
  color: var(--brand-accent);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute; right: 0; top: 25%; bottom: 25%;
  width: 3px; background: var(--brand-accent);
  border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 1.1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-right: auto;
  background: var(--brand-accent); color: #fff;
  font-size: .65rem; font-weight: 700;
  padding: .1rem .4rem; border-radius: 10px;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex; align-items: center; gap: .6rem;
}
.sidebar-avatar {
  width: 34px; height: 34px;
  background: var(--brand-secondary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: #fff;
  flex-shrink: 0;
}
.sidebar-user-name  { font-size: .82rem; font-weight: 600; color: #fff; }
.sidebar-user-role  { font-size: .7rem; color: rgba(255,255,255,.4); }
.sidebar-logout {
  margin-right: auto;
  background: none; border: none;
  color: rgba(255,255,255,.4);
  cursor: pointer; font-size: .9rem;
  transition: color var(--transition);
  padding: .3rem;
}
.sidebar-logout:hover { color: var(--status-rejected); }

/* MAIN CONTENT */
.main-content {
  margin-right: var(--sidebar-w);
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center;
  padding: 0 1.75rem;
  gap: 1rem;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--brand-primary); flex: 1; }
.topbar-subtitle { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }

/* PAGE CONTENT */
.page-content { padding: 1.75rem; flex: 1; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; gap: .75rem;
}
.card-title { font-size: .95rem; font-weight: 700; color: var(--brand-primary); }
.card-subtitle { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }
.card-body { padding: 1.25rem; }
.card-footer {
  padding: .9rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-page);
  display: flex; align-items: center; gap: .75rem;
}
.card-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.card-icon-blue   { background: #e8f0fb; color: var(--brand-secondary); }
.card-icon-green  { background: #e6f9f0; color: var(--status-approved); }
.card-icon-amber  { background: #fef8ec; color: var(--brand-accent); }
.card-icon-red    { background: #fdecea; color: var(--status-rejected); }

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; gap: 1rem;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--brand-primary); line-height: 1; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .7rem;
  border-radius: 20px;
  font-size: .75rem; font-weight: 600;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.status-draft     { background: #f0f2f5; color: var(--status-draft); }
.status-submitted { background: #fff3e0; color: #e65100; }
.status-review    { background: #fef8ec; color: #8a5c10; }
.status-progress  { background: var(--brand-light); color: #0d4d80; }
.status-approved  { background: #e6f9f0; color: #156a3e; }
.status-rejected  { background: #fdecea; color: #9a2319; }
.status-hold      { background: #f3eef8; color: #5c3087; }

/* ============================================================
   TRACKING TIMELINE
   ============================================================ */
.timeline { position: relative; padding: 0; }
.timeline-track {
  position: absolute;
  right: 19px; top: 0; bottom: 0;
  width: 2px; background: var(--border-color);
}
.timeline-item {
  position: relative;
  display: flex; gap: 1rem;
  padding-bottom: 1.5rem;
  padding-right: 48px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  right: 10px; top: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--border-color);
  border: 3px solid var(--bg-card);
  display: flex; align-items: center; justify-content: center;
}
.timeline-dot.active { background: var(--brand-secondary); box-shadow: 0 0 0 4px rgba(15,110,180,.2); }
.timeline-dot.done   { background: var(--status-approved); }
.timeline-dot.rejected { background: var(--status-rejected); }
.timeline-content { flex: 1; }
.timeline-label { font-size: .88rem; font-weight: 600; color: var(--text-primary); }
.timeline-sub   { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; }

/* ============================================================
   STEPPER (فرم چند مرحله‌ای)
   ============================================================ */
.stepper {
  display: flex; align-items: flex-start;
  gap: 0; margin-bottom: 2rem;
  overflow-x: auto; padding-bottom: .25rem;
}
.step {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
  position: relative; text-align: center;
}
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px; left: -50%;
  width: 100%; height: 2px;
  background: var(--border-color);
  z-index: 0;
}
.step.done:not(:last-child)::after  { background: var(--status-approved); }
.step.active:not(:last-child)::after{ background: var(--brand-secondary); }
.step-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-page);
  border: 2px solid var(--border-color);
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 700;
  color: var(--text-muted);
  position: relative; z-index: 1;
  transition: all var(--transition);
}
.step.active .step-num { background: var(--brand-secondary); border-color: var(--brand-secondary); color: #fff; }
.step.done   .step-num { background: var(--status-approved); border-color: var(--status-approved); color: #fff; }
.step-label { font-size: .72rem; color: var(--text-muted); margin-top: .4rem; font-weight: 500; line-height: 1.3; max-width: 90px; }
.step.active .step-label { color: var(--brand-secondary); font-weight: 700; }
.step.done   .step-label { color: var(--status-approved); }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg-page); }
th {
  padding: .65rem 1rem;
  font-size: .78rem; font-weight: 700;
  color: var(--text-secondary);
  text-align: right;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}
td {
  padding: .75rem 1rem;
  font-size: .85rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}
tbody tr:hover { background: var(--bg-page); }
tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   SECTION PANELS (فرم بخش‌بندی)
   ============================================================ */
.section-panel {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.section-header {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(to left, var(--brand-primary), var(--brand-secondary));
  cursor: pointer;
  user-select: none;
}
.section-header-icon {
  width: 32px; height: 32px;
  background: rgba(255,255,255,.15);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .95rem; flex-shrink: 0;
}
.section-header-title { flex: 1; font-size: .92rem; font-weight: 700; color: #fff; }
.section-header-sub   { font-size: .72rem; color: rgba(255,255,255,.65); margin-top: .1rem; }
.section-chevron { color: rgba(255,255,255,.7); transition: transform var(--transition); font-size: .85rem; }
.section-panel.collapsed .section-chevron { transform: rotate(180deg); }
.section-body { padding: 1.25rem; }
.section-panel.collapsed .section-body { display: none; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

/* upload zone */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  text-align: center;
  font-size: .8rem;
  color: var(--text-muted);
  background: var(--bg-page);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  margin-top: .4rem;
}
.upload-zone:hover { border-color: var(--brand-secondary); background: var(--brand-light); }
.upload-zone input[type=file] { display: none; }
.upload-icon { font-size: 1.3rem; margin-bottom: .2rem; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar-wrap {
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(to left, var(--brand-accent), var(--brand-secondary));
  border-radius: 4px;
  transition: width .5s ease;
}
.progress-label { font-size: .72rem; color: var(--text-muted); margin-top: .25rem; text-align: left; }

/* ============================================================
   MOBILE HAMBURGER
   ============================================================ */
.hamburger {
  display: none;
  background: none; border: none;
  cursor: pointer; color: var(--brand-primary);
  font-size: 1.25rem; padding: .3rem;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-right: 0; }
  .hamburger { display: flex; }
  .sidebar-overlay.show { display: block; }
}

/* ============================================================
   MISC
   ============================================================ */
.divider { height: 1px; background: var(--border-color); margin: 1.25rem 0; }
.text-muted   { color: var(--text-muted) !important; }
.text-primary { color: var(--brand-primary) !important; }
.text-success { color: var(--status-approved) !important; }
.text-danger  { color: var(--status-rejected) !important; }
.font-bold    { font-weight: 700; }
.d-flex   { display: flex; }
.align-center { align-items: center; }
.gap-1    { gap: .5rem; }
.gap-2    { gap: 1rem; }
.mt-1     { margin-top: .5rem; }
.mt-2     { margin-top: 1rem; }
.mb-1     { margin-bottom: .5rem; }
.mb-2     { margin-bottom: 1rem; }
.p-1      { padding: .5rem; }

/* splash loader */
#splash {
  position: fixed; inset: 0;
  background: var(--brand-primary);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; flex-direction: column; gap: 1rem;
  transition: opacity .4s;
}
#splash.hidden { opacity: 0; pointer-events: none; }
#splash .splash-logo { font-size: 2.5rem; font-weight: 800; color: #fff; letter-spacing: -.03em; }
#splash .splash-sub  { font-size: .9rem; color: rgba(255,255,255,.5); }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: var(--brand-accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }