/* ==========================================================================
   Al-Eman Educational Academy LMS - Wireframe Master Stylesheet
   Design System: Modern Educational Tech, Glassmorphism, Responsive Shell
   ========================================================================== */

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

:root {
  --primary-navy: #0f172a;
  --secondary-navy: #1e293b;
  --brand-blue: #2563eb;
  --brand-blue-hover: #1d4ed8;
  --brand-blue-light: #eff6ff;
  --accent-emerald: #10b981;
  --accent-emerald-light: #ecfdf5;
  --warning-amber: #f59e0b;
  --warning-amber-light: #fffbeb;
  --danger-rose: #f43f5e;
  --danger-rose-light: #fff1f2;
  --purple-indigo: #6366f1;
  
  --bg-canvas: #f8fafc;
  --card-bg: #ffffff;
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #0b1120;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--primary-navy);
}

/* Prototype Top Control Bar */
.proto-control-bar {
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  color: #fff;
}

.proto-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.proto-logo-badge {
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.5);
}

.proto-title {
  display: flex;
  flex-direction: column;
}

.proto-title-main {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
}

.proto-title-sub {
  font-size: 11px;
  color: #94a3b8;
}

.proto-nav-tools {
  display: flex;
  align-items: center;
  gap: 16px;
}

.role-switch-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid #334155;
}

.role-switch-label {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
}

.role-select {
  background: transparent;
  color: #38bdf8;
  border: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.role-select option {
  background: #0f172a;
  color: #fff;
}

.viewport-toggle-group {
  display: flex;
  background: #1e293b;
  border-radius: var(--radius-full);
  padding: 3px;
  border: 1px solid #334155;
}

.viewport-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.viewport-btn:hover {
  color: #fff;
}

.viewport-btn.active {
  background: var(--brand-blue);
  color: #fff;
  font-weight: 600;
}

.guided-tour-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
  transition: var(--transition);
}

.guided-tour-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

/* Device Simulator Wrapper */
.device-stage-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px;
  background: #090e1a;
  overflow-y: auto;
  overflow-x: hidden;
}

.device-frame {
  background: var(--bg-canvas);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  transition: width 0.3s ease, border-radius 0.3s ease;
  min-height: 820px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
}

.device-frame.desktop {
  width: 1440px;
  max-width: 100%;
}

.device-frame.tablet {
  width: 768px;
  max-width: 100%;
}

.device-frame.mobile {
  width: 375px;
  max-width: 100%;
  border-radius: 36px;
  border: 10px solid #1e293b;
}

/* Specific Adaptive Overrides for Mobile Device Frame */
.device-frame.mobile .lms-navbar {
  height: auto;
  min-height: 54px;
  padding: 8px 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.device-frame.mobile .lms-logo {
  font-size: 16px;
}

.device-frame.mobile .role-badge-current {
  font-size: 10px;
  padding: 2px 7px;
}

.device-frame.mobile .user-role-label {
  display: none;
}

.device-frame.mobile .credit-pill {
  padding: 3px 8px;
  font-size: 11px;
}

.device-frame.mobile .user-avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.device-frame.mobile .lms-body {
  flex-direction: column;
}

.device-frame.mobile .lms-sidebar {
  width: 100%;
  border-right: none;
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 12px;
  position: sticky;
  top: 0;
  z-index: 95;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.device-frame.mobile .nav-section-title {
  display: none;
}

.device-frame.mobile .nav-menu {
  flex-direction: row;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 6px;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.device-frame.mobile .nav-item {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 7px 12px;
  font-size: 12px;
  border-radius: var(--radius-full);
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
}

.device-frame.mobile .nav-item.active {
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  border-color: var(--brand-blue);
  font-weight: 700;
}

.device-frame.mobile .lms-main-content {
  padding: 16px 12px;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
}

.device-frame.mobile .page-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.device-frame.mobile .page-header-text h2 {
  font-size: 18px;
}

.device-frame.mobile .header-actions {
  width: 100%;
  flex-wrap: wrap;
  gap: 8px;
}

.device-frame.mobile .header-actions .btn {
  flex: 1;
  min-width: 110px;
  font-size: 12px;
  padding: 7px 10px;
  justify-content: center;
}

/* Specific Adaptive Overrides for Tablet Device Frame */
.device-frame.tablet .lms-sidebar {
  width: 200px;
  padding: 16px 8px;
}

.device-frame.tablet .nav-item {
  padding: 8px 10px;
  font-size: 12px;
  gap: 8px;
}

.device-frame.tablet .nav-section-title {
  font-size: 9px;
  padding: 6px 8px;
}

.device-frame.tablet .lms-main-content {
  padding: 20px 16px;
}

/* LMS Layout Inside Device */
.lms-app-layout {
  display: flex;
  flex-direction: column;
  min-height: 820px;
  width: 100%;
  background: var(--bg-canvas);
}

.lms-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lms-nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.lms-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--primary-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.lms-logo span {
  color: var(--brand-blue);
}

.role-badge-current {
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.lms-nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.credit-pill {
  background: var(--accent-emerald-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #065f46;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.icon-btn:hover {
  background: #f1f5f9;
}

.icon-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--danger-rose);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-navy);
}

.user-role-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* LMS Body Shell (Sidebar + Main Content) */
.lms-body {
  display: flex;
  flex: 1;
}

.lms-sidebar {
  width: 240px;
  background: #ffffff;
  border-right: 1px solid var(--border-subtle);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
  padding: 8px 12px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.nav-item:hover {
  background: #f1f5f9;
  color: var(--primary-navy);
}

.nav-item.active {
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  font-weight: 600;
}

.nav-item .icon {
  font-size: 16px;
}

.nav-item .badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

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

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

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

.lms-main-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
  background: #f8fafc;
}

/* Breadcrumbs & Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header-text h2 {
  font-size: 22px;
  color: var(--primary-navy);
}

.page-header-text p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.btn-primary {
  background: var(--brand-blue);
  color: #fff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background: var(--brand-blue-hover);
}

.btn-success {
  background: var(--accent-emerald);
  color: #fff;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger-rose);
  color: #fff;
}

.btn-danger:hover {
  background: #e11d48;
}

.btn-secondary {
  background: #ffffff;
  color: var(--primary-navy);
  border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
  background: #f1f5f9;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

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

/* Modals & Drawers */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header h3 {
  font-size: 17px;
  color: var(--primary-navy);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-light);
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--secondary-navy);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--primary-navy);
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--primary-navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--brand-blue);
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left-color: var(--accent-emerald); }
.toast.warning { border-left-color: var(--warning-amber); }
.toast.danger { border-left-color: var(--danger-rose); }

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

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

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

/* ==========================================================================
   Global Responsive Breakpoints (Real Mobile & Tablet Browser Windows)
   ========================================================================== */

@media (max-width: 992px) {
  .proto-control-bar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 16px;
  }
  
  .proto-brand {
    flex: 1;
    min-width: 240px;
  }
  
  .proto-nav-tools {
    flex: 1;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px;
  }

  .device-stage-container {
    padding: 16px 8px;
  }

  .lms-body {
    flex-direction: column;
  }

  .lms-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 8px 12px;
    position: sticky;
    top: 0;
    z-index: 95;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
  }

  .lms-sidebar .nav-section-title {
    display: none;
  }

  .lms-sidebar .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .lms-sidebar .nav-item {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 7px 12px;
    font-size: 12px;
    border-radius: var(--radius-full);
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
  }

  .lms-sidebar .nav-item.active {
    background: var(--brand-blue-light);
    color: var(--brand-blue);
    border-color: var(--brand-blue);
    font-weight: 700;
  }

  .lms-main-content {
    padding: 18px 14px;
    overflow-x: hidden;
  }
}

@media (max-width: 768px) {
  .proto-title-sub {
    display: none;
  }

  .role-switch-container {
    width: 100%;
    justify-content: space-between;
  }

  .role-select {
    font-size: 12px;
  }

  .viewport-toggle-group {
    width: 100%;
    justify-content: space-around;
  }

  .guided-tour-btn {
    width: 100%;
    justify-content: center;
  }

  .device-stage-container {
    padding: 8px 4px;
  }

  .device-frame {
    border-radius: 16px;
  }

  .device-frame.mobile {
    border-width: 6px;
    border-radius: 24px;
  }

  .lms-navbar {
    height: auto;
    min-height: 52px;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .lms-nav-left {
    gap: 8px;
  }

  .lms-logo {
    font-size: 16px;
  }

  .role-badge-current {
    font-size: 10px;
    padding: 2px 7px;
  }

  .user-role-label {
    display: none;
  }

  .credit-pill {
    padding: 3px 8px;
    font-size: 11px;
  }

  .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-header-text h2 {
    font-size: 18px;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-actions .btn {
    flex: 1;
    min-width: 100px;
    font-size: 12px;
    padding: 7px 10px;
    justify-content: center;
  }

  /* Modals on Mobile */
  .modal-backdrop {
    padding: 8px;
  }

  .modal-dialog {
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 12px 16px;
    flex-shrink: 0;
  }

  .modal-header h3 {
    font-size: 15px;
  }

  .modal-body {
    padding: 14px;
    max-height: calc(94vh - 120px);
  }

  .modal-footer {
    padding: 10px 14px;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-footer .btn {
    flex: 1;
    min-width: 110px;
    justify-content: center;
  }

  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    font-size: 12px;
    padding: 10px 14px;
  }
}

@media (max-width: 480px) {
  .device-frame.mobile {
    border-width: 4px;
    border-radius: 18px;
  }

  .lms-main-content {
    padding: 12px 8px;
  }
}

