/* TinyLMS — User Layout (user.css) */

:root {
  --bg-light: #ffffff;
  --bg-hover: #f8f9fa;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --card-bg: #ffffff;
}

/* ── Sidebar Text ── */
.brand-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  color: #ffffff;
}

.brand-sub {
  font-size: .75rem;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Shell ── */
.user-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-light);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
}

/* ── User Sidebar ── */
.user-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--red-500);
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  overflow: hidden;
  color: #ffffff;
}

.user-sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.user-sidebar .sidebar-brand {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: var(--header-h);
}

.user-sidebar.collapsed .brand-text,
.user-sidebar.collapsed .brand-sub {
  display: none;
}

.user-sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .7rem 1.25rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.2s;
  position: relative;
  white-space: nowrap;
  border-radius: var(--radius-md-sidebar);
  margin: 0.25rem 0.75rem;
}

.user-sidebar .nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.user-sidebar .nav-item.active {
  background: var(--yellow-500);
  color: var(--text-primary);
  font-weight: 700;
}

.user-sidebar .nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #ffffff;
  border-radius: 0 2px 2px 0;
}

.user-sidebar.collapsed .nav-label {
  display: none;
}

.user-sidebar .nav-tooltip {
  position: absolute;
  left: calc(var(--sidebar-collapsed) + .5rem);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-primary);
  color: #ffffff;
  padding: .4rem .8rem;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  white-space: nowrap;
  border: 1px solid var(--border);
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 200;
  pointer-events: none;
}

.user-sidebar.collapsed .nav-item:hover .nav-tooltip {
  opacity: 1;
}

.user-sidebar .sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md-sidebar);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-toggle svg {
  width: 24px;
  height: 24px;
}

.user-sidebar.collapsed .toggle-icon {
  transform: rotate(180deg);
}

.user-sidebar.collapsed .toggle-label {
  display: none;
}

/* ── User Header ── */
.user-header {
  position: fixed;
  top: 0;
  right: 0;
  height: var(--header-h);
  left: var(--sidebar-w);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--yellow-500);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  transition: left 0.3s ease;
}

.user-header.collapsed {
  left: var(--sidebar-collapsed);
}

.header-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
}

.header-search {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.header-search-input {
  padding: .5rem 1rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-primary);
  font-size: .9rem;
  width: 260px;
  outline: none;
  transition: border-color 0.2s;
}

.header-search-input:focus {
  border-color: var(--red-500);
}

.header-search-input::placeholder {
  color: var(--text-muted);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #dc2626;
}

.btn-logout svg {
  color: inherit;
}

/* ── User Main ── */
.user-main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 2rem;
  min-height: calc(100vh - var(--header-h));
  transition: margin-left 0.3s ease;
  overflow-x: hidden;
}

.user-main.collapsed {
  margin-left: var(--sidebar-collapsed);
}

/* ── User Footer ── */
.user-footer {
  position: fixed;
  bottom: 0;
  right: 0;
  left: var(--sidebar-w);
  height: 20px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 0.7rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  z-index: 98;
  transition: left 0.3s ease;
}

.user-footer.collapsed {
  left: var(--sidebar-collapsed);
}

/* ── Training Cards ── */
.training-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s;
  cursor: pointer;
}

.training-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.training-card-thumb {
  height: 140px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  position: relative;
  border-bottom: 1px solid var(--border);
}

.training-card-badge {
  position: absolute;
  top: .75rem;
  right: .75rem;
}

.training-card-body {
  padding: 1.25rem;
}

.training-card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .4rem;
}

.training-card-meta {
  font-size: .8rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
}

/* ── Calendar ── */
.calendar-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.calendar-nav {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  padding: .3rem .6rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.calendar-nav:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.calendar-month {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day-label {
  text-align: center;
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: .4rem 0;
  text-transform: uppercase;
}

.calendar-day {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  cursor: default;
  transition: all 0.2s;
  position: relative;
}

.calendar-day.has-event {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 600;
}

.calendar-day.has-event:hover {
  background: rgba(0, 0, 0, 0.1);
}

.calendar-day.today {
  outline: 2px solid var(--text-primary);
  outline-offset: -2px;
  font-weight: 700;
}

.calendar-day.empty {
  opacity: 0;
  pointer-events: none;
}

/* ── Topic Viewer ── */
.topic-nav {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.topic-nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
  font-size: .9rem;
}

.topic-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.topic-nav-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
  font-weight: 600;
}

.topic-nav-item.done .topic-check {
  color: var(--red-500);
}

.topic-tabs {
  display: flex;
  gap: .4rem;
  padding: .4rem;
  background: #f1f5f9;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.topic-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: .75rem 1.25rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.2s;
  white-space: nowrap;
}

.topic-tab:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-primary);
}

.topic-tab.active {
  background: #ffffff;
  color: var(--red-500);
  box-shadow: var(--shadow-sm);
}

.topic-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.topic-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topic-check {
  font-size: .9rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* ── Certificate ── */
.cert-container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

canvas#certCanvas {
  width: 100%;
  height: auto;
  display: block;
}

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red-500), var(--yellow-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  color: #fff;
}

/* ── Profile ── */
.profile-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
}

/* ── Record Timeline ── */
.record-item {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.record-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.record-icon.completed {
  background: rgba(46, 204, 113, 0.2);
  color: var(--green-400);
}

.record-icon.in-progress {
  background: rgba(67, 97, 238, 0.2);
  color: var(--indigo-400);
}

.record-body {
  flex: 1;
}

.record-title {
  font-weight: 600;
  margin-bottom: .2rem;
}

.record-meta {
  font-size: .8rem;
  color: var(--text-muted);
}

.record-actions {
  display: flex;
  gap: .5rem;
  align-items: flex-start;
}

/* ── Test View ── */
.test-question {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.test-question-num {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: .5rem;
}

.test-options {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.test-option {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
}

.test-option:hover {
  border-color: var(--text-primary);
  background: var(--bg-hover);
}

.test-option.selected {
  border-color: var(--text-primary);
  background: var(--bg-hover);
}

.test-option.correct {
  border-color: var(--green-400);
  background: rgba(46, 204, 113, 0.1);
}

.test-option.wrong {
  border-color: var(--red-400);
  background: rgba(231, 76, 60, 0.1);
}

.option-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.2s;
}

.test-option.selected .option-marker {
  border-color: var(--indigo-500);
  background: var(--indigo-500);
  color: #fff;
}

/* ── Evaluation Likert ── */
.likert-scale {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin: 1.25rem 0 0.5rem;
}

.likert-btn {
  flex: 1;
  aspect-ratio: 1;
  max-width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  background: #ffffff;
  border-radius: 50%;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.likert-btn:hover {
  border-color: var(--red-500);
  color: var(--red-500);
  background: rgba(245, 31, 7, 0.04);
  transform: translateY(-2px);
}

.likert-btn.active {
  background: var(--red-500);
  border-color: var(--red-500);
  color: #ffffff;
  box-shadow: 0 6px 15px rgba(245, 31, 7, 0.3);
  transform: scale(1.1);
}

.likert-btn:active {
  transform: scale(0.95);
}

/* ── Login Pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 15% 15%, rgba(245, 31, 7, 0.08) 0%, transparent 35%), radial-gradient(circle at 85% 85%, rgba(245, 182, 7, 0.08) 0%, transparent 35%), #f8f9fa;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-bottom: 2rem;
}

.auth-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.auth-sub {
  color: var(--text-muted);
  font-size: .9rem;
  margin-top: .25rem;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .user-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
  }

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

  .user-header {
    left: 0 !important;
    width: 100%;
  }

  .user-main {
    margin-left: 0 !important;
  }

  .calendar-wrap {
    overflow-x: auto;
  }
}

@media (max-width: 600px) {

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

  .user-main {
    padding: 1rem;
  }

  .auth-card {
    padding: 1.5rem;
  }
}