/* ============================================================
   IAM Schulung - One Identity Manager Homelab
   Stylesheet
   ============================================================ */

:root {
  --primary: #1a3a5c;
  --primary-light: #2563a8;
  --accent: #e8720c;
  --accent-light: #f59e42;
  --success: #16a34a;
  --warning: #ca8a04;
  --danger: #dc2626;
  --bg: #f0f4f8;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #cbd5e1;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --sidebar-width: 280px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}

/* ---- HEADER ---- */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  max-width: 1400px;
  margin: 0 auto;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-brand .logo-icon {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}

.header-brand h1 {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
}

.header-brand p {
  font-size: 0.78rem;
  opacity: 0.8;
}

.header-nav {
  display: flex;
  gap: 8px;
}

.header-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.88rem;
  transition: background 0.2s, color 0.2s;
}

.header-nav a:hover, .header-nav a.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

/* ---- LAYOUT ---- */
.layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 73px);
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: sticky;
  top: 73px;
  height: calc(100vh - 73px);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 20px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.sidebar-link:hover {
  background: var(--bg);
  border-left-color: var(--primary-light);
  color: var(--primary-light);
}

.sidebar-link.active {
  background: #eff6ff;
  border-left-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-link .icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  font-size: 0.7rem;
  background: var(--accent);
  color: #fff;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}

/* ---- MAIN CONTENT ---- */
.main {
  flex: 1;
  padding: 32px 40px;
  min-width: 0;
}

/* ---- PAGE SECTIONS ---- */
.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -20px;
  width: 250px; height: 250px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.hero h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 12px;
  position: relative;
}

.hero p {
  font-size: 1.05rem;
  opacity: 0.9;
  max-width: 700px;
  position: relative;
}

.hero-meta {
  display: flex;
  gap: 24px;
  margin-top: 24px;
  position: relative;
}

.hero-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* ---- CARDS ---- */
.card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 18px 0 8px;
}

.card p { margin-bottom: 12px; color: var(--text); }
.card p:last-child { margin-bottom: 0; }

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

/* ---- STEP CARDS ---- */
.step-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 24px;
  position: relative;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s;
}

.step-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.step-number {
  position: absolute;
  top: -14px;
  left: 24px;
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.step-card h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
  margin-top: 8px;
}

/* ---- DOWNLOAD CARDS ---- */
.download-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 2px solid var(--border);
  padding: 24px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.download-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 4px 16px rgba(37,99,168,0.12);
}

.download-card .dc-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.download-card h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.download-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.download-card .tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.tag-free { background: #dcfce7; color: #15803d; }
.tag-trial { background: #fef9c3; color: #854d0e; }
.tag-required { background: #fee2e2; color: #991b1b; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

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

.btn-accent:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

/* ---- CODE BLOCKS ---- */
.code-block {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 10px;
  padding: 20px 24px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  overflow-x: auto;
  margin: 16px 0;
  position: relative;
}

.code-block .code-label {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 0.7rem;
  color: #94a3b8;
  font-family: sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-block .kw { color: #93c5fd; }
.code-block .str { color: #86efac; }
.code-block .cm { color: #64748b; }
.code-block .num { color: #fca5a5; }

/* ---- ALERTS / CALLOUTS ---- */
.callout {
  border-radius: 10px;
  padding: 16px 20px;
  margin: 16px 0;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.callout-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.callout-body h5 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.callout-body p {
  font-size: 0.88rem;
  margin: 0;
}

.callout-info { background: #eff6ff; border-left: 4px solid #3b82f6; }
.callout-info .callout-icon { color: #3b82f6; }
.callout-info .callout-body h5 { color: #1d4ed8; }

.callout-warning { background: #fffbeb; border-left: 4px solid #f59e0b; }
.callout-warning .callout-icon { color: #f59e0b; }
.callout-warning .callout-body h5 { color: #92400e; }

.callout-success { background: #f0fdf4; border-left: 4px solid #22c55e; }
.callout-success .callout-icon { color: #22c55e; }
.callout-success .callout-body h5 { color: #15803d; }

.callout-danger { background: #fef2f2; border-left: 4px solid #ef4444; }
.callout-danger .callout-icon { color: #ef4444; }
.callout-danger .callout-body h5 { color: #991b1b; }

/* ---- TABLES ---- */
.info-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.9rem;
}

.info-table th {
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}

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

.info-table tr:nth-child(even) td {
  background: var(--bg);
}

.info-table tr:hover td {
  background: #eff6ff;
}

/* ---- PROGRESS / TIMELINE ---- */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 28px;
}

.timeline-dot {
  position: absolute;
  left: -26px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-dot.done { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-dot.active { background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.timeline-content h5 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.timeline-content p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ---- QUIZ ---- */
.quiz-container {
  background: var(--bg-card);
  border-radius: 12px;
  border: 2px solid var(--primary);
  padding: 28px;
  margin-top: 24px;
}

.quiz-container h3 {
  color: var(--primary);
  font-size: 1.2rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-question {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.quiz-question:last-of-type {
  border-bottom: none;
}

.quiz-question p {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.92rem;
}

.quiz-option:hover {
  border-color: var(--primary-light);
  background: #eff6ff;
}

.quiz-option input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.quiz-option.correct {
  border-color: var(--success);
  background: #f0fdf4;
  color: var(--success);
}

.quiz-option.wrong {
  border-color: var(--danger);
  background: #fef2f2;
  color: var(--danger);
}

.quiz-result {
  display: none;
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
}

.quiz-result.show { display: block; }
.quiz-result.pass { background: #f0fdf4; color: var(--success); border: 2px solid var(--success); }
.quiz-result.fail { background: #fef2f2; color: var(--danger); border: 2px solid var(--danger); }

/* ---- EXERCISE BLOCKS ---- */
.exercise-block {
  background: linear-gradient(135deg, #fef9c3 0%, #fef3c7 100%);
  border: 2px solid #f59e0b;
  border-radius: 12px;
  padding: 24px;
  margin: 20px 0;
}

.exercise-block h4 {
  color: #92400e;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.exercise-block ol, .exercise-block ul {
  padding-left: 20px;
  color: var(--text);
}

.exercise-block li {
  margin-bottom: 8px;
  font-size: 0.92rem;
}

/* ---- CHECKLIST ---- */
.checklist {
  list-style: none;
  padding: 0;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border);
}

.checklist li:last-child { border-bottom: none; }

.checklist li::before {
  content: '☐';
  font-size: 1.1rem;
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 1px;
}

.checklist li.done::before {
  content: '☑';
  color: var(--success);
}

/* ---- CHAPTER HEADER ---- */
.chapter-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.chapter-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.chapter-meta h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.chapter-meta p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 4px;
}

/* ---- PROGRESS BAR ---- */
.progress-bar-wrap {
  background: var(--border);
  border-radius: 100px;
  height: 8px;
  margin: 8px 0;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  transition: width 0.5s ease;
}

/* ---- BADGE ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* ---- FOOTER ---- */
footer {
  background: var(--primary);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 20px;
  font-size: 0.82rem;
  margin-top: 40px;
}

footer a { color: rgba(255,255,255,0.9); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { padding: 20px 16px; }
  .hero { padding: 28px 20px; }
  .hero h2 { font-size: 1.4rem; }
  .card-grid { grid-template-columns: 1fr; }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- UTILITY ---- */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.flex { display: flex; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
