/* ========================================
   CSS Variables
   ======================================== */
:root {
  --color-aws-dark: #232F3E;
  --color-aws-orange: #dc7600;
  --color-aws-orange-original: #FF9900;
  --color-aws-orange-hover: #EC7211;
  --color-text-primary: #374151;
  --color-text-secondary: #6B7280;
  --color-text-white: #FFFFFF;
  --color-bg-light: #F9FAFB;
  --color-bg-white: #FFFFFF;
  --color-border: #909296;
  --color-border-light: #E5E7EB;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-info: #3B82F6;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.2);
  --radius-md: 8px;
  --radius-base: 10px;
  --radius-lg: 15px;
  --radius-xl: 20px;
  --transition-base: 0.3s ease;
  --header-height: 60px;
}

/* ========================================
   Container
   ======================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background-color: var(--color-bg-white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
  background: linear-gradient(135deg, #232F3E 0%, #37475A 50%, #485769 100%);
  color: var(--color-text-white);
  padding: 60px 40px;
  border-radius: var(--radius-xl);
  margin-bottom: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,153,0,0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(59,130,246,0.1) 0%, transparent 70%);
  border-radius: 50%;
}

.hero h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.hero .hero-subtitle {
  font-size: 22px;
  opacity: 0.9;
  margin-bottom: 30px;
  position: relative;
  z-index: 1;
}

.hero .hero-analogy {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-lg);
  padding: 20px 30px;
  display: inline-block;
  font-size: 20px;
  position: relative;
  z-index: 1;
}

.hero .hero-analogy .analogy-icon {
  font-size: 32px;
  margin-right: 10px;
}

/* ========================================
   Key Takeaways
   ======================================== */
.key-takeaways {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.takeaway-card {
  background: var(--color-bg-white);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  transition: var(--transition-base);
}

.takeaway-card:hover {
  border-color: var(--color-aws-orange);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.takeaway-card .takeaway-number {
  position: absolute;
  top: -12px;
  left: 20px;
  background: var(--color-aws-orange);
  color: var(--color-text-white);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.takeaway-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--color-aws-dark);
}

.takeaway-card p {
  font-size: 20px;
  color: var(--color-text-secondary);
}

/* ========================================
   Section Headings
   ======================================== */
.section {
  margin-bottom: 50px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--color-aws-orange);
}

.section-header .section-icon {
  font-size: 30px;
}

.section-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-aws-dark);
}

/* ========================================
   Analogy Mapping Table
   ======================================== */
.analogy-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-base);
  overflow: hidden;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
}

.analogy-table thead th {
  background: var(--color-aws-dark);
  color: var(--color-text-white);
  padding: 16px 20px;
  font-size: 20px;
  font-weight: 600;
  text-align: left;
}

.analogy-table tbody td {
  padding: 14px 20px;
  font-size: 20px;
  border-bottom: 1px solid var(--color-border-light);
}

.analogy-table tbody tr:nth-child(even) {
  background: var(--color-bg-light);
}

.analogy-table tbody tr:hover {
  background: #FFF7ED;
}

.analogy-table .emoji-cell {
  font-size: 24px;
  text-align: center;
  width: 50px;
}

/* ========================================
   SVG Diagram Container
   ======================================== */
.svg-container {
  background: var(--color-bg-white);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 30px;
  overflow-x: auto;
}

.svg-container svg {
  display: block;
  margin: 0 auto;
  width: 100%;
  height: auto;
}

.svg-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--color-aws-dark);
  margin-bottom: 16px;
}

/* ========================================
   Feature Cards
   ======================================== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.feature-card {
  background: var(--color-bg-white);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition-base);
}

.feature-card:hover {
  border-color: var(--color-info);
  box-shadow: var(--shadow-md);
}

.feature-card .card-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--color-aws-dark);
}

.feature-card p {
  font-size: 20px;
  color: var(--color-text-secondary);
}

/* ========================================
   Comparison Grid (Best Practices)
   ======================================== */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.comparison-card {
  border-radius: var(--radius-lg);
  padding: 24px;
}

.comparison-card.good {
  background: #ECFDF5;
  border: 2px solid var(--color-success);
}

.comparison-card.bad {
  background: #FEF2F2;
  border: 2px solid var(--color-error);
}

.comparison-card h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comparison-card.good h3 { color: #059669; }
.comparison-card.bad h3 { color: #DC2626; }

.comparison-card ul {
  list-style: none;
  padding: 0;
}

.comparison-card ul li {
  font-size: 20px;
  padding: 8px 0;
  padding-left: 28px;
  position: relative;
}

.comparison-card.good ul li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--color-success);
  font-weight: 700;
}

.comparison-card.bad ul li::before {
  content: '\2717';
  position: absolute;
  left: 0;
  color: var(--color-error);
  font-weight: 700;
}

/* ========================================
   Code Block (Tabbed)
   ======================================== */
.code-tabs {
  margin-bottom: 30px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--color-border-light);
}

.code-tab-buttons {
  display: flex;
  background: var(--color-aws-dark);
}

.code-tab-btn {
  padding: 12px 24px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
  font-family: inherit;
}

.code-tab-btn.active {
  color: var(--color-text-white);
  background: rgba(255,255,255,0.1);
  border-bottom: 3px solid var(--color-aws-orange);
}

.code-tab-btn:hover:not(.active) {
  color: var(--color-text-white);
  background: rgba(255,255,255,0.05);
}

.code-tab-content {
  display: none;
  background: #1a1a2e;
  padding: 24px;
  overflow-x: auto;
}

.code-tab-content.active {
  display: block;
}

.code-tab-content pre {
  margin: 0;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 16px;
  line-height: 1.6;
  color: #e2e8f0;
}

.code-tab-content .keyword { color: #c792ea; }
.code-tab-content .string { color: #c3e88d; }
.code-tab-content .number { color: #f78c6c; }
.code-tab-content .comment { color: #546e7a; }
.code-tab-content .key { color: #89ddff; }
.code-tab-content .bool { color: #ff5370; }

/* ========================================
   Info Boxes
   ======================================== */
.info-box {
  padding: 20px 24px;
  border-radius: var(--radius-base);
  margin-bottom: 24px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.info-box.tip {
  background: #EFF6FF;
  border-left: 4px solid var(--color-info);
}

.info-box.warning {
  background: #FFFBEB;
  border-left: 4px solid var(--color-warning);
}

.info-box.exam {
  background: #F0FDF4;
  border-left: 4px solid var(--color-success);
}

.info-box .box-icon { font-size: 24px; flex-shrink: 0; }
.info-box .box-content { font-size: 20px; }
.info-box .box-content strong { display: block; margin-bottom: 4px; }

/* ========================================
   FAQ Accordion
   ======================================== */
.faq-item {
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-base);
  margin-bottom: 12px;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  background: var(--color-bg-white);
  border: none;
  padding: 18px 24px;
  font-size: 20px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-aws-dark);
  font-family: inherit;
  transition: var(--transition-base);
}

.faq-question:hover {
  background: var(--color-bg-light);
}

.faq-question .arrow {
  transition: transform var(--transition-base);
  font-size: 20px;
}

.faq-question.open .arrow {
  transform: rotate(180deg);
}

.faq-answer {
  display: none;
  padding: 0 24px 18px;
  font-size: 20px;
  color: var(--color-text-secondary);
}

.faq-answer.open {
  display: block;
}

/* ========================================
   Cheat Sheet
   ======================================== */
.cheatsheet {
  background: linear-gradient(135deg, #232F3E, #374151);
  color: var(--color-text-white);
  border-radius: var(--radius-xl);
  padding: 40px;
  margin-bottom: 30px;
}

.cheatsheet h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
}

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

.cheatsheet-item {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-base);
  padding: 20px;
}

.cheatsheet-item h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-aws-orange-original);
}

.cheatsheet-item p {
  font-size: 20px;
  opacity: 0.9;
}

/* ========================================
   Troubleshooting Table
   ======================================== */
.troubleshoot-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-base);
  overflow: hidden;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
}

.troubleshoot-table thead th {
  background: #1E40AF;
  color: var(--color-text-white);
  padding: 14px 18px;
  font-size: 20px;
  font-weight: 600;
  text-align: left;
}

.troubleshoot-table tbody td {
  padding: 14px 18px;
  font-size: 20px;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: top;
}

.troubleshoot-table tbody tr:nth-child(even) {
  background: var(--color-bg-light);
}

/* ========================================
   Step Flow
   ======================================== */
.step-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.step-item {
  background: var(--color-bg-white);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  position: relative;
}

.step-item .step-num {
  background: var(--color-info);
  color: var(--color-text-white);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  margin: 0 auto 12px;
}

.step-item h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--color-aws-dark);
}

.step-item p {
  font-size: 20px;
  color: var(--color-text-secondary);
}

/* ========================================
   TOC Navigation
   ======================================== */
.toc {
  background: var(--color-bg-light);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 40px;
}

.toc h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--color-aws-dark);
}

.toc-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 8px;
}

.toc-list li a {
  font-size: 20px;
  color: var(--color-info);
  text-decoration: none;
  padding: 6px 0;
  display: block;
  transition: var(--transition-base);
}

.toc-list li a:hover {
  color: var(--color-aws-orange);
}

/* ========================================
   Process Flow Cards
   ======================================== */
.logic-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 30px;
}

.logic-card {
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 2px solid;
}

.logic-card.and-card {
  background: #EEF2FF;
  border-color: #818CF8;
}

.logic-card.or-card {
  background: #FFF7ED;
  border-color: #FDBA74;
}

.logic-card h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logic-card .logic-label {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-white);
}

.logic-card.and-card .logic-label { background: #6366F1; }
.logic-card.or-card .logic-label { background: var(--color-aws-orange); }

.logic-card p {
  font-size: 20px;
  margin-bottom: 14px;
}

.logic-example {
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 20px;
}

.logic-example .hotel-analogy {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0,0,0,0.2);
  font-style: italic;
  color: var(--color-text-secondary);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
  .hero { padding: 40px 20px; }
  .hero h1 { font-size: 28px; }
  .comparison-grid,
  .logic-comparison { grid-template-columns: 1fr; }
  .container { padding: 16px; margin: 10px; }
}
