/* ==========================================================================
   NG ONE — MINIMAL STUDENT PORTAL DESIGN SYSTEM
   Ultra-clean, modern, highly functional workspace for medical students
   ========================================================================== */

html {
  max-width: 100%;
  overflow-x: hidden !important;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body, body.student-portal-body {
  background: #f8fafc;
  color: #0f172a;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 74px; /* Space for 56px bottom navigation dock */
  margin: 0;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
  position: relative;
}

/* --------------------------------------------------------------------------
   1. Minimal Student Top Header (54px)
   -------------------------------------------------------------------------- */
.dash-header-minimal {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  z-index: 900;
  display: flex;
  align-items: center;
}

.dash-header-inner {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dash-brand-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.dash-brand-img {
  height: 27px;
  width: auto;
  display: block;
}

.dash-header-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: #0052cc;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.dash-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.dash-search-input-top {
  height: 32px;
  width: 210px;
  padding: 0 0.75rem 0 2rem;
  background: #f1f5f9;
  border: 1px solid transparent;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.78rem;
  outline: none;
  transition: all 0.15s ease;
}

.dash-search-input-top:focus {
  background: #ffffff;
  border-color: #0052cc;
  width: 250px;
}

.dash-search-icon-pos {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.dash-top-cart-btn {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #ffffff;
  text-decoration: none;
  transition: all 0.15s ease;
}

.dash-top-cart-btn:hover {
  border-color: #0052cc;
  color: #0052cc;
}

.dash-top-cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 9999px;
  background: #0052cc;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}

.dash-top-avatar-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 0.2rem 0.5rem 0.2rem 0.25rem;
  border-radius: 9999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f172a;
}

.dash-top-avatar-btn:hover {
  border-color: #cbd5e1;
}

.dash-top-avatar-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0052cc;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
}

/* User Dropdown */
.dash-user-dropdown-wrap {
  position: relative;
}

.dash-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  padding: 0.4rem;
  display: none;
  z-index: 950;
}

.dash-user-dropdown.open {
  display: block;
}

.dash-dropdown-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
}

.dash-dropdown-link:hover {
  background: #f8fafc;
  color: #0052cc;
}

.dash-dropdown-link.danger {
  color: #dc2626;
}

.dash-dropdown-link.danger:hover {
  background: #fef2f2;
}

/* --------------------------------------------------------------------------
   2. Page Container & Layout
   -------------------------------------------------------------------------- */
.dash-page-container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Page Header Title Strip */
.dash-page-heading {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.dash-page-title-group h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.2rem 0;
  letter-spacing: -0.01em;
}

.dash-page-title-group p {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
}

/* Hero Strip */
.dash-hero-minimal {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.35rem;
  margin-bottom: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.dash-hero-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.dash-hero-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #0052cc;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  flex-shrink: 0;
}

.dash-hero-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
  margin: 0;
}

.dash-hero-meta {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 2px;
}

.dash-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.95rem;
  background: #0052cc;
  color: #ffffff;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
}

.dash-hero-btn:hover {
  background: #0043a8;
  color: #ffffff;
}

.dash-hero-btn.btn-secondary {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

.dash-hero-btn.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* --------------------------------------------------------------------------
   3. 4-Metric Strip
   -------------------------------------------------------------------------- */
.dash-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.dash-stat-chip {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 0.7rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat-chip-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-chip-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

/* --------------------------------------------------------------------------
   4. Filter Pills Strip
   -------------------------------------------------------------------------- */
.dash-filter-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.dash-filter-pill {
  height: 30px;
  padding: 0 0.8rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  text-decoration: none;
}

.dash-filter-pill:hover {
  border-color: #cbd5e1;
  color: #0f172a;
}

.dash-filter-pill.active {
  background: #0052cc;
  color: #ffffff;
  border-color: #0052cc;
}

/* --------------------------------------------------------------------------
   5. Card Grid & Resource Cards
   -------------------------------------------------------------------------- */
.dash-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.resource-card-mini {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.resource-card-mini:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  transform: translateY(-2px);
}

.resource-mini-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  overflow: hidden;
}

.resource-mini-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.resource-type-chip {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: #ffffff;
  backdrop-filter: blur(4px);
}

.type-video { background: rgba(220, 38, 38, 0.9); }
.type-ebook { background: rgba(16, 185, 129, 0.9); }
.type-doc   { background: rgba(0, 82, 204, 0.9); }

.resource-mini-body {
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.resource-mini-category {
  font-size: 0.67rem;
  font-weight: 700;
  color: #0052cc;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.resource-mini-title {
  font-size: 0.88rem;
  font-weight: 750;
  color: #0f172a;
  line-height: 1.3;
  margin: 0 0 0.25rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.resource-mini-author {
  font-size: 0.72rem;
  color: #64748b;
  margin-bottom: 0.75rem;
}

.resource-mini-footer {
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid #f1f5f9;
  display: flex;
  gap: 0.4rem;
}

.btn-open-resource {
  flex: 1;
  height: 32px;
  background: #0052cc;
  color: #ffffff;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  border: none;
}

.btn-open-resource:hover {
  background: #0043a8;
  color: #ffffff;
}

.btn-down-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-down-icon:hover {
  border-color: #0052cc;
  color: #0052cc;
}

/* Empty State */
.dash-empty-minimal {
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  max-width: 520px;
  margin: 1.5rem auto;
}

.dash-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem auto;
}

.dash-empty-title {
  font-size: 0.95rem;
  font-weight: 750;
  color: #0f172a;
  margin: 0 0 0.3rem 0;
}

.dash-empty-text {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0 0 1rem 0;
}

/* --------------------------------------------------------------------------
   6. Orders Table (Purchases)
   -------------------------------------------------------------------------- */
.orders-table-wrap {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow-x: auto;
}

.orders-table-mini {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.orders-table-mini th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 700;
  text-align: left;
  padding: 0.65rem 0.95rem;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.orders-table-mini td {
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

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

.orders-table-mini tr:hover td {
  background: #fbfcfe;
}

.badge-paid-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge-pending-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Mobile Orders List */
.orders-mobile-list {
  display: none;
  flex-direction: column;
  gap: 0.65rem;
}

.order-card-mobile {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.order-card-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-num-tag {
  font-weight: 800;
  font-size: 0.82rem;
  color: #0f172a;
}

.order-items-preview {
  font-size: 0.75rem;
  color: #64748b;
}

.order-card-row-bot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.4rem;
  border-top: 1px solid #f1f5f9;
}

.order-amount-tag {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
}

/* --------------------------------------------------------------------------
   7. Settings Grid
   -------------------------------------------------------------------------- */
.settings-grid-mini {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.settings-card-mini {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
}

.settings-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.2rem 0;
}

.settings-card-desc {
  font-size: 0.74rem;
  color: #64748b;
  margin: 0 0 0.95rem 0;
}

.form-group-mini {
  margin-bottom: 0.85rem;
}

.form-label-mini {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.input-mini {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: 0.82rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  outline: none;
  transition: border-color 0.15s ease;
}

.input-mini:focus {
  border-color: #0052cc;
}

.btn-save-mini {
  padding: 0.5rem 1rem;
  background: #0052cc;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-save-mini:hover {
  background: #0043a8;
}

/* --------------------------------------------------------------------------
   8. Comprehensive Responsive Design System (Mobile, Tablet, Desktop)
   -------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .dash-stats-strip { grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
  .dash-card-grid { grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }
  .settings-grid-mini { grid-template-columns: 1fr; }
  .settings-grid-executive { grid-template-columns: 1fr; }
  .shortcuts-grid-row { grid-template-columns: 1fr; }
  .dash-search-input-top { display: none; }
  .dash-search-icon-pos { display: none; }
}

@media (max-width: 640px) {
  /* Prevent content being covered by bottom dock */
  body, body.student-portal-body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  .dash-page-container {
    padding: 0.85rem 0.75rem calc(4.5rem + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  /* Page Headings */
  .dash-page-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 1rem;
  }

  .dash-page-heading .dash-hero-btn {
    width: 100%;
    justify-content: center;
    height: 38px;
  }

  /* Hero Section */
  .dash-hero-minimal {
    padding: 0.85rem 0.95rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .dash-hero-minimal .dash-hero-btn {
    width: 100%;
    justify-content: center;
    height: 38px;
  }

  .dash-hero-avatar {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .dash-hero-name {
    font-size: 1.05rem;
  }

  /* 4-Stat Grid */
  .dash-stats-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .dash-stat-chip {
    padding: 0.6rem 0.75rem;
  }

  .stat-chip-label {
    font-size: 0.62rem;
  }

  .stat-chip-val {
    font-size: 1.15rem;
  }

  /* Resource Cards Single Column */
  .dash-card-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  /* Orders: hide table, show mobile cards */
  .orders-table-wrap {
    display: none;
  }

  .orders-mobile-list {
    display: flex;
  }

  /* iOS Input Zoom Prevention (16px base on mobile) */
  .input-exec,
  .input-mini,
  input[type="text"],
  input[type="email"],
  input[type="password"] {
    font-size: 16px !important;
  }

  /* Buttons on Mobile */
  .btn-submit-exec,
  .btn-save-mini {
    width: 100%;
    height: 42px;
    font-size: 0.86rem;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .dash-page-container {
    padding: 0.65rem 0.6rem calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }

  .dash-stat-chip {
    padding: 0.5rem 0.65rem;
  }

  .resource-mini-body {
    padding: 0.75rem 0.8rem;
  }

  .resource-mini-title {
    font-size: 0.85rem;
  }
}
