/* ================================================================
   AWS Developer Associate — Domain 4: Troubleshooting & Optimization
   Study Notes Stylesheet
   ================================================================ */

:root {
  --aws-orange: #ff9900;
  --aws-blue: #0073bb;
  --aws-dark: #232f3e;
  --primary: #1a1a2e;
  --secondary: #16213e;
  --accent: #0f3460;
  --success: #27ae60;
  --warning: #e67e22;
  --danger: #e74c3c;
  --info: #2980b9;
  --white: #ffffff;
  --light: #f8f9fa;
  --text: #2c3e50;
  --muted: #7f8c8d;
  --sidebar-width: 272px;
  --card-radius: 10px;
  --card-shadow: 0 3px 14px rgba(0,0,0,0.09);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  background: #eef0f5;
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--primary);
  overflow-y: auto;
  z-index: 200;
  display: flex;
  flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,153,0,0.4); border-radius: 2px; }

.sidebar-brand {
  background: linear-gradient(135deg, var(--aws-dark), var(--accent));
  padding: 18px 16px;
  border-bottom: 2px solid var(--aws-orange);
  flex-shrink: 0;
}
.sidebar-brand .domain-tag {
  background: var(--aws-orange); color: var(--aws-dark);
  font-size: 9px; font-weight: 800; padding: 2px 8px;
  border-radius: 3px; text-transform: uppercase; letter-spacing: 1.2px;
}
.sidebar-brand h2 { color: #fff; font-size: 13.5px; font-weight: 700; margin-top: 8px; line-height: 1.4; }
.sidebar-brand p  { color: rgba(255,255,255,0.5); font-size: 11px; margin-top: 2px; }

.nav-section-label {
  padding: 10px 16px 3px;
  font-size: 9px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 2px; color: var(--aws-orange); opacity: 0.7;
}
.sidebar nav ul { list-style: none; }
.sidebar nav ul li a {
  display: flex; flex-direction: column;
  padding: 7px 16px;
  color: rgba(255,255,255,0.68); text-decoration: none;
  font-size: 12.5px;
  border-left: 3px solid transparent;
  transition: all 0.17s ease;
}
.sidebar nav ul li a .topic-name { font-weight: 500; }
.sidebar nav ul li a .topic-stars { font-size: 9.5px; color: var(--aws-orange); opacity: 0.55; margin-top: 1px; }
.sidebar nav ul li a:hover { background: rgba(255,255,255,0.07); color: #fff; border-left-color: rgba(255,153,0,0.45); }
.sidebar nav ul li a.active { background: rgba(255,153,0,0.13); color: #fff; border-left-color: var(--aws-orange); }
.sidebar nav ul li a.active .topic-stars { opacity: 1; }

.sidebar-quiz-btn { margin: 10px 14px 14px; }
.sidebar-quiz-btn a {
  display: block;
  background: linear-gradient(135deg, var(--aws-orange), #e68900);
  color: var(--aws-dark) !important;
  text-align: center; padding: 10px !important;
  border-radius: 8px; font-weight: 800 !important;
  font-size: 13px !important; border-left: none !important;
  text-decoration: none; letter-spacing: 0.4px;
  transition: all 0.18s;
}
.sidebar-quiz-btn a:hover { background: linear-gradient(135deg, #ffb733, var(--aws-orange)) !important; border-left: none !important; }

/* ===== MAIN CONTENT ===== */
.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(140deg, var(--aws-dark) 0%, var(--accent) 60%, #1a5276 100%);
  padding: 44px 52px 36px; color: white; position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: 60px; top: 50%; transform: translateY(-50%);
  width: 320px; height: 320px; border-radius: 50%;
  background: rgba(255,153,0,0.07); border: 2px solid rgba(255,153,0,0.12);
}
.hero .breadcrumb { font-size: 12px; color: rgba(255,255,255,0.5); margin-bottom: 14px; padding: 0; background: none; border: none; }
.hero .breadcrumb a { color: rgba(255,255,255,0.65); text-decoration: none; }
.hero .breadcrumb a:hover { color: var(--aws-orange); }
.hero .topic-badge {
  display: inline-block;
  background: rgba(255,153,0,0.18); border: 1px solid rgba(255,153,0,0.45);
  color: var(--aws-orange); font-size: 11px; font-weight: 700;
  padding: 4px 12px; border-radius: 20px; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 12px;
}
.hero h1 { font-size: 34px; font-weight: 800; line-height: 1.2; margin-bottom: 12px; position: relative; z-index: 1; }
.hero .hero-desc { font-size: 15px; color: rgba(255,255,255,0.8); max-width: 680px; margin-bottom: 20px; position: relative; z-index: 1; }
.hero .importance-tag {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,153,0,0.18); border: 1px solid rgba(255,153,0,0.4);
  border-radius: 24px; padding: 7px 16px; font-size: 13px; font-weight: 600;
  color: #ffe0a0; position: relative; z-index: 1;
}

/* ===== CONTENT BODY ===== */
.content { padding: 36px 52px 60px; max-width: 1180px; }

/* ===== CARDS ===== */
.card {
  background: var(--white); border-radius: var(--card-radius);
  padding: 30px 34px; margin-bottom: 28px;
  box-shadow: var(--card-shadow); border: 1px solid rgba(0,0,0,0.04);
}
.card > h2 {
  font-size: 22px; color: var(--primary); margin-bottom: 20px;
  padding-bottom: 14px; border-bottom: 2px solid #f0f0f0;
  display: flex; align-items: center; gap: 10px;
}
.card h3 { font-size: 18px; color: var(--accent); margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.card h3:first-child { margin-top: 0; }
.card h4 { font-size: 15px; font-weight: 700; color: var(--text); margin: 18px 0 8px; }
.card p { margin-bottom: 12px; }
.card ul, .card ol { padding-left: 22px; margin-bottom: 14px; }
.card li { margin-bottom: 7px; line-height: 1.75; }
.card strong { color: var(--primary); }
.card a { color: var(--aws-blue); }

/* ===== CALLOUT BOXES ===== */
.callout { border-radius: 8px; padding: 16px 20px; margin: 18px 0; border-left: 5px solid; font-size: 14px; line-height: 1.65; }
.callout-title { font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.callout.exam   { background: #fffbf0; border-color: var(--aws-orange); color: #7a5800; }
.callout.exam   .callout-title { color: #c87000; }
.callout.important { background: #fff5f5; border-color: var(--danger); color: #8b1a1a; }
.callout.important .callout-title { color: var(--danger); }
.callout.tip    { background: #f0fff4; border-color: var(--success); color: #1a5c2a; }
.callout.tip    .callout-title { color: var(--success); }
.callout.info   { background: #f0f7ff; border-color: var(--info); color: #1a3f6b; }
.callout.info   .callout-title { color: var(--info); }
.callout.example { background: #f8f4ff; border-color: #7c4dff; color: #3a1a6b; }
.callout.example .callout-title { color: #7c4dff; }

/* ===== TERM DEFINITIONS ===== */
.term-def {
  background: linear-gradient(135deg, #f0f4ff, #e8efff);
  border: 1px solid #c5d3ff; border-radius: 8px; padding: 13px 18px; margin: 10px 0;
}
.term-def .term-name { font-weight: 800; color: var(--accent); font-size: 15px; }
.term-def .term-meaning { color: var(--text); font-size: 14px; margin-top: 4px; line-height: 1.65; }

/* ===== FLOW DIAGRAMS ===== */
.flow-wrap {
  background: linear-gradient(135deg, #f5f7ff, #eff2fb);
  border: 1px solid #d9e0ff; border-radius: 12px; padding: 26px 22px;
  margin: 22px 0; overflow-x: auto;
}
.flow-wrap .flow-title { text-align: center; font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 20px; }
.flow-row { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.flow-box {
  background: white; border: 2px solid #c0d0ff; border-radius: 8px;
  padding: 10px 18px; text-align: center; font-size: 13px; font-weight: 600;
  color: var(--primary); min-width: 100px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); white-space: nowrap;
}
.flow-box.source   { border-color: var(--aws-orange); background: linear-gradient(135deg, #fff9f0, #fff3e0); }
.flow-box.process  { border-color: var(--aws-blue);   background: linear-gradient(135deg, #f0f7ff, #e3f2fd); }
.flow-box.output   { border-color: var(--success);    background: linear-gradient(135deg, #f0fff4, #e8f5e9); }
.flow-box.dark     { border-color: var(--primary);    background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; }
.flow-box .box-icon  { font-size: 18px; display: block; margin-bottom: 3px; }
.flow-box .box-label { font-size: 11px; opacity: 0.7; margin-top: 2px; font-weight: 400; }
.flow-arrow { color: var(--aws-orange); font-size: 22px; font-weight: 900; line-height: 1; }
.flow-arrow.down { display: block; text-align: center; width: 100%; }

/* ===== ARCHITECTURE DIAGRAM ===== */
.arch-diagram {
  background: linear-gradient(160deg, #1a1a2e 0%, #0f3460 100%);
  border-radius: 14px; padding: 30px 26px; margin: 22px 0;
  position: relative; overflow: hidden;
}
.arch-diagram::before {
  content: 'ARCHITECTURE'; position: absolute; top: 12px; right: 16px;
  font-size: 9px; font-weight: 700; color: rgba(255,153,0,0.35); letter-spacing: 2px;
}
.arch-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.arch-box {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,153,0,0.35);
  border-radius: 10px; padding: 14px 20px; text-align: center; min-width: 110px;
}
.arch-box .arch-icon { font-size: 22px; display: block; margin-bottom: 6px; }
.arch-box .arch-name { font-size: 13px; font-weight: 700; color: var(--aws-orange); }
.arch-box .arch-desc { font-size: 11px; color: rgba(255,255,255,0.55); margin-top: 3px; }
.arch-arrow { color: var(--aws-orange); font-size: 24px; font-weight: 900; }
.arch-label { text-align: center; font-size: 11px; color: rgba(255,255,255,0.38); font-style: italic; width: 100%; margin-top: 6px; }

/* ===== CODE BLOCKS ===== */
.code-block {
  background: #1e1e1e; color: #d4d4d4; border-radius: 10px;
  padding: 22px 26px; font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px; line-height: 1.65; overflow-x: auto; margin: 16px 0; position: relative;
}
.code-block .code-lang { position: absolute; top: 10px; right: 14px; font-size: 10px; color: #555; font-family: sans-serif; text-transform: uppercase; letter-spacing: 1px; }
.code-block .cm { color: #6a9955; }   /* comment */
.code-block .ck { color: #c586c0; }   /* keyword */
.code-block .cs { color: #ce9178; }   /* string  */
.code-block .cf { color: #dcdcaa; }   /* function */
.code-block .cv { color: #9cdcfe; }   /* variable */
.code-block .cn { color: #b5cea8; }   /* number  */
.code-block .cp { color: #569cd6; }   /* property */

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; margin: 16px 0; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.styled-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.styled-table thead tr { background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; }
.styled-table th { padding: 13px 16px; text-align: left; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.styled-table td { padding: 12px 16px; border-bottom: 1px solid #edf2f7; vertical-align: top; line-height: 1.65; }
.styled-table tbody tr:nth-child(even) td { background: #fafbff; }
.styled-table tbody tr:hover td { background: #f0f6ff; }

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 16px 0; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; margin: 16px 0; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; margin: 16px 0; }
.grid-item { background: #f7f9fc; border-radius: 8px; padding: 20px; border: 1px solid #e8ecf0; }
.grid-item.orange { background: linear-gradient(135deg, #fff9f0, #fff3e0); border-color: rgba(255,153,0,0.3); }
.grid-item.blue   { background: linear-gradient(135deg, #f0f7ff, #e3f2fd); border-color: rgba(0,115,187,0.3); }
.grid-item.green  { background: linear-gradient(135deg, #f0fff4, #e8f5e9); border-color: rgba(39,174,96,0.3); }
.grid-item.red    { background: linear-gradient(135deg, #fff5f5, #ffebee); border-color: rgba(231,76,60,0.3); }
.grid-item.purple { background: linear-gradient(135deg, #f8f4ff, #ede0ff); border-color: rgba(124,77,255,0.3); }
.grid-item h4 { font-size: 14px; font-weight: 700; color: var(--primary); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.grid-item p, .grid-item ul { font-size: 13.5px; color: #505060; }
.grid-item ul { padding-left: 18px; }
.grid-item li { margin-bottom: 5px; }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; margin: 2px; vertical-align: middle; }
.badge-orange { background: #fff3cd; color: #7a5800; border: 1px solid rgba(255,153,0,0.4); }
.badge-blue   { background: #d1ecf1; color: #0b4f6c; border: 1px solid rgba(0,115,187,0.4); }
.badge-green  { background: #d4edda; color: #1a5c2a; border: 1px solid rgba(39,174,96,0.4); }
.badge-red    { background: #f8d7da; color: #8b1a1a; border: 1px solid rgba(231,76,60,0.4); }
.badge-purple { background: #ede0ff; color: #4a0e8f; border: 1px solid rgba(124,77,255,0.4); }
.badge-dark   { background: var(--primary); color: white; border: 1px solid var(--secondary); }

/* ===== METRIC CARDS ===== */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin: 18px 0; }
.metric-card { background: white; border-radius: 10px; padding: 18px; border-top: 4px solid var(--aws-orange); box-shadow: 0 2px 10px rgba(0,0,0,0.08); text-align: center; }
.metric-card .metric-icon { font-size: 28px; margin-bottom: 8px; display: block; }
.metric-card .metric-name { font-weight: 800; font-size: 14px; color: var(--primary); }
.metric-card .metric-desc { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.metric-card.blue-top   { border-top-color: var(--aws-blue); }
.metric-card.green-top  { border-top-color: var(--success); }
.metric-card.red-top    { border-top-color: var(--danger); }
.metric-card.purple-top { border-top-color: #7c4dff; }

/* ===== STEPS ===== */
.steps-list { margin: 18px 0; }
.step-item  { display: flex; gap: 18px; margin-bottom: 22px; align-items: flex-start; }
.step-num   { background: linear-gradient(135deg, var(--aws-orange), #e68900); color: white; font-weight: 800; font-size: 15px; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 3px 8px rgba(255,153,0,0.4); }
.step-body h4 { color: var(--primary); margin-bottom: 5px; margin-top: 5px; }
.step-body p  { font-size: 14px; color: #555; }

/* ===== COMPARE GRID ===== */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-radius: 10px; overflow: hidden; margin: 18px 0; box-shadow: var(--card-shadow); }
.compare-col:first-child { background: linear-gradient(160deg, #e3f2fd, #f0f7ff); border-right: 2px solid #fff; padding: 22px; }
.compare-col:last-child  { background: linear-gradient(160deg, #fff9f0, #fff3e0); padding: 22px; }
.compare-col h4 { font-size: 15px; font-weight: 800; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.compare-col ul { padding-left: 18px; }
.compare-col li { font-size: 13.5px; margin-bottom: 7px; }

/* ===== PAGE NAVIGATION ===== */
.page-nav { display: flex; justify-content: space-between; align-items: center; padding: 22px 52px; background: white; border-top: 1px solid #e9ecef; gap: 20px; flex-wrap: wrap; }
.nav-btn { display: flex; align-items: center; gap: 10px; padding: 12px 24px; background: var(--primary); color: white; text-decoration: none; border-radius: 8px; font-size: 14px; font-weight: 600; transition: background 0.2s; }
.nav-btn:hover { background: var(--accent); color: white; }
.nav-btn.next { background: linear-gradient(135deg, var(--aws-orange), #e68900); color: var(--aws-dark); }
.nav-btn.next:hover { background: linear-gradient(135deg, #ffb733, var(--aws-orange)); }

/* ===== HIGHLIGHT BOXES ===== */
.highlight-orange { background: linear-gradient(135deg, #fffbf0, #fff8e7); border: 2px solid var(--aws-orange); border-radius: 10px; padding: 20px 24px; margin: 20px 0; }
.highlight-orange h3 { color: var(--aws-orange); font-size: 17px; margin-bottom: 10px; }
.highlight-blue { background: linear-gradient(135deg, #f0f7ff, #e8f0ff); border: 2px solid var(--aws-blue); border-radius: 10px; padding: 20px 24px; margin: 20px 0; }
.highlight-blue h3 { color: var(--aws-blue); font-size: 17px; margin-bottom: 10px; }

/* ===== QUIZ ===== */
.quiz-section-wrap { background: white; border-radius: 12px; padding: 32px 36px; margin-bottom: 30px; box-shadow: var(--card-shadow); }
.quiz-section-header { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid #f0f0f0; padding-bottom: 16px; margin-bottom: 24px; }
.quiz-section-num { background: linear-gradient(135deg, var(--aws-orange), #e68900); color: white; font-weight: 800; font-size: 14px; padding: 8px 14px; border-radius: 8px; white-space: nowrap; }
.quiz-section-header h2 { font-size: 20px; color: var(--primary); }
.question-card { background: #f9fafc; border-radius: 10px; padding: 22px 24px; margin-bottom: 24px; border-left: 5px solid var(--aws-blue); }
.question-card .q-num { font-size: 11px; font-weight: 800; color: var(--aws-blue); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.question-card .q-text { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 16px; line-height: 1.6; }
.options-list { list-style: none; margin: 0; padding: 0; }
.options-list li { background: white; border: 1px solid #e0e6f0; border-radius: 7px; padding: 11px 16px; margin-bottom: 8px; cursor: pointer; font-size: 14px; transition: all 0.18s; display: flex; align-items: flex-start; gap: 10px; }
.options-list li:hover { background: #e8f0fe; border-color: var(--aws-blue); }
.options-list li.correct { background: #d4edda; border-color: var(--success); color: #155724; }
.options-list li.wrong   { background: #f8d7da; border-color: var(--danger); color: #721c24; }
.option-letter { background: var(--aws-dark); color: white; font-weight: 800; font-size: 12px; width: 24px; height: 24px; border-radius: 4px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.answer-explanation { margin-top: 14px; background: #edf7ed; border: 1px solid #b2dfdb; border-radius: 7px; padding: 13px 16px; font-size: 13.5px; color: #1b5e20; line-height: 1.65; display: none; }
.answer-explanation strong { color: #0a4c0d; }
.show-answer-btn { background: var(--success); color: white; border: none; padding: 7px 18px; border-radius: 6px; font-size: 13px; font-weight: 700; cursor: pointer; margin-top: 12px; letter-spacing: 0.3px; transition: background 0.18s; }
.show-answer-btn:hover { background: #219a52; }

/* ===== TOPIC CARDS on INDEX ===== */
.topic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 22px 0; }
.topic-card { background: white; border-radius: 10px; padding: 20px 22px; border-left: 5px solid var(--aws-orange); box-shadow: var(--card-shadow); text-decoration: none; color: inherit; transition: all 0.2s; display: block; }
.topic-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.14); color: inherit; }
.topic-card.five-star  { border-left-color: var(--aws-orange); }
.topic-card.four-star  { border-left-color: var(--aws-blue); }
.topic-card.three-star { border-left-color: var(--success); }
.topic-card .tc-num   { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px; }
.topic-card .tc-title { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.topic-card .tc-stars { font-size: 13px; margin-bottom: 6px; }
.topic-card .tc-desc  { font-size: 13px; color: #666; line-height: 1.55; }

/* ===== RESPONSIVE ===== */
@media (max-width: 960px) {
  .sidebar { width: 220px; }
  .main-content { margin-left: 220px; }
  .content, .hero, .page-nav { padding-left: 28px; padding-right: 28px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .hero h1 { font-size: 24px; }
  .grid-2, .grid-3, .grid-4, .topic-grid { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .flow-row { flex-direction: column; align-items: center; }
}
@media print {
  .sidebar, .page-nav { display: none; }
  .main-content { margin-left: 0; }
}
