/* Premium Portal Dashboard Override Styles */
body {
  background: #f1f5f9;
  color: #0f172a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-container {
  width: 100%;
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Onboarding Card Design */
.onboarding-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.02), 0 1px 3px rgba(0, 0, 0, 0.01);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.onboarding-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}

.identity-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .identity-grid {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 35px;
  }
}

.student-avatar {
  width: 75px;
  height: 75px;
  border-radius: 18px;
  background: #e0e7ff;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  border: 1px solid #c7d2fe;
  box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.15);
  transition: all 0.3s ease;
}

.onboarding-card.linked .student-avatar {
  background: #ecfdf5;
  color: #10b981;
  border-color: #a7f3d0;
  box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.15);
}

.onboarding-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  width: 100%;
}

.form-group {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: #94a3b8;
}

.form-input {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #0f172a;
  outline: none;
  transition: all 0.25s ease;
}

.form-input:focus {
  border-color: #4f46e5;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.link-btn {
  background: #1e293b;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.link-btn:hover {
  background: #0f172a;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

/* Linked Profile Badge Card */
.profile-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
  gap: 20px;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-name {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.profile-id-badge {
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  font-weight: 700;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
  padding: 1px 8px;
  border-radius: 4px;
}

.profile-email {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.unlink-btn {
  background: transparent;
  color: #94a3b8;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.unlink-btn:hover {
  color: #ef4444;
  border-color: #fca5a5;
  background: #fef2f2;
}

/* Tactial Map Section Layout */
.map-section {
  margin-top: 10px;
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.map-title {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (max-width: 768px) {
  .map-grid {
    grid-template-columns: 1fr;
  }
}

/* Curriculum Sector Card Styles (Expandable Drawer List Layout) */
.sector-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 16px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.01);
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.sector-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -4px rgba(79, 70, 229, 0.08);
  border-color: #cbd5e1;
}

.sector-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.sector-meta-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-grow: 1;
}

.sector-badge {
  font-family: 'Fira Code', monospace;
  font-size: 8px;
  font-weight: 800;
  color: #4f46e5;
  background: #e0e7ff;
  padding: 1px 6px;
  border-radius: 4px;
}

.sector-meta-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-lamp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 7.5px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 99px;
  transition: all 0.25s ease;
}

.status-lamp.checking {
  background: #f1f5f9;
  color: #94a3b8;
}

.status-lamp.synced {
  background: #ecfdf5;
  color: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.05);
}

.status-lamp.synced .lamp-dot {
  background: #10b981;
  box-shadow: 0 0 4px #10b981;
}

.status-lamp.unsynced {
  background: #fffbeb;
  color: #f59e0b;
}

.status-lamp.unsynced .lamp-dot {
  background: #f59e0b;
}

.lamp-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #cbd5e1;
  display: inline-block;
}

.sector-title {
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  line-height: 1.2;
}

/* Expandable Drawer Transition block */
.sector-details {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.sector-card:hover .sector-details {
  max-height: 200px;
  opacity: 1;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #f1f5f9;
}

.sector-desc {
  font-size: 10.5px;
  color: #64748b;
  margin-bottom: 10px;
  line-height: 1.4;
}

.sector-commands {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 5px 8px;
  border-radius: 6px;
}

.sector-commands-title {
  font-size: 7.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 2px;
}

.sector-commands-list {
  font-family: 'Fira Code', monospace;
  font-size: 9.5px;
  color: #475569;
  font-weight: 500;
}

.intrude-btn {
  background: #1e293b;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 8.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
}

.intrude-btn:hover {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.15);
}

/* Highlighted card when Synced */
.sector-card.completed-mode {
  border-color: #a7f3d0;
  background: linear-gradient(to right, #ffffff, #f7fee7);
}

.sector-card.completed-mode:hover {
  border-color: #10b981;
}

.sector-card.completed-mode .intrude-btn {
  background: #10b981;
  color: #ffffff;
}

.sector-card.completed-mode .intrude-btn:hover {
  background: #059669;
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.15);
}

/* Footer */
.portal-footer {
  margin-top: auto;
  padding: 30px 0;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: #cbd5e1;
}

/* Glassmorphism App Header & Timeline */
.app-header.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 16px 24px;
  margin: -40px -24px 20px -24px;
  /* Align perfectly to the top of portal-container */
  border-radius: 0 0 24px 24px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

.header-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.logo {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.logo-tag {
  font-size: 9px;
  font-weight: 800;
  color: #4f46e5;
  background: #e0e7ff;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  vertical-align: middle;
  -webkit-text-fill-color: initial;
  /* Reset inherited transparent text fill */
  -webkit-background-clip: initial;
  /* Reset inherited background clip */
}

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

/* Study Timeline Layout */
.header-timeline-row {
  border-top: 1px solid rgba(226, 232, 240, 0.6);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 20px;
}

.study-timeline {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  flex-grow: 1;
}

/* Webkit Scrollbar for timeline */
.study-timeline::-webkit-scrollbar {
  height: 4px;
}

.study-timeline::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.timeline-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  min-width: 45px;
  padding: 6px 4px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.timeline-item:hover {
  background: rgba(241, 245, 249, 0.8);
}

.timeline-item.active {
  background: #ffffff;
  box-shadow: 0 4px 15px -3px rgba(79, 70, 229, 0.15);
  border: 1px solid rgba(79, 70, 229, 0.15);
}

.timeline-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: all 0.25s ease;
}

/* Legend states */
.timeline-item.perfect .dot {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.timeline-item.pending .dot {
  background: #f59e0b;
}

.timeline-item.rejected .dot {
  background: #ef4444;
}

.timeline-item.empty .dot {
  background: #cbd5e1;
}

.timeline-item .day-label {
  font-size: 9px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}

.timeline-item.active .day-label {
  color: #4f46e5;
  font-weight: 800;
}

/* Timeline help & legend */
.timeline-help {
  position: relative;
  cursor: help;
}

.help-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.2s ease;
  border: 1px solid #cbd5e1;
}

.help-trigger:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.help-popup.glass {
  position: absolute;
  right: 0;
  top: 28px;
  width: 250px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
  display: none;
  z-index: 100;
  pointer-events: none;
}

.timeline-help:hover .help-popup.glass {
  display: block;
}

.help-popup h4 {
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.help-popup ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.help-popup li {
  font-size: 10px;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-popup li .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.help-popup li .dot.perfect {
  background: #10b981;
}

.help-popup li .dot.pending {
  background: #f59e0b;
}

.help-popup li .dot.rejected {
  background: #ef4444;
}

.help-popup li .dot.empty {
  background: #cbd5e1;
}

/* Premium Login Tab and select elements styles */
.login-role-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  width: fit-content;
}

.role-tab {
  background: transparent;
  border: none;
  color: #64748b;
  padding: 6px 16px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.role-tab.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 4px 10px -2px rgba(15, 23, 42, 0.05);
}

.student-dropdown:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.pass-info-box {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 11.5px;
  color: #065f46;
  line-height: 1.6;
  display: none;
  animation: fadeIn 0.3s ease;
}

/* 🔒 Sandbox intrusion locks for unauthenticated portal state */
.sector-card.portal-locked {
  filter: blur(2.5px) grayscale(85%);
  opacity: 0.5;
  pointer-events: none;
  position: relative;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sector-card.portal-locked::before {
  content: var(--lock-message, '🔒 接続未完了');
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1e293b;
  color: #f8fafc;
  padding: 8px 18px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  z-index: 10;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
  pointer-events: auto;
  white-space: nowrap;
}

/* Premium Collapsible Accordion Styles */
.stage-accordion {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.01);
  transition: all 0.25s ease;
}

.stage-accordion:hover {
  border-color: #cbd5e1;
}

.accordion-header {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.accordion-header.active {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.accordion-title-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.accordion-title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.accordion-desc {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
}

.accordion-arrow {
  font-size: 12px;
  color: #64748b;
  transition: transform 0.2s ease;
}

.stage-accordion.collapsed .accordion-arrow {
  transform: rotate(-90deg);
}

.accordion-content {
  padding: 14px;
  display: block;
  transition: max-height 0.25s ease;
}

.stage-accordion.collapsed .accordion-content {
  display: none;
}
