/* ==========================================================================
   نظام إدارة الجامعات الذكي | Smart University Management System
   Apple-Inspired Glassmorphism Shell Styling & Transitions
   ========================================================================== */

#app-shell-root {
  width: 100%;
  height: 100%;
  display: flex;
}

.shell-layout {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, var(--bg-surface) 0%, var(--bg-primary) 100%);
}

.shell-header {
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
  box-shadow: var(--box-shadow-apple);
}

.shell-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: var(--font-size-base);
  color: var(--text-primary);
}

.brand-logo {
  font-size: 1.6rem;
  background: linear-gradient(135deg, #2563eb, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  transform: scale(1.1);
  transition: var(--transition-normal);
}

.brand-title {
  background: linear-gradient(135deg, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1.1rem;
  letter-spacing: -0.3px;
}

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

.shell-icon-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.shell-icon-btn:hover {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-green));
  color: #ffffff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.shell-user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
}
.user-avatar { font-size: 1.1rem; }

.shell-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar Menu - Apple Rounded Cards & Smooth Transitions */
.shell-sidebar {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  overflow-y: auto;
  gap: 6px;
  transition: width .25s ease, flex-basis .25s ease, padding .25s ease, transform .25s ease;
}

.shell-layout.sidebar-collapsed .shell-sidebar {
  display: none;
}

.shell-menu-toggle {
  min-width: 40px;
  min-height: 40px;
  justify-content: center;
  padding: 6px 10px;
  font-size: 1.25rem !important;
}

.shell-menu-toggle-label {
  font-size: .82rem;
}

.shell-sidebar-backdrop {
  display: none;
  border: 0;
  padding: 0;
  background: rgba(2, 6, 23, .62);
}

[dir="ltr"] .shell-sidebar {
  border-left: none;
  border-right: 1px solid var(--glass-border);
}

.menu-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--brand-green);
  margin: 12px 10px 4px 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.menu-item .menu-icon {
  font-size: 1.35rem;
  transition: var(--transition-fast);
}

.menu-item:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(16, 185, 129, 0.15));
  color: var(--text-primary);
  transform: translateX(-3px);
}
[dir="ltr"] .menu-item:hover {
  transform: translateX(3px);
}

.menu-item.active {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-green));
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.menu-item:hover .menu-icon {
  transform: scale(1.18);
}

/* Workspace & Chrome / VSCode Tab Bar */
.shell-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-primary);
}

.shell-tab-strip {
  height: var(--tab-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-end;
  padding: 0 8px;
  gap: 4px;
  overflow-x: auto;
}

/* Tab Item Element - Apple Rounded Top Tabs */
.erp-tab-item {
  height: 36px;
  padding: 0 14px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  cursor: pointer;
  max-width: 240px;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.erp-tab-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.erp-tab-item.active {
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
  color: var(--text-primary);
  border-top: 3px solid var(--brand-green);
  font-weight: 600;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.erp-tab-icon {
  font-size: 1.1rem;
}

.erp-tab-close {
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  line-height: 1;
  transition: var(--transition-fast);
}
.erp-tab-close:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.shell-tab-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Statusbar */
.shell-statusbar {
  height: var(--statusbar-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator.online {
  color: var(--brand-green);
  font-size: 0.9rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

@media (max-width: 768px) {
  :root {
    --header-height: 58px;
    --statusbar-height: 28px;
  }

  .shell-header {
    padding: 0 8px;
    gap: 6px;
  }

  .shell-brand,
  .shell-header-actions {
    gap: 6px;
  }

  .brand-title,
  .shell-user-profile > div,
  #btn-toggle-lang {
    display: none;
  }

  .shell-user-profile {
    padding: 3px 6px;
    gap: 4px;
    background: transparent;
    border: 0;
  }

  #btn-logout {
    margin-right: 0 !important;
    padding: 6px 9px;
  }

  .shell-sidebar {
    position: fixed;
    z-index: 40;
    top: var(--header-height);
    bottom: var(--statusbar-height);
    right: 0;
    width: min(86vw, 320px);
    max-width: 320px;
    flex-basis: auto;
    transform: translateX(105%);
    box-shadow: -12px 0 30px rgba(0, 0, 0, .35);
    border-left: 1px solid var(--glass-border);
  }

  .shell-layout.sidebar-collapsed .shell-sidebar {
    display: flex;
  }

  [dir="ltr"] .shell-sidebar {
    right: auto;
    left: 0;
    transform: translateX(-105%);
    box-shadow: 12px 0 30px rgba(0, 0, 0, .35);
  }

  .shell-layout.sidebar-mobile-open .shell-sidebar,
  [dir="ltr"] .shell-layout.sidebar-mobile-open .shell-sidebar {
    transform: translateX(0);
  }

  .shell-layout.sidebar-mobile-open .shell-sidebar-backdrop {
    display: block;
    position: fixed;
    z-index: 35;
    inset: var(--header-height) 0 var(--statusbar-height);
  }

  .shell-workspace {
    min-width: 0;
    width: 100%;
  }

  .shell-tab-strip {
    padding: 0 4px;
  }

  .erp-tab-item {
    max-width: 190px;
    padding: 0 10px;
  }

  .shell-statusbar {
    padding: 0 8px;
    font-size: .68rem;
  }

  .status-right {
    display: none;
  }
}

@media (max-width: 420px) {
  .brand-logo,
  .user-avatar {
    display: none;
  }

  .shell-icon-btn {
    padding: 6px 8px;
  }
}
