/* ========================================
   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.15);
    --radius-md: 8px;
    --radius-base: 10px;
    --radius-lg: 15px;
    --radius-xl: 20px;
    --transition-base: 0.3s ease;
    --header-height: 60px;
    --container-max-width: 1200px;

    /* Deploy model colors */
    --color-distributed: #3B82F6;
    --color-distributed-bg: #EFF6FF;
    --color-distributed-border: #93C5FD;
    --color-centralized: #8B5CF6;
    --color-centralized-bg: #F5F3FF;
    --color-centralized-border: #C4B5FD;
    --color-combined: #059669;
    --color-combined-bg: #ECFDF5;
    --color-combined-border: #6EE7B7;
}

/* ========================================
   Reset & Base
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #9333EA 50%, #0369A1 75%, #00f2fe 100%);
    padding: 20px;
    padding-top: 80px;
    line-height: 1.8;
    color: var(--color-text-primary);
    font-size: 20px;
}

/* ========================================
   Fixed Header & Progress Bar
   ======================================== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, var(--color-aws-dark), #37475a);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1002;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.site-header h1 {
    color: var(--color-text-white);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.site-header h1 .accent {
    color: var(--color-aws-orange-original);
}

.progress-bar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-aws-orange-original), #f97316, #ef4444);
    z-index: 1001;
    transition: width 0.1s linear;
}

/* ========================================
   Main Container
   ======================================== */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
}

.content-section {
    background: var(--color-bg-white);
    border-radius: var(--radius-xl);
    padding: 50px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

/* ========================================
   Table of Contents
   ======================================== */
.toc-section {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 2px solid #93C5FD;
}

.toc-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-aws-dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toc-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.toc-list li a {
    display: block;
    padding: 12px 18px;
    background: var(--color-bg-white);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    text-decoration: none;
    font-size: 20px;
    font-weight: 500;
    transition: var(--transition-base);
    border-left: 4px solid transparent;
}

.toc-list li a:hover {
    border-left-color: var(--color-aws-orange-original);
    background: #fff7ed;
    transform: translateX(4px);
}

/* ========================================
   Section Headings
   ======================================== */
.section-heading {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-aws-dark);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--color-aws-orange-original);
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-subheading {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 30px 0 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========================================
   Key Takeaways (Conclusion First)
   ======================================== */
.key-takeaways {
    background: linear-gradient(135deg, #fef3c7, #fffbeb);
    border: 2px solid #fbbf24;
    border-radius: var(--radius-lg);
    padding: 35px;
    margin-bottom: 30px;
}

.key-takeaways h2 {
    font-size: 24px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.takeaway-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.takeaway-item {
    background: var(--color-bg-white);
    border-radius: var(--radius-md);
    padding: 20px;
    border-left: 5px solid #f59e0b;
    font-size: 20px;
    line-height: 1.6;
}

.takeaway-item strong {
    color: #92400e;
}

/* ========================================
   Analogy Section
   ======================================== */
.analogy-box {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 2px solid #6ee7b7;
    border-radius: var(--radius-lg);
    padding: 35px;
    margin: 25px 0;
}

.analogy-box h3 {
    font-size: 24px;
    font-weight: 700;
    color: #065f46;
    margin-bottom: 15px;
}

.analogy-mapping {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 20px;
}

.analogy-mapping th {
    background: #065f46;
    color: white;
    padding: 14px 20px;
    text-align: left;
    font-weight: 600;
}

.analogy-mapping td {
    padding: 14px 20px;
    border-bottom: 1px solid #d1fae5;
}

.analogy-mapping tr:nth-child(even) td {
    background: rgba(255,255,255,0.5);
}

/* ========================================
   Deploy Model Cards
   ======================================== */
.model-card {
    border-radius: var(--radius-xl);
    padding: 40px;
    margin: 30px 0;
    border: 2px solid;
}

.model-card.distributed {
    background: var(--color-distributed-bg);
    border-color: var(--color-distributed-border);
}

.model-card.centralized {
    background: var(--color-centralized-bg);
    border-color: var(--color-centralized-border);
}

.model-card.combined {
    background: var(--color-combined-bg);
    border-color: var(--color-combined-border);
}

.model-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.model-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 26px;
    font-weight: 700;
    color: white;
}

.model-badge.dist { background: var(--color-distributed); }
.model-badge.cent { background: var(--color-centralized); }
.model-badge.comb { background: var(--color-combined); }

.model-title {
    font-size: 26px;
    font-weight: 700;
}

.model-title.dist { color: #1e40af; }
.model-title.cent { color: #5b21b6; }
.model-title.comb { color: #065f46; }

.model-subtitle {
    font-size: 20px;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

.model-description {
    font-size: 20px;
    line-height: 1.8;
    margin-bottom: 25px;
    background: var(--color-bg-white);
    padding: 20px;
    border-radius: var(--radius-md);
}

.model-analogy {
    background: rgba(255,255,255,0.7);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 25px;
    border-left: 5px solid;
    font-size: 20px;
}

.model-analogy.dist { border-left-color: var(--color-distributed); }
.model-analogy.cent { border-left-color: var(--color-centralized); }
.model-analogy.comb { border-left-color: var(--color-combined); }

/* Pros / Cons Grid */
.pros-cons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.pros-box, .cons-box {
    background: var(--color-bg-white);
    border-radius: var(--radius-md);
    padding: 20px;
}

.pros-box {
    border-left: 5px solid var(--color-success);
}

.cons-box {
    border-left: 5px solid var(--color-error);
}

.pros-box h4, .cons-box h4 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
}

.pros-box h4 { color: #065f46; }
.cons-box h4 { color: #991b1b; }

.pros-box ul, .cons-box ul {
    list-style: none;
    padding: 0;
}

.pros-box li, .cons-box li {
    font-size: 20px;
    padding: 8px 0;
    padding-left: 28px;
    position: relative;
    line-height: 1.6;
}

.pros-box li::before {
    content: '\2705';
    position: absolute;
    left: 0;
}

.cons-box li::before {
    content: '\26A0\FE0F';
    position: absolute;
    left: 0;
}

/* Use Case */
.use-case-box {
    background: var(--color-bg-white);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 20px;
    border: 1px dashed var(--color-border);
}

.use-case-box h4 {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-aws-dark);
    margin-bottom: 10px;
}

/* ========================================
   Comparison Table
   ======================================== */
.comparison-table-wrapper {
    overflow-x: auto;
    margin: 25px 0;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 20px;
}

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

.comparison-table th.dist-col { background: #1e40af; }
.comparison-table th.cent-col { background: #5b21b6; }
.comparison-table th.comb-col { background: #065f46; }

.comparison-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border-light);
    text-align: center;
    font-size: 20px;
}

.comparison-table td:first-child {
    text-align: left;
    font-weight: 600;
    background: var(--color-bg-light);
    min-width: 160px;
}

.comparison-table tr:hover td {
    background: #fefce8;
}

.comparison-table tr:hover td:first-child {
    background: #fef9c3;
}

/* ========================================
   Best Practices vs Anti-patterns
   ======================================== */
.practices-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin: 25px 0;
}

.practice-card {
    border-radius: var(--radius-lg);
    padding: 30px;
}

.practice-card.best {
    background: #ecfdf5;
    border: 2px solid #6ee7b7;
}

.practice-card.anti {
    background: #fef2f2;
    border: 2px solid #fca5a5;
}

.practice-card h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
}

.practice-card.best h3 { color: #065f46; }
.practice-card.anti h3 { color: #991b1b; }

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

.practice-card li {
    font-size: 20px;
    padding: 10px 0;
    padding-left: 30px;
    position: relative;
    line-height: 1.6;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.practice-card.best li::before {
    content: '\2B55';
    position: absolute;
    left: 0;
}

.practice-card.anti li::before {
    content: '\274C';
    position: absolute;
    left: 0;
}

/* ========================================
   Exam Tips
   ======================================== */
.exam-tips {
    background: linear-gradient(135deg, #fef3c7, #fffbeb);
    border: 2px solid #fbbf24;
    border-radius: var(--radius-lg);
    padding: 35px;
    margin: 25px 0;
}

.exam-tips h3 {
    font-size: 24px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 20px;
}

.exam-tip-item {
    background: var(--color-bg-white);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 15px;
    border-left: 5px solid #f59e0b;
    font-size: 20px;
    line-height: 1.6;
}

.exam-tip-item strong {
    color: #92400e;
}

/* ========================================
   FAQ Accordion
   ======================================== */
.faq-item {
    background: var(--color-bg-white);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
}

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

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

.faq-question .toggle-icon {
    font-size: 24px;
    transition: transform var(--transition-base);
    color: var(--color-aws-orange);
}

.faq-question.active .toggle-icon {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 25px;
    font-size: 20px;
    line-height: 1.8;
}

.faq-answer.open {
    max-height: 600px;
    padding: 0 25px 20px;
}

/* ========================================
   Code Tabs
   ======================================== */
.code-tabs {
    margin: 25px 0;
}

.tab-buttons {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border-light);
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: var(--color-bg-light);
    cursor: pointer;
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text-secondary);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    transition: var(--transition-base);
    font-family: inherit;
}

.tab-btn.active {
    background: var(--color-aws-dark);
    color: white;
}

.tab-content {
    display: none;
    background: #1e293b;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 25px;
    overflow-x: auto;
}

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

.tab-content pre {
    margin: 0;
    color: #e2e8f0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 18px;
    line-height: 1.6;
    white-space: pre;
}

/* ========================================
   Troubleshooting
   ======================================== */
.troubleshoot-item {
    background: var(--color-bg-white);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 25px;
    margin-bottom: 15px;
}

.troubleshoot-item h4 {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-error);
    margin-bottom: 10px;
}

.troubleshoot-item .cause {
    font-size: 20px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.troubleshoot-item .solution {
    font-size: 20px;
    color: var(--color-success);
    font-weight: 600;
}

/* ========================================
   Cheat Sheet
   ======================================== */
.cheatsheet {
    background: linear-gradient(135deg, var(--color-aws-dark), #37475a);
    color: white;
    border-radius: var(--radius-xl);
    padding: 40px;
}

.cheatsheet h2 {
    color: var(--color-aws-orange-original);
    font-size: 28px;
    margin-bottom: 25px;
}

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

.cheatsheet-card {
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    padding: 25px;
    border-top: 4px solid;
}

.cheatsheet-card.dist-card { border-top-color: #60a5fa; }
.cheatsheet-card.cent-card { border-top-color: #a78bfa; }
.cheatsheet-card.comb-card { border-top-color: #34d399; }

.cheatsheet-card h4 {
    font-size: 22px;
    color: var(--color-aws-orange-original);
    margin-bottom: 12px;
}

.cheatsheet-card p {
    font-size: 20px;
    line-height: 1.6;
    color: #cbd5e1;
}

/* ========================================
   SVG Diagram Container
   ======================================== */
.svg-container {
    margin: 25px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

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

/* ========================================
   Decision Flowchart
   ======================================== */
.decision-box {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 2px solid #93c5fd;
    border-radius: var(--radius-lg);
    padding: 35px;
    margin: 25px 0;
}

/* ========================================
   Glossary
   ======================================== */
.glossary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.glossary-item {
    background: var(--color-bg-light);
    border-radius: var(--radius-md);
    padding: 20px;
}

.glossary-item dt {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-aws-dark);
    margin-bottom: 5px;
}

.glossary-item dd {
    font-size: 20px;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* ========================================
   Scroll to Top
   ======================================== */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--color-aws-orange-original);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    transition: var(--transition-base);
}

.scroll-top-btn:hover {
    background: var(--color-aws-orange-hover);
    transform: translateY(-3px);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    body { padding: 10px; padding-top: 70px; }
    .content-section { padding: 25px; }
    .toc-list { grid-template-columns: 1fr; }
    .takeaway-grid { grid-template-columns: 1fr; }
    .pros-cons-grid { grid-template-columns: 1fr; }
    .practices-grid { grid-template-columns: 1fr; }
    .cheatsheet-grid { grid-template-columns: 1fr; }
    .glossary-grid { grid-template-columns: 1fr; }
    .comparison-table { font-size: 16px; }
}
