/* ==========================================================================
   EzyDars — Modern Portal Design System
   Student Portal Design Framework
   ========================================================================== */

:root {
  --portal-primary: #2292ba;
  --portal-primary-hover: #1b7a9c;
  --portal-primary-light: #e8f5f9;
  --portal-primary-rgb: 34, 146, 186;
  --portal-accent: #6366f1;
  --portal-accent-light: #eef2ff;
  --portal-success: #10b981;
  --portal-success-light: #ecfdf5;
  --portal-warning: #f59e0b;
  --portal-warning-light: #fffbeb;
  --portal-danger: #ef4444;
  --portal-danger-light: #fef2f2;
  --portal-bg: #f8fafc;
  --portal-surface: #ffffff;
  --portal-border: #e2e8f0;
  --portal-border-light: #f1f5f9;
  --portal-text: #0f172a;
  --portal-text-muted: #64748b;
  --portal-text-soft: #94a3b8;
  --portal-sidebar-w: 260px;
  --portal-sidebar-collapsed-w: 78px;
  --portal-header-h: 70px;
  --portal-radius-sm: 8px;
  --portal-radius-md: 14px;
  --portal-radius-lg: 20px;
  --portal-radius-pill: 9999px;
  --portal-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --portal-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --portal-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
  --portal-shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.1);
  --portal-transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base & Global ──────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--portal-bg);
  color: var(--portal-text);
  font-family: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
}

html[dir="rtl"] body {
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  direction: rtl;
  text-align: right;
}

html[dir="ltr"] body {
  direction: ltr;
  text-align: left;
}

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

/* ── App Layout Shell ──────────────────────────────────────────────────── */
.app-layout {
  min-height: 100vh;
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  display: block;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.portal-sidebar {
  width: var(--portal-sidebar-w);
  background: var(--portal-surface);
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 1040;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
}

html[dir="rtl"] .portal-sidebar {
  right: 0;
  left: auto;
  border-left: 1px solid var(--portal-border);
  border-right: none;
}

html[dir="ltr"] .portal-sidebar {
  left: 0;
  right: auto;
  border-right: 1px solid var(--portal-border);
  border-left: none;
}

.sidebar-brand {
  height: var(--portal-header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--portal-border-light);
}
.sidebar-brand img {
  height: 38px;
  object-fit: contain;
}
.sidebar-brand .portal-badge {
  font-size: 0.72rem;
  padding: 3px 9px;
  background: var(--portal-primary-light);
  color: var(--portal-primary);
  border-radius: var(--portal-radius-pill);
  font-weight: 700;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}
.sidebar-scroll::-webkit-scrollbar {
  width: 4px;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--portal-text-soft);
  padding: 14px 12px 6px;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--portal-text-muted);
  border-radius: var(--portal-radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  transition: var(--portal-transition);
  position: relative;
}
.nav-link-custom:hover {
  background: var(--portal-primary-light);
  color: var(--portal-primary);
}
.nav-link-custom.active {
  background: var(--portal-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(var(--portal-primary-rgb), 0.35);
}
.nav-link-custom i {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}
.nav-link-custom .badge {
  margin-inline-start: auto;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--portal-radius-pill);
}

.sidebar-user-card {
  padding: 14px 16px;
  border-top: 1px solid var(--portal-border-light);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--portal-surface);
}
.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--portal-primary-light);
  flex-shrink: 0;
}
.sidebar-user-info {
  flex: 1;
  overflow: hidden;
}
.sidebar-user-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--portal-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.74rem;
  color: var(--portal-text-muted);
}

/* ── Main Content Area ─────────────────────────────────────────────────── */
.portal-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
  min-width: 0;
  width: auto;
  max-width: 100%;
}

html[dir="rtl"] .portal-main {
  margin-right: var(--portal-sidebar-w);
  margin-left: 0;
}

html[dir="ltr"] .portal-main {
  margin-left: var(--portal-sidebar-w);
  margin-right: 0;
}

/* ── Top Header ────────────────────────────────────────────────────────── */
.portal-header {
  height: var(--portal-header-h);
  background: var(--portal-surface);
  border-bottom: 1px solid var(--portal-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: var(--portal-shadow-xs);
}

.portal-header-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: var(--portal-text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.portal-header-title i {
  color: var(--portal-primary);
}

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

.header-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--portal-primary-light);
  color: var(--portal-primary);
  padding: 6px 14px;
  border-radius: var(--portal-radius-pill);
  font-weight: 700;
  font-size: 0.86rem;
  border: 1px solid rgba(var(--portal-primary-rgb), 0.2);
}
.header-chip i {
  font-size: 1.1rem;
}

.btn-icon-custom {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--portal-bg);
  border: 1px solid var(--portal-border);
  color: var(--portal-text-muted);
  cursor: pointer;
  transition: var(--portal-transition);
  position: relative;
}
.btn-icon-custom:hover {
  background: var(--portal-surface);
  color: var(--portal-primary);
  border-color: var(--portal-primary);
  box-shadow: var(--portal-shadow-sm);
}

/* ── Content Container ─────────────────────────────────────────────────── */
.portal-body {
  flex: 1 1 auto;
  padding: 24px 28px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.portal-card {
  background: var(--portal-surface);
  border-radius: var(--portal-radius-md);
  border: 1px solid var(--portal-border);
  box-shadow: var(--portal-shadow-sm);
  transition: var(--portal-transition);
  overflow: hidden;
  margin-bottom: 24px;
}
.portal-card:hover {
  box-shadow: var(--portal-shadow-md);
}
.portal-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--portal-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--portal-surface);
}
.portal-card-header h5, 
.portal-card-header h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--portal-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.portal-card-body {
  padding: 24px;
}

/* ── Stat Cards ────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--portal-surface);
  border-radius: var(--portal-radius-md);
  border: 1px solid var(--portal-border);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--portal-shadow-sm);
  transition: var(--portal-transition);
  text-decoration: none;
  color: inherit;
  margin-bottom: 20px;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--portal-shadow-md);
  border-color: rgba(var(--portal-primary-rgb), 0.3);
  color: inherit;
}
.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--portal-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}
.stat-icon.primary { background: var(--portal-primary-light); color: var(--portal-primary); }
.stat-icon.success { background: var(--portal-success-light); color: var(--portal-success); }
.stat-icon.warning { background: var(--portal-warning-light); color: var(--portal-warning); }
.stat-icon.accent  { background: var(--portal-accent-light);  color: var(--portal-accent);  }
.stat-icon.danger  { background: var(--portal-danger-light);  color: var(--portal-danger);  }

.stat-content {
  flex: 1;
}
.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--portal-text);
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.84rem;
  color: var(--portal-text-muted);
  font-weight: 600;
}

/* ── Status Pills & Badges ─────────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--portal-radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
}
.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.status-pill.success { background: var(--portal-success-light); color: var(--portal-success); }
.status-pill.success::before { background: var(--portal-success); }
.status-pill.warning { background: var(--portal-warning-light); color: var(--portal-warning); }
.status-pill.warning::before { background: var(--portal-warning); }
.status-pill.danger  { background: var(--portal-danger-light);  color: var(--portal-danger);  }
.status-pill.danger::before  { background: var(--portal-danger); }
.status-pill.info    { background: var(--portal-primary-light); color: var(--portal-primary); }
.status-pill.info::before    { background: var(--portal-primary); }
.status-pill.neutral { background: #f1f5f9; color: #475569; }
.status-pill.neutral::before { background: #94a3b8; }

/* ── Modern Tables ─────────────────────────────────────────────────────── */
.portal-table-wrapper {
  overflow-x: auto;
  border-radius: var(--portal-radius-sm);
}
.portal-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0;
}
.portal-table th {
  background: var(--portal-bg);
  padding: 12px 18px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--portal-text-muted);
  border-bottom: 1px solid var(--portal-border);
  white-space: nowrap;
}
.portal-table td {
  padding: 14px 18px;
  font-size: 0.88rem;
  color: var(--portal-text);
  border-bottom: 1px solid var(--portal-border-light);
  vertical-align: middle;
  background: var(--portal-surface);
  transition: background 0.15s;
}
.portal-table tr:hover td {
  background: #fbfdff;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-portal-primary {
  background: var(--portal-primary);
  color: #ffffff;
  border: none;
  font-weight: 600;
  border-radius: var(--portal-radius-pill);
  padding: 8px 20px;
  box-shadow: 0 2px 8px rgba(var(--portal-primary-rgb), 0.3);
  transition: var(--portal-transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-portal-primary:hover {
  background: var(--portal-primary-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(var(--portal-primary-rgb), 0.4);
}

.btn-portal-outline {
  background: transparent;
  color: var(--portal-primary);
  border: 1px solid var(--portal-primary);
  font-weight: 600;
  border-radius: var(--portal-radius-pill);
  padding: 7px 18px;
  transition: var(--portal-transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-portal-outline:hover {
  background: var(--portal-primary);
  color: #ffffff;
  border-color: var(--portal-primary);
}

/* ── Modern Forms ──────────────────────────────────────────────────────── */
.form-label-custom {
  font-size: 0.84rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
  display: block;
}
.form-control-custom,
.form-select-custom {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  border-radius: var(--portal-radius-sm);
  border: 1px solid var(--portal-border);
  background: var(--portal-surface);
  color: var(--portal-text);
  transition: var(--portal-transition);
  outline: none;
}
.form-control-custom:focus,
.form-select-custom:focus {
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 3px rgba(var(--portal-primary-rgb), 0.15);
}
.input-group {
  flex-wrap: nowrap !important;
}
.input-group > .form-control-custom,
.input-group > .form-select-custom {
  position: relative;
  flex: 1 1 auto !important;
  width: 1% !important;
  min-width: 0;
}

/* ── Responsive & Mobile ───────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  html[dir="rtl"] .portal-sidebar {
    right: 0;
    left: auto;
    transform: translateX(100%);
  }
  html[dir="ltr"] .portal-sidebar {
    left: 0;
    right: auto;
    transform: translateX(-100%);
  }
  html[dir="rtl"] .portal-sidebar.show,
  html[dir="ltr"] .portal-sidebar.show {
    transform: translateX(0) !important;
  }
  html[dir="rtl"] .portal-main,
  html[dir="ltr"] .portal-main {
    margin-right: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .portal-body {
    padding: 16px;
  }
  .portal-header {
    padding: 0 16px;
  }
  .portal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1035;
    display: none;
  }
  .portal-overlay.show {
    display: block;
  }
}

/* ── Prevent any legacy panels or rogue elements after footer ──────────────── */
.customizer, .chat-windows {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

