:root {
  --sap-primary: #0070f2;
  --sap-primary-hover: #005ac2;
  --sap-dark: #0f172a;
  --sap-surface: #ffffff;
  --sap-surface-elevated: #f8fafc;
  --sap-border: #e2e8f0;
  --sap-text: #1e293b;
  --sap-text-muted: #64748b;
  --sap-accent-s4: #0070f2;
  --sap-accent-mm: #059669;
  --sap-accent-co: #d97706;
  --sap-accent-sd: #4f46e5;
  --sap-accent-qm: #dc2626;
  --sap-success: #10b981;
  --sap-warning: #f59e0b;
  --sap-danger: #ef4444;
  --sap-gui-header: #354a5f;
  --sap-gui-ribbon: #ebf1f6;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

[data-theme="dark"] {
  --sap-dark: #020617;
  --sap-surface: #0f172a;
  --sap-surface-elevated: #1e293b;
  --sap-border: #334155;
  --sap-text: #f1f5f9;
  --sap-text-muted: #94a3b8;
  --sap-gui-ribbon: #1e293b;
  --sap-gui-header: #0f172a;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--sap-dark);
  color: var(--sap-text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Fiori Top Shellbar */
.sap-shellbar {
  background: #182736;
  color: #ffffff;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  border-bottom: 2px solid var(--sap-primary);
}

.shell-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sap-logo-badge {
  background: var(--sap-primary);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.shell-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.shell-title span {
  font-weight: 400;
  color: #94a3b8;
  font-size: 13px;
  margin-left: 8px;
}

.shell-center {
  flex: 1;
  max-width: 480px;
  margin: 0 24px;
}

/* SAP OK-Code Command Bar */
.sap-command-bar {
  display: flex;
  align-items: center;
  background: #283a4c;
  border: 1px solid #486178;
  border-radius: 4px;
  padding: 2px 6px;
  transition: border-color 0.2s;
}

.sap-command-bar:focus-within {
  border-color: #0070f2;
  box-shadow: 0 0 0 2px rgba(0, 112, 242, 0.4);
}

.cmd-prefix {
  color: #00e5ff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: bold;
  padding: 0 4px;
  user-select: none;
}

.sap-command-bar input {
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  padding: 4px 8px;
  outline: none;
  text-transform: uppercase;
}

.sap-command-bar input::placeholder {
  color: #7b94ad;
  text-transform: none;
  font-family: var(--font-main);
  font-weight: 400;
  font-size: 12px;
}

.cmd-btn {
  background: var(--sap-primary);
  color: #ffffff;
  border: none;
  border-radius: 3px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.cmd-btn:hover {
  background: var(--sap-primary-hover);
}

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

.theme-toggle-btn, .action-btn {
  background: #283a4c;
  color: #cbd5e1;
  border: 1px solid #486178;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.theme-toggle-btn:hover, .action-btn:hover {
  background: #364d64;
  color: #ffffff;
}

/* Sub-Navigation Bar */
.sap-navbar {
  background: #1e293b;
  border-bottom: 1px solid #334155;
  display: flex;
  gap: 4px;
  padding: 0 24px;
  overflow-x: auto;
}

.nav-tab {
  padding: 12px 18px;
  color: #94a3b8;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
}

.nav-tab:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.03);
}

.nav-tab.active {
  color: #ffffff;
  font-weight: 600;
  border-bottom-color: var(--sap-primary);
  background: rgba(0, 112, 242, 0.08);
}

/* App Main Container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* Tab Views */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

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

/* Hero Section */
.hero-banner {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,112,242,0.2);
  color: #38bdf8;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.hero-desc {
  font-size: 15px;
  color: #cbd5e1;
  max-width: 850px;
  line-height: 1.6;
}

.module-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.pill-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.pill-btn:hover, .pill-btn.active {
  background: var(--sap-primary);
  border-color: var(--sap-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 112, 242, 0.3);
}

/* Module Cards Grid */
.module-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}

.module-card {
  background: var(--sap-surface);
  border: 1px solid var(--sap-border);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.module-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--sap-primary);
}

.module-card.selected {
  border-color: var(--sap-primary);
  box-shadow: 0 0 0 2px var(--sap-primary);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}

.card-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-tagline {
  font-size: 12px;
  color: var(--sap-text-muted);
  margin-bottom: 12px;
}

.card-summary {
  font-size: 13px;
  color: var(--sap-text);
  line-height: 1.5;
  margin-bottom: 16px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--sap-border);
  padding-top: 12px;
  font-size: 12px;
  color: var(--sap-primary);
  font-weight: 600;
}

/* Module Deep Dive Detailed Panel */
.deep-dive-panel {
  background: var(--sap-surface);
  border: 1px solid var(--sap-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-md);
}

.deep-dive-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--sap-border);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.deep-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.deep-title-group h2 {
  font-size: 22px;
  font-weight: 700;
}

.deep-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .deep-section-grid {
    grid-template-columns: 1fr;
  }
}

.info-box {
  background: var(--sap-surface-elevated);
  border: 1px solid var(--sap-border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.info-box h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sap-primary);
}

.info-list {
  list-style: none;
}

.info-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.info-list li::before {
  content: "?";
  position: absolute;
  left: 2px;
  color: var(--sap-primary);
  font-size: 16px;
}

/* S/4HANA vs ECC Comparison Table */
.comparison-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.sap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.sap-table th, .sap-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--sap-border);
}

.sap-table th {
  background: var(--sap-surface-elevated);
  font-weight: 700;
  color: var(--sap-text);
}

.sap-table tr:hover td {
  background: rgba(0, 112, 242, 0.04);
}

.tcode-badge {
  font-family: var(--font-mono);
  background: #1e293b;
  color: #38bdf8;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border: 1px solid #334155;
  transition: all 0.2s;
}

.tcode-badge:hover {
  background: var(--sap-primary);
  color: #ffffff;
  border-color: var(--sap-primary);
}

/* Process Flow Interactive Stepper */
.flow-selector-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.flow-btn {
  background: var(--sap-surface);
  border: 1px solid var(--sap-border);
  color: var(--sap-text);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.flow-btn.active {
  background: var(--sap-primary);
  color: #fff;
  border-color: var(--sap-primary);
  box-shadow: 0 4px 12px rgba(0, 112, 242, 0.3);
}

.flow-timeline {
  display: flex;
  align-items: stretch;
  gap: 12px;
  overflow-x: auto;
  padding: 16px 8px;
  margin-bottom: 24px;
}

.flow-step-node {
  flex: 1;
  min-width: 190px;
  background: var(--sap-surface);
  border: 2px solid var(--sap-border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.flow-step-node:hover {
  border-color: var(--sap-primary);
  transform: translateY(-2px);
}

.flow-step-node.active {
  border-color: var(--sap-primary);
  background: var(--sap-surface-elevated);
  box-shadow: 0 0 0 3px rgba(0, 112, 242, 0.2);
}

.step-num-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--sap-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.step-node-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.step-node-tcode {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--sap-primary);
  font-weight: 600;
}

.step-detail-card {
  background: var(--sap-surface);
  border: 1px solid var(--sap-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.accounting-box {
  background: #0f172a;
  color: #38bdf8;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  margin-top: 12px;
  border-left: 4px solid #38bdf8;
}

/* SAP GUI Window Simulator */
.sap-gui-window {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #94a3b8;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin-bottom: 30px;
}

.sap-gui-titlebar {
  background: var(--sap-gui-header);
  color: #ffffff;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
}

.sap-gui-ribbon {
  background: var(--sap-gui-ribbon);
  border-bottom: 1px solid #cbd5e1;
  padding: 6px 16px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.gui-action-btn {
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.gui-action-btn:hover {
  background: #e2e8f0;
}

.gui-action-btn.primary {
  background: #0070f2;
  color: #fff;
  border-color: #005ac2;
}

.gui-action-btn.primary:hover {
  background: #005ac2;
}

.sap-gui-body {
  padding: 24px;
  background: #f8fafc;
}

.gui-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.gui-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gui-field-group label {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.gui-field-group input, .gui-field-group select {
  padding: 8px 12px;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--font-mono);
  background: #ffffff;
}

.gui-field-group input:focus, .gui-field-group select:focus {
  outline: none;
  border-color: #0070f2;
  box-shadow: 0 0 0 2px rgba(0, 112, 242, 0.2);
}

.gui-status-bar {
  background: #e2e8f0;
  border-top: 1px solid #cbd5e1;
  padding: 8px 16px;
  font-size: 12px;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gui-status-icon {
  color: #10b981;
  font-size: 14px;
}

/* Practice Quiz & Flashcards */
.quiz-container {
  background: var(--sap-surface);
  border: 1px solid var(--sap-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  margin-bottom: 30px;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--sap-border);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.quiz-progress-bar {
  height: 6px;
  background: var(--sap-border);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--sap-primary);
  width: 0%;
  transition: width 0.3s;
}

.question-text {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.5;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.option-item {
  background: var(--sap-surface-elevated);
  border: 1px solid var(--sap-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.option-item:hover {
  border-color: var(--sap-primary);
  background: rgba(0, 112, 242, 0.05);
}

.option-item.correct {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--sap-success);
  color: var(--sap-success);
  font-weight: 700;
}

.option-item.wrong {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--sap-danger);
  color: var(--sap-danger);
}

.explanation-card {
  background: var(--sap-surface-elevated);
  border-left: 4px solid var(--sap-primary);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 20px;
  display: none;
}

.explanation-card.show {
  display: block;
  animation: fadeIn 0.2s ease-in;
}

.flashcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.flashcard-card {
  perspective: 1000px;
  height: 220px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flashcard-card.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--sap-border);
}

.flashcard-front {
  background: var(--sap-surface);
  color: var(--sap-text);
}

.flashcard-back {
  background: #1e293b;
  color: #f1f5f9;
  transform: rotateY(180deg);
  border-color: var(--sap-primary);
}

.footer-section {
  text-align: center;
  padding: 30px;
  color: var(--sap-text-muted);
  font-size: 13px;
  border-top: 1px solid var(--sap-border);
  margin-top: 40px;
}
