/* ============================================================
   JADWA HUB v2.0 - Main Stylesheet
   Feasibility Study Management System
   All content is Arabic RTL
   ============================================================ */

/* ------------------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
   ------------------------------------------------------------ */
:root {
  /* Colors */
  --color-primary: #2d9cdb;
  --color-primary-dark: #2380b3;
  --color-primary-light: #e8f4fd;
  --color-dark: #1a2a3a;
  --color-dark-light: #2c3e50;
  --color-success: #27ae60;
  --color-success-light: #e8f8ef;
  --color-error: #e74c3c;
  --color-error-light: #fdedec;
  --color-warning: #f39c12;
  --color-warning-light: #fef9e7;
  --color-info: #ebf5fb;
  --color-info-text: #2980b9;

  /* Backgrounds */
  --bg-white: #ffffff;
  --bg-body: #f8f9fa;
  --bg-sidebar: #1a2a3a;

  /* Text */
  --text-primary: #1a2a3a;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --text-white: #ffffff;

  /* Borders */
  --border-color: #e2e8f0;
  --border-radius-sm: 6px;
  --border-radius: 10px;
  --border-radius-lg: 12px;
  --border-radius-xl: 16px;
  --border-radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;

  /* Typography */
  --font-family: 'Tajawal', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-md: 1.125rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-xxl: 2rem;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Z-index layers */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-toast: 600;

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 64px;
}

/* ------------------------------------------------------------
   2. Reset / Base
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
}

h1 { font-size: var(--font-size-xxl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }
h4 { font-size: var(--font-size-md); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
  margin-bottom: var(--space-sm);
}

::selection {
  background-color: var(--color-primary);
  color: var(--text-white);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--border-radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ------------------------------------------------------------
   3. Utility Classes
   ------------------------------------------------------------ */
.text-muted {
  color: var(--text-secondary) !important;
  font-size: var(--font-size-sm);
}

.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
.text-primary-color { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-error { color: var(--color-error) !important; }
.text-warning { color: var(--color-warning) !important; }

.d-none { display: none !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }
.d-block { display: block !important; }
.d-inline-block { display: inline-block !important; }

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-start {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.flex-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.flex-wrap { flex-wrap: wrap; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

.w-full { width: 100%; }

.required {
  color: var(--color-error);
  font-weight: 700;
  margin-right: 2px;
}

/* ------------------------------------------------------------
   4. Auth Pages
   ------------------------------------------------------------ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a2a3a 0%, #2d9cdb 100%);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
  animation: authPulse 8s ease-in-out infinite;
}

@keyframes authPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; }
}

.auth-card {
  background: var(--bg-white);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-xxl);
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  animation: authSlideUp 0.5s ease-out;
}

@keyframes authSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-card .logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-card .logo h1 {
  color: var(--color-primary);
  font-size: var(--font-size-xxl);
  font-weight: 800;
  margin-bottom: var(--space-xs);
}

.auth-card .logo p {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.auth-card .form-group {
  margin-bottom: var(--space-md);
}

.auth-card .btn {
  margin-top: var(--space-sm);
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.auth-footer a {
  font-weight: 600;
  color: var(--color-primary);
}

/* ------------------------------------------------------------
   5. App Layout
   ------------------------------------------------------------ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-layout .main-content {
  margin-right: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  transition: margin-right var(--transition-slow);
}

.app-layout.sidebar-collapsed .main-content {
  margin-right: 0;
}

/* ------------------------------------------------------------
   6. Sidebar
   ------------------------------------------------------------ */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  color: var(--text-white);
  z-index: var(--z-fixed);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition-slow), width var(--transition-slow);
}

.sidebar-header {
  padding: var(--space-lg) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: var(--topbar-height);
}

.sidebar-header .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--color-primary);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-header .logo-icon i {
  font-size: 20px;
}

.sidebar-header .logo-text h2 {
  color: var(--text-white);
  font-size: var(--font-size-md);
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-header .logo-text span {
  font-size: var(--font-size-xs);
  color: rgba(255, 255, 255, 0.5);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) 0;
}

.sidebar-nav::-webkit-scrollbar {
  width: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius-full);
}

.nav-section {
  padding: var(--space-sm) var(--space-md) var(--space-xs);
}

.nav-section-title {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.5px;
  font-weight: 600;
  padding: var(--space-xs) var(--space-md);
  margin-bottom: var(--space-xs);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  color: rgba(255, 255, 255, 0.7);
  border-radius: 0;
  margin: 2px var(--space-sm);
  transition: all var(--transition);
  cursor: pointer;
  font-size: var(--font-size-sm);
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-white);
}

.nav-item.active {
  background: var(--color-primary);
  color: var(--text-white);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--text-white);
  border-radius: 0 var(--border-radius-full) var(--border-radius-full) 0;
}

.nav-item i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item .nav-badge {
  margin-right: auto;
  margin-left: 0;
  background: var(--color-error);
  color: var(--text-white);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--border-radius-full);
  line-height: 1.5;
}

.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--border-radius);
  transition: background var(--transition);
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-user .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-full);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.sidebar-user .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user .user-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  font-size: var(--font-size-xs);
  color: rgba(255, 255, 255, 0.5);
}

/* ------------------------------------------------------------
   7. Top Bar
   ------------------------------------------------------------ */
.top-bar {
  background: var(--bg-white);
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  border-bottom: 1px solid var(--border-color);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: var(--border-radius);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
}

.menu-toggle:hover {
  background: var(--bg-body);
}

.menu-toggle i {
  width: 22px;
  height: 22px;
}

.top-bar .page-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.top-bar .user-menu {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--border-radius);
  transition: background var(--transition);
}

.top-bar .user-menu:hover {
  background: var(--bg-body);
}

.top-bar .user-menu .user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--border-radius-full);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-white);
  font-weight: 700;
  font-size: var(--font-size-sm);
}

.top-bar .user-menu .user-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.top-bar .top-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.top-bar .top-icon-btn:hover {
  background: var(--bg-body);
  color: var(--text-primary);
}

.top-bar .top-icon-btn .notification-dot {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 8px;
  height: 8px;
  background: var(--color-error);
  border-radius: var(--border-radius-full);
  border: 2px solid var(--bg-white);
}

/* ------------------------------------------------------------
   8. Page Content
   ------------------------------------------------------------ */
.page-content {
  padding: var(--space-lg) var(--space-xl);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  animation: pageFadeIn 0.3s ease-out;
}

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------
   9. Page Header
   ------------------------------------------------------------ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.page-header h1 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.page-header .page-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.page-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  background: var(--bg-body);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--border-radius-sm);
}

.page-meta .meta-item i {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ------------------------------------------------------------
   10. Cards
   ------------------------------------------------------------ */
.card {
  background: var(--bg-white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-white);
}

.card-header h3 {
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--text-primary);
}

.card-header .card-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-body {
  padding: var(--space-lg);
}

.card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color);
  background: var(--bg-body);
}

.card-flat {
  box-shadow: none;
  border: 1px solid var(--border-color);
}

.card-clickable {
  cursor: pointer;
  transition: all var(--transition);
}

.card-clickable:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ------------------------------------------------------------
   11. Stats Grid
   ------------------------------------------------------------ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--border-radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  transition: all var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card .stat-icon i {
  width: 24px;
  height: 24px;
}

.stat-card .stat-icon.icon-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.stat-card .stat-icon.icon-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.stat-card .stat-icon.icon-warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.stat-card .stat-icon.icon-error {
  background: var(--color-error-light);
  color: var(--color-error);
}

.stat-card .stat-icon.icon-info {
  background: var(--color-info);
  color: var(--color-info-text);
}

.stat-card .stat-info {
  flex: 1;
  min-width: 0;
}

.stat-card .stat-value {
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

.stat-card .stat-change {
  font-size: var(--font-size-xs);
  margin-top: var(--space-xs);
  display: flex;
  align-items: center;
  gap: 2px;
}

.stat-card .stat-change.positive {
  color: var(--color-success);
}

.stat-card .stat-change.negative {
  color: var(--color-error);
}

/* ------------------------------------------------------------
   12. Tables
   ------------------------------------------------------------ */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--border-radius-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table thead th {
  background: var(--bg-body);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: right;
  padding: 12px var(--space-md);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.table tbody td {
  padding: 12px var(--space-md);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-primary);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--color-primary-light);
}

.table.table-striped tbody tr:nth-child(even) {
  background: rgba(248, 249, 250, 0.5);
}

.table.table-striped tbody tr:nth-child(even):hover {
  background: var(--color-primary-light);
}

.table .table-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* ------------------------------------------------------------
   13. Forms
   ------------------------------------------------------------ */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.form-group .help-text {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="url"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background: var(--bg-white);
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.5;
  direction: rtl;
}

.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45, 156, 219, 0.15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  background: var(--bg-body);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.form-control.is-error,
.is-error {
  border-color: var(--color-error);
}

.form-control.is-error:focus,
.is-error:focus {
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15);
}

.error-message {
  color: var(--color-error);
  font-size: var(--font-size-xs);
  margin-top: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.error-message i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 32px;
  cursor: pointer;
}

/* Input with icon */
.input-icon {
  position: relative;
}

.input-icon .form-control {
  padding-right: 40px;
  padding-left: 14px;
}

.input-icon .icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
  transition: color var(--transition);
}

.input-icon .form-control:focus ~ .icon,
.input-icon .form-control:focus + .icon {
  color: var(--color-primary);
}

/* Form Row */
.form-row {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.form-row > * {
  flex: 1;
}

.form-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

/* Form Actions */
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

/* Radio Group */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.radio-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px var(--space-md);
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: var(--font-size-sm);
  transition: all var(--transition);
  user-select: none;
}

.radio-label:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.radio-label input[type="radio"] {
  width: auto;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.radio-label input[type="radio"]:checked + span {
  color: var(--color-primary);
  font-weight: 600;
}

/* Checkbox Label */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: var(--font-size-sm);
  user-select: none;
  padding: var(--space-xs) 0;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   14. Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 600;
  border: 1.5px solid transparent;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
  user-select: none;
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(45, 156, 219, 0.3);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--text-white);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  box-shadow: 0 2px 8px rgba(45, 156, 219, 0.35);
}

.btn-success {
  background: var(--color-success);
  color: var(--text-white);
  border-color: var(--color-success);
}

.btn-success:hover {
  background: #219a52;
  border-color: #219a52;
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.35);
}

.btn-danger {
  background: var(--color-error);
  color: var(--text-white);
  border-color: var(--color-error);
}

.btn-danger:hover {
  background: #c0392b;
  border-color: #c0392b;
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.35);
}

.btn-warning {
  background: var(--color-warning);
  color: var(--text-white);
  border-color: var(--color-warning);
}

.btn-warning:hover {
  background: #e67e22;
  border-color: #e67e22;
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: var(--text-white);
}

.btn-outline-light {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-outline-light:hover {
  background: var(--bg-body);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-body);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: var(--font-size-xs);
  border-radius: var(--border-radius-sm);
}

.btn-sm i {
  width: 14px;
  height: 14px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: var(--font-size-md);
  border-radius: var(--border-radius-lg);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

.btn-icon.btn-sm {
  width: 30px;
  height: 30px;
  padding: 6px;
}

.btn-icon.btn-lg {
  width: 44px;
  height: 44px;
  padding: 10px;
}

.btn-icon i {
  width: 18px;
  height: 18px;
}

/* ------------------------------------------------------------
   15. Badges
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--border-radius-full);
  line-height: 1.5;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.badge i {
  width: 12px;
  height: 12px;
  margin-left: 3px;
}

.badge-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.badge-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.badge-danger {
  background: var(--color-error-light);
  color: var(--color-error);
}

.badge-warning {
  background: var(--color-warning-light);
  color: #b7791f;
}

.badge-info {
  background: var(--color-info);
  color: var(--color-info-text);
}

.badge-secondary {
  background: #f1f3f5;
  color: var(--text-secondary);
}

/* ------------------------------------------------------------
   16. Alerts
   ------------------------------------------------------------ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  margin-bottom: var(--space-md);
  border: 1px solid;
  animation: alertSlideIn 0.3s ease-out;
}

@keyframes alertSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.alert-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  transition: opacity var(--transition);
  flex-shrink: 0;
}

.alert-close:hover {
  opacity: 1;
}

.alert-close i {
  width: 16px;
  height: 16px;
}

.alert-error {
  background: var(--color-error-light);
  border-color: #f5c6cb;
  color: #a71d2a;
}

.alert-success {
  background: var(--color-success-light);
  border-color: #c3e6cb;
  color: #155724;
}

.alert-warning {
  background: var(--color-warning-light);
  border-color: #ffeaa7;
  color: #856404;
}

.alert-info {
  background: var(--color-info);
  border-color: #bee5eb;
  color: #0c5460;
}

/* ------------------------------------------------------------
   17. Progress Bar
   ------------------------------------------------------------ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e9ecef;
  border-radius: var(--border-radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar.progress-lg {
  height: 12px;
}

.progress-bar.progress-sm {
  height: 5px;
}

.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--border-radius-full);
  transition: width 0.6s ease;
  position: relative;
}

.progress-fill.fill-success {
  background: var(--color-success);
}

.progress-fill.fill-error {
  background: var(--color-error);
}

.progress-fill.fill-warning {
  background: var(--color-warning);
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xs);
  font-size: var(--font-size-sm);
}

.progress-label .progress-text {
  font-weight: 600;
  color: var(--text-primary);
}

.progress-label .progress-percent {
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
}

/* ------------------------------------------------------------
   18. Tabs
   ------------------------------------------------------------ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: var(--space-lg);
  gap: 0;
  overflow-x: auto;
}

.tab-btn {
  padding: 10px var(--space-md);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.tab-btn i {
  width: 16px;
  height: 16px;
}

.tab-btn:hover {
  color: var(--color-primary);
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-pane {
  display: none;
  animation: tabFadeIn 0.25s ease-out;
}

.tab-pane.active {
  display: block;
}

@keyframes tabFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ------------------------------------------------------------
   19. Dropdown
   ------------------------------------------------------------ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  cursor: pointer;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  z-index: var(--z-dropdown);
  padding: var(--space-xs) 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transition: all var(--transition);
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: right;
  font-family: var(--font-family);
}

.dropdown-item:hover {
  background: var(--bg-body);
}

.dropdown-item i {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.dropdown-item.danger {
  color: var(--color-error);
}

.dropdown-item.danger i {
  color: var(--color-error);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-xs) 0;
}

/* ------------------------------------------------------------
   20. Modal
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(12px);
  transition: transform var(--transition-slow);
}

.modal-overlay.show .modal-content {
  transform: scale(1) translateY(0);
}

.modal-content.modal-lg {
  max-width: 720px;
}

.modal-content.modal-sm {
  max-width: 400px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: var(--font-size-md);
  font-weight: 700;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-body);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--color-error-light);
  color: var(--color-error);
}

.modal-close i {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color);
}

/* Confirm Modal */
.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}

.confirm-icon.danger {
  background: var(--color-error-light);
  color: var(--color-error);
}

.confirm-icon.warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.confirm-icon i {
  width: 28px;
  height: 28px;
}

.confirm-text {
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-md);
}

.confirm-text strong {
  color: var(--text-primary);
}

/* ------------------------------------------------------------
   21. Toast Notifications
   ------------------------------------------------------------ */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
  max-width: 420px;
  padding: 0 var(--space-md);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--border-radius);
  background: var(--bg-white);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  pointer-events: all;
  animation: toastIn 0.35s ease-out;
  position: relative;
  overflow: hidden;
}

.toast.toast-exit {
  animation: toastOut 0.25s ease-in forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-16px) scale(0.96); }
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 700;
  font-size: var(--font-size-sm);
  margin-bottom: 2px;
}

.toast-message {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
}

.toast-close:hover {
  background: var(--bg-body);
  color: var(--text-primary);
}

.toast-close i {
  width: 14px;
  height: 14px;
}

.toast.toast-success { border-right: 4px solid var(--color-success); }
.toast.toast-success .toast-icon { color: var(--color-success); }

.toast.toast-error { border-right: 4px solid var(--color-error); }
.toast.toast-error .toast-icon { color: var(--color-error); }

.toast.toast-warning { border-right: 4px solid var(--color-warning); }
.toast.toast-warning .toast-icon { color: var(--color-warning); }

.toast.toast-info { border-right: 4px solid var(--color-primary); }
.toast.toast-info .toast-icon { color: var(--color-primary); }

/* Toast progress bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  right: 0;
  height: 3px;
  background: var(--color-primary);
  animation: toastProgress 5s linear forwards;
  border-radius: 0 0 0 var(--border-radius);
}

.toast.toast-success .toast-progress { background: var(--color-success); }
.toast.toast-error .toast-progress { background: var(--color-error); }
.toast.toast-warning .toast-progress { background: var(--color-warning); }

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

/* ------------------------------------------------------------
   22. Empty State
   ------------------------------------------------------------ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xxl) var(--space-lg);
  text-align: center;
}

.empty-state .empty-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--border-radius-full);
  background: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.empty-state .empty-icon i {
  width: 36px;
  height: 36px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.empty-state p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  max-width: 360px;
  margin-bottom: var(--space-lg);
}

.empty-state .btn {
  margin-top: var(--space-sm);
}

/* ------------------------------------------------------------
   23. Checklist
   ------------------------------------------------------------ */
.checklist {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  background: var(--bg-body);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  transition: all var(--transition);
  user-select: none;
}

.checklist-item:hover {
  background: var(--color-primary-light);
}

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.checklist-item.checked {
  background: var(--color-success-light);
}

.checklist-item.checked .checklist-text {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.checklist-text {
  flex: 1;
  color: var(--text-primary);
  transition: all var(--transition);
}

.checklist-item .checklist-actions {
  display: flex;
  gap: var(--space-xs);
  opacity: 0;
  transition: opacity var(--transition);
}

.checklist-item:hover .checklist-actions {
  opacity: 1;
}

/* ------------------------------------------------------------
   24. Prompt Library
   ------------------------------------------------------------ */
.prompt-library {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.prompt-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.prompt-card:hover {
  box-shadow: var(--shadow-sm);
}

.prompt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.prompt-card-header:hover {
  background: var(--bg-body);
}

.prompt-card-header .prompt-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.prompt-card-header .prompt-title i {
  width: 16px;
  height: 16px;
  color: var(--color-primary);
}

.prompt-card-header .toggle-icon {
  color: var(--text-muted);
  transition: transform var(--transition);
  width: 18px;
  height: 18px;
}

.prompt-card.expanded .toggle-icon {
  transform: rotate(180deg);
}

.prompt-card-body {
  display: none;
  border-top: 1px solid var(--border-color);
}

.prompt-card.expanded .prompt-card-body {
  display: block;
  animation: promptExpand 0.25s ease-out;
}

@keyframes promptExpand {
  from { opacity: 0; }
  to { opacity: 1; }
}

.prompt-text {
  padding: var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background: var(--bg-body);
  line-height: 1.8;
  direction: rtl;
  white-space: pre-wrap;
  word-wrap: break-word;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.prompt-text + .prompt-card-footer {
  margin-top: 0;
}

.prompt-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--border-color);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 14px;
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-light);
  border: none;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.copy-btn:hover {
  background: var(--color-primary);
  color: var(--text-white);
}

.copy-btn i {
  width: 14px;
  height: 14px;
}

.copy-btn.copied {
  background: var(--color-success);
  color: var(--text-white);
}

/* ------------------------------------------------------------
   25. Stage Badges
   ------------------------------------------------------------ */
.stage-locked {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 12px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  background: #f1f3f5;
  color: var(--text-secondary);
  border-radius: var(--border-radius-full);
}

.stage-locked i {
  width: 14px;
  height: 14px;
}

.stage-open {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 12px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: var(--border-radius-full);
}

.stage-open i {
  width: 14px;
  height: 14px;
}

.stage-completed {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 12px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  background: var(--color-success-light);
  color: var(--color-success);
  border-radius: var(--border-radius-full);
}

.stage-completed i {
  width: 14px;
  height: 14px;
}

.stage-revision {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 12px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  background: var(--color-warning-light);
  color: #b7791f;
  border-radius: var(--border-radius-full);
}

.stage-revision i {
  width: 14px;
  height: 14px;
}

/* ------------------------------------------------------------
   26. Workspace Section
   ------------------------------------------------------------ */
.workspace-section {
  margin-bottom: var(--space-xl);
}

.workspace-section .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border-color);
}

.workspace-section .section-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.workspace-section .section-header h3 i {
  width: 22px;
  height: 22px;
  color: var(--color-primary);
}

.workspace-section .section-body {
  padding: var(--space-md) 0;
}

/* ------------------------------------------------------------
   27. File Upload
   ------------------------------------------------------------ */
.file-upload {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-body);
}

.file-upload:hover,
.file-upload.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.file-upload .upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-md);
  color: var(--text-muted);
}

.file-upload .upload-icon i {
  width: 48px;
  height: 48px;
}

.file-upload p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.file-upload .upload-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

.file-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-body);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  transition: background var(--transition-fast);
}

.file-item:hover {
  background: var(--color-primary-light);
}

.file-item .file-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-sm);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-item .file-icon i {
  width: 16px;
  height: 16px;
}

.file-item .file-name {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item .file-size {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.file-item .file-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.file-item .file-remove:hover {
  background: var(--color-error-light);
  color: var(--color-error);
}

.file-item .file-remove i {
  width: 14px;
  height: 14px;
}

/* ------------------------------------------------------------
   28. Source Item
   ------------------------------------------------------------ */
.source-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-body);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-sm);
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.source-item:hover {
  border-color: var(--border-color);
  box-shadow: var(--shadow-xs);
}

.source-item .source-number {
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  color: var(--text-white);
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  flex-shrink: 0;
}

.source-item .source-content {
  flex: 1;
  min-width: 0;
}

.source-item .source-title {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.source-item .source-desc {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.source-item .source-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   29. Row Warning
   ------------------------------------------------------------ */
.row-warning {
  background: var(--color-warning-light) !important;
}

.row-warning td {
  color: #856404;
}

/* ------------------------------------------------------------
   30. Filter Bar
   ------------------------------------------------------------ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-white);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.filter-bar .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 180px;
}

.filter-bar .form-control {
  padding: 8px 12px;
  font-size: var(--font-size-sm);
}

.filter-bar .btn {
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   31. Dropdown Menu (standalone)
   ------------------------------------------------------------ */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  z-index: var(--z-dropdown);
  padding: var(--space-xs) 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transition: all var(--transition);
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ------------------------------------------------------------
   32. Profile Grid
   ------------------------------------------------------------ */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

/* ------------------------------------------------------------
   33. Password Strength
   ------------------------------------------------------------ */
.password-strength {
  margin-top: var(--space-sm);
}

.strength-bar {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
}

.strength-fill {
  height: 4px;
  flex: 1;
  background: #e9ecef;
  border-radius: var(--border-radius-full);
  transition: background var(--transition);
}

.strength-fill.active {
  background: var(--color-error);
}

.strength-fill.active.medium {
  background: var(--color-warning);
}

.strength-fill.active.strong {
  background: var(--color-success);
}

.strength-text {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.strength-text.weak { color: var(--color-error); }
.strength-text.medium { color: var(--color-warning); }
.strength-text.strong { color: var(--color-success); }

/* ------------------------------------------------------------
   34. Sidebar Overlay (mobile)
   ------------------------------------------------------------ */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: calc(var(--z-fixed) - 1);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* ------------------------------------------------------------
   35. Confirm Dialog Custom
   ------------------------------------------------------------ */
.confirm-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.confirm-dialog {
  background: var(--bg-white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-xl);
  max-width: 400px;
  width: 100%;
  text-align: center;
  animation: confirmPop 0.3s ease-out;
}

@keyframes confirmPop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.confirm-dialog h3 {
  font-size: var(--font-size-md);
  margin-bottom: var(--space-sm);
}

.confirm-dialog p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  line-height: 1.7;
}

.confirm-dialog .confirm-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

/* ------------------------------------------------------------
   36. Loading Spinner
   ------------------------------------------------------------ */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner-lg {
  width: 36px;
  height: 36px;
  border-width: 4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-md);
  z-index: var(--z-toast);
}

.loading-overlay p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 600;
}

/* ------------------------------------------------------------
   37. Tooltip
   ------------------------------------------------------------ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  background: var(--color-dark);
  color: var(--text-white);
  font-size: var(--font-size-xs);
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: var(--z-dropdown);
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

/* ------------------------------------------------------------
   38. Animation Helpers
   ------------------------------------------------------------ */
.fade-in {
  animation: fadeIn 0.3s ease-out;
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.scale-in {
  animation: scaleIn 0.25s ease-out;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}