/* ============================================================
   Smart Connection - Business Dashboard Styles
   RTL-first, Modern, Professional
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --primary: #1B2632;
  --primary-light: #2A3A4A;
  --primary-dark: #111B24;
  --accent: #FFB162;
  --accent-dark: #E8973D;
  --accent-light: rgba(255, 177, 98, 0.1);
  --accent-glow: rgba(255, 177, 98, 0.25);
  --bg-light: #FAFAFA;
  --bg-cream: #FFF8F0;
  --text-dark: #1B2632;
  --text-gray: #6B7280;
  --text-light: #9CA3AF;
  --white: #FFFFFF;
  --green: #25D366;
  --green-light: rgba(37, 211, 102, 0.1);
  --red: #EF4444;
  --red-light: rgba(239, 68, 68, 0.1);
  --yellow: #F59E0B;
  --yellow-light: rgba(245, 158, 11, 0.1);
  --blue: #3B82F6;
  --blue-light: rgba(59, 130, 246, 0.1);
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 4px 30px rgba(27, 38, 50, 0.08);
  --shadow-lg: 0 20px 60px rgba(27, 38, 50, 0.12);
  --shadow-sm: 0 2px 8px rgba(27, 38, 50, 0.06);
  --sidebar-width: 260px;
  --transition: 0.25s ease;
}

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

html {
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  font-family: 'Tajawal', 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-dark);
  background: var(--bg-light);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

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

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--text-light);
  border-radius: 3px;
}

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


/* ============================================================
   LAYOUT: Sidebar + Main
   ============================================================ */

.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--primary);
  color: var(--white);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.sidebar-logo h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
}

.sidebar-logo span {
  font-size: 11px;
  color: var(--accent);
  display: block;
  font-weight: 400;
  margin-top: 2px;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.sidebar-nav-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.35);
  padding: 16px 12px 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.sidebar-nav a i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

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

.sidebar-nav a.active {
  background: var(--accent);
  color: var(--primary);
  font-weight: 700;
}

.sidebar-nav a .badge-count {
  margin-right: auto;
  margin-left: 0;
  background: var(--red);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
  min-width: 20px;
  text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

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

.sidebar-user-info {
  overflow: hidden;
}

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

.sidebar-user-info .role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: none;
  border-radius: var(--radius-sm);
  color: #F87171;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.sidebar-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #FCA5A5;
}

.sidebar-logout i {
  font-size: 15px;
}

/* Mobile Hamburger */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1100;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-light);
}

.main-header {
  background: var(--white);
  padding: 20px 30px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.main-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
}

.main-header .header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-content {
  padding: 30px;
}


/* ============================================================
   STAT CARDS
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: all var(--transition);
  border: 1px solid var(--border-light);
}

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

.stat-card .stat-info h3 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 4px;
  line-height: 1.2;
}

.stat-card .stat-info p {
  font-size: 13px;
  color: var(--text-gray);
  font-weight: 500;
}

.stat-card .stat-info .stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 50px;
}

.stat-change.up {
  color: #059669;
  background: var(--green-light);
}

.stat-change.down {
  color: var(--red);
  background: var(--red-light);
}

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.accent {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.stat-icon.green {
  background: var(--green-light);
  color: #059669;
}

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

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


/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-light);
}


/* ============================================================
   DATA TABLES
   ============================================================ */

.table-container {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.table-header h2 {
  font-size: 17px;
  font-weight: 700;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table thead {
  background: var(--bg-light);
}

table th {
  padding: 14px 20px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

table td {
  padding: 14px 20px;
  font-size: 14px;
  color: var(--text-dark);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

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

table tbody tr:hover {
  background: var(--bg-cream);
}

table tbody tr:nth-child(even) {
  background: var(--bg-light);
}

table tbody tr:nth-child(even):hover {
  background: var(--bg-cream);
}

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

.table-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-footer .table-info {
  font-size: 13px;
  color: var(--text-gray);
}


/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn i {
  font-size: 14px;
}

.btn-primary {
  background: var(--accent);
  color: var(--primary);
}

.btn-primary:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text-dark);
  border: 1px solid var(--border);
}

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

.btn-danger {
  background: var(--red);
  color: var(--white);
}

.btn-danger:hover {
  background: #DC2626;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

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

.btn-success:hover {
  background: #1DB954;
}

.btn-outline {
  background: transparent;
  color: var(--accent-dark);
  border: 2px solid var(--accent);
}

.btn-outline:hover {
  background: var(--accent-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-gray);
  padding: 8px 12px;
}

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

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

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

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

.btn-group {
  display: flex;
  gap: 8px;
}


/* ============================================================
   FORMS
   ============================================================ */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.form-group .form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.form-control {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-dark);
  background: var(--white);
  transition: all var(--transition);
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

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

.form-control.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-light);
}

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

select.form-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.input-icon-wrapper .form-control {
  padding-right: 42px;
}

.input-icon-wrapper i {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 15px;
}

/* Search input */
.search-input {
  position: relative;
  max-width: 300px;
}

.search-input input {
  width: 100%;
  padding: 9px 40px 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 13px;
  background: var(--bg-light);
  transition: all var(--transition);
}

.search-input input:focus {
  background: var(--white);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-input i {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 14px;
}


/* ---- Toggle Switch ---- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 50px;
  transition: all var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  top: 3px;
  right: 3px;
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--green);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(-22px);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row .toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
}

.toggle-row .toggle-desc {
  font-size: 12px;
  color: var(--text-gray);
  margin-top: 2px;
}


/* ============================================================
   STATUS BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-active,
.badge-green {
  background: var(--green-light);
  color: #059669;
}

.badge-active::before,
.badge-green::before {
  background: #059669;
}

.badge-inactive,
.badge-red {
  background: var(--red-light);
  color: var(--red);
}

.badge-inactive::before,
.badge-red::before {
  background: var(--red);
}

.badge-pending,
.badge-yellow {
  background: var(--yellow-light);
  color: #D97706;
}

.badge-pending::before,
.badge-yellow::before {
  background: #D97706;
}

.badge-free,
.badge-gray {
  background: var(--border-light);
  color: var(--text-gray);
}

.badge-free::before,
.badge-gray::before {
  background: var(--text-gray);
}

.badge-starter,
.badge-blue {
  background: var(--blue-light);
  color: var(--blue);
}

.badge-starter::before,
.badge-blue::before {
  background: var(--blue);
}

.badge-pro,
.badge-orange {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.badge-pro::before,
.badge-orange::before {
  background: var(--accent-dark);
}

.badge-enterprise,
.badge-gold {
  background: rgba(217, 175, 85, 0.12);
  color: #B8860B;
}

.badge-enterprise::before,
.badge-gold::before {
  background: #B8860B;
}


/* ============================================================
   CONVERSATION CARDS
   ============================================================ */

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.conversation-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 22px;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  cursor: pointer;
}

.conversation-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.conversation-card .conv-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.conversation-card .conv-avatar.whatsapp {
  background: var(--green-light);
  color: var(--green);
}

.conversation-card .conv-avatar.voice {
  background: var(--blue-light);
  color: var(--blue);
}

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

.conversation-card .conv-info .conv-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.conversation-card .conv-info .conv-preview {
  font-size: 13px;
  color: var(--text-gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-card .conv-meta {
  text-align: left;
  flex-shrink: 0;
}

.conversation-card .conv-meta .conv-time {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.conversation-card .conv-meta .conv-unread {
  background: var(--accent);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 50px;
  display: inline-block;
}


/* ============================================================
   MODALS
   ============================================================ */

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

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

.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(20px);
  transition: all var(--transition);
}

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

.modal-sm {
  max-width: 420px;
}

.modal-lg {
  max-width: 760px;
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-light);
  border: none;
  font-size: 18px;
  color: var(--text-gray);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--border);
  color: var(--text-dark);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}


/* ============================================================
   ACCORDION
   ============================================================ */

.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.accordion-item {
  border-bottom: 1px solid var(--border);
}

.accordion-item:last-child {
  border-bottom: none;
}

.accordion-header {
  width: 100%;
  padding: 16px 20px;
  background: var(--white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: background var(--transition);
}

.accordion-header:hover {
  background: var(--bg-light);
}

.accordion-header i {
  font-size: 12px;
  color: var(--text-gray);
  transition: transform var(--transition);
}

.accordion-item.open .accordion-header i {
  transform: rotate(180deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.accordion-item.open .accordion-body {
  max-height: 1000px;
}

.accordion-content {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
}


/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-dark);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-light);
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--primary);
  font-weight: 700;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-dots {
  font-size: 14px;
  color: var(--text-light);
  padding: 0 4px;
}


/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

#toast-container {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: var(--shadow-lg);
  border-right: 4px solid var(--text-gray);
  transform: translateX(-120%);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.toast-show {
  transform: translateX(0);
  opacity: 1;
}

.toast-success {
  border-right-color: var(--green);
}

.toast-error {
  border-right-color: var(--red);
}

.toast-warning {
  border-right-color: var(--yellow);
}

.toast-info {
  border-right-color: var(--blue);
}

.toast-message {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.toast-close:hover {
  color: var(--text-dark);
}


/* ============================================================
   LOADING SPINNER
   ============================================================ */

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-spinner p {
  font-size: 14px;
  color: var(--text-gray);
}


/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state i {
  font-size: 48px;
  color: var(--border);
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 15px;
  color: var(--text-gray);
}

.empty-state .btn {
  margin-top: 16px;
}


/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary) 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: var(--accent-glow);
  top: -200px;
  left: -100px;
  filter: blur(80px);
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.08);
  bottom: -150px;
  right: -100px;
  filter: blur(60px);
}

.login-card {
  background: var(--white);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.login-header {
  text-align: center;
  padding: 36px 32px 24px;
}

.login-header img {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.login-header p {
  font-size: 14px;
  color: var(--text-gray);
}

/* Login/Register Tabs */
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  margin: 0 32px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-gray);
  cursor: pointer;
  position: relative;
  transition: color var(--transition);
}

.auth-tab::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--transition);
}

.auth-tab.active {
  color: var(--accent-dark);
}

.auth-tab.active::after {
  transform: scaleX(1);
}

.login-form {
  padding: 28px 32px 36px;
}

.login-form .form-group {
  margin-bottom: 18px;
}

.login-form .form-control {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.login-form .btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  color: var(--text-light);
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-footer {
  text-align: center;
  padding: 0 32px 28px;
  font-size: 13px;
  color: var(--text-gray);
}

.login-footer a {
  color: var(--accent-dark);
  font-weight: 600;
}

.login-footer a:hover {
  text-decoration: underline;
}

.login-error {
  background: var(--red-light);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 8px;
}

.login-error.show {
  display: flex;
}


/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--text-gray); }
.text-accent { color: var(--accent-dark); }
.text-green { color: #059669; }
.text-red { color: var(--red); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 18px; }
.text-bold { font-weight: 700; }
.text-semibold { font-weight: 600; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.p-0 { padding: 0; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }
.d-grid { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.w-100 { width: 100%; }
.rounded { border-radius: var(--radius); }

.hidden {
  display: none !important;
}

/* Filters row */
.filters-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-select {
  padding: 8px 14px;
  padding-left: 32px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 13px;
  background: var(--white);
  color: var(--text-dark);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  cursor: pointer;
  min-width: 120px;
}

.filter-select:focus {
  border-color: var(--accent);
  outline: none;
}

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* Action buttons in table */
.action-btns {
  display: flex;
  gap: 6px;
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}

.action-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-light);
}

.action-btn.danger:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-light);
}

/* Avatar */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 12px 20px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-gray);
  cursor: pointer;
  position: relative;
  transition: color var(--transition);
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--transition);
}

.tab-btn.active {
  color: var(--text-dark);
  font-weight: 600;
}

.tab-btn.active::after {
  transform: scaleX(1);
}

.tab-content {
  display: none;
}

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

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

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  min-width: 180px;
  padding: 6px;
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--transition);
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text-dark);
  cursor: pointer;
  transition: background var(--transition);
}

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

.dropdown-item i {
  width: 16px;
  text-align: center;
  color: var(--text-gray);
  font-size: 14px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: 50px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 50px;
  transition: width 0.5s ease;
}

.progress-fill.green { background: var(--green); }
.progress-fill.blue { background: var(--blue); }
.progress-fill.red { background: var(--red); }


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  /* Sidebar becomes top header on mobile */
  .sidebar {
    transform: translateX(100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-right: 0;
  }

  .main-header {
    padding: 16px 20px;
    padding-right: 70px;
  }

  .main-header h1 {
    font-size: 18px;
  }

  .page-content {
    padding: 20px 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .table-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .filters-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    max-width: 100%;
  }

  .modal {
    width: 95%;
    max-height: 90vh;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }

  /* Toast on mobile */
  #toast-container {
    left: 16px;
    right: 16px;
    max-width: none;
  }

  .login-card {
    max-width: 100%;
  }

  .login-form {
    padding: 24px 20px 32px;
  }

  .auth-tabs {
    margin: 0 20px;
  }

  .login-header {
    padding: 28px 20px 20px;
  }

  .table-wrapper {
    font-size: 13px;
  }

  table th,
  table td {
    padding: 10px 12px;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .btn-group {
    flex-wrap: wrap;
  }

  .header-actions {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .stat-card {
    padding: 18px;
  }

  .stat-card .stat-info h3 {
    font-size: 24px;
  }

  .stat-card .stat-icon {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .main-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding-right: 70px;
  }

  .btn-lg {
    padding: 12px 24px;
    font-size: 14px;
  }
}


/* ============================================================
   ANIMATIONS
   ============================================================ */

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

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

@keyframes slideRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease;
}

.animate-slide-up {
  animation: slideUp 0.4s ease;
}

.animate-slide-right {
  animation: slideRight 0.4s ease;
}

/* Staggered animations for stat cards */
.stats-grid .stat-card:nth-child(1) { animation: slideUp 0.4s ease 0.0s both; }
.stats-grid .stat-card:nth-child(2) { animation: slideUp 0.4s ease 0.1s both; }
.stats-grid .stat-card:nth-child(3) { animation: slideUp 0.4s ease 0.2s both; }
.stats-grid .stat-card:nth-child(4) { animation: slideUp 0.4s ease 0.3s both; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.skeleton-rect {
  height: 120px;
  width: 100%;
}


/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
  .sidebar,
  .sidebar-toggle,
  .main-header,
  .btn,
  .action-btns,
  .pagination,
  .filters-row,
  #toast-container {
    display: none !important;
  }

  .main-content {
    margin-right: 0;
  }

  .page-content {
    padding: 0;
  }

  body {
    background: white;
    color: black;
    font-size: 12px;
  }

  .card,
  .table-container,
  .stat-card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}
