/* =====================================================================
   AFF Education — Curso de Java para Iniciantes
   Tema: AZUL-MARINHO, design arrojado
   ===================================================================== */

:root {
    --navy-900: #0a1f44;
    --navy-800: #0f2a5c;
    --navy-700: #143a7a;
    --navy-600: #1b4ba0;
    --navy-500: #2a5fc0;
    --navy-400: #4f7fd6;
    --accent:   #ffb703;
    --accent-d: #e09600;
    --ink:      #1b2a4a;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    font-size: 20px;
    color: #2a2f3a;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background-color: #eef1f7;
    background-image: radial-gradient(circle at 12% 0%, rgba(42,95,192,0.08), transparent 40%),
                      radial-gradient(circle at 100% 0%, rgba(10,31,68,0.10), transparent 35%);
}

/* ============================ CABEÇALHO ============================ */
header {
    padding: 28px 30px;
    background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 55%, var(--navy-600) 100%);
    color: white;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 12px 30px rgba(10, 31, 68, 0.35);
    border: 1px solid rgba(255,255,255,0.06);
    position: relative;
    overflow: hidden;
}

header::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -60px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(255,183,3,0.18), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* Botão de voltar ao site principal (canto superior direito) */
.back-button {
    position: absolute;
    top: 18px;
    right: 18px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--accent);
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.18);
    font-weight: 700;
    box-shadow: 0 6px 14px rgba(10,31,68,0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.back-button svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.back-button span {
    color: var(--accent);
    letter-spacing: 0.2px;
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(10,31,68,0.28);
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

@media (max-width: 640px) {
    .back-button { top: 12px; right: 12px; padding: 8px 12px; }
    .back-button span { display: none; }
}

header h1 {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 1.9em;
    letter-spacing: 0.3px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

header h1 code {
    color: #ffd76b;
    background: rgba(255,255,255,0.08);
}

header p {
    margin: 4px 0 0;
    color: #d6e1f5;
}

/* Marca AFF Education */
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.brand-logo {
    flex: 0 0 auto;
    width: 58px;
    height: 58px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-d) 100%);
    color: var(--navy-900);
    font-weight: 800;
    font-size: 1.25em;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.25);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-size: 1.15em;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.brand-slogan {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ============================ NAVEGAÇÃO ============================ */
nav {
    margin-bottom: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

nav a {
    display: inline-block;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--navy-600), var(--navy-500));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
    box-shadow: 0 4px 10px rgba(20, 58, 122, 0.25);
}

nav a:hover {
    background: linear-gradient(135deg, var(--navy-700), var(--navy-600));
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(20, 58, 122, 0.35);
}

/* ========================= SEÇÕES DE CONTEÚDO ========================= */
.content-section {
    background-color: white;
    border-radius: 14px;
    padding: 26px;
    margin-bottom: 22px;
    box-shadow: 0 6px 18px rgba(10, 31, 68, 0.08);
    border: 1px solid #e3e8f2;
    border-top: 4px solid var(--navy-600);
}

h2 {
    color: var(--navy-700);
    border-bottom: 3px solid var(--navy-500);
    padding-bottom: 10px;
    letter-spacing: 0.2px;
}

h3 { color: var(--navy-600); }

pre {
    background-color: #0f2a5c;
    color: #eaf0fb;
    padding: 18px;
    border-radius: 10px;
    overflow-x: auto;
    border-left: 5px solid var(--accent);
    font-family: 'Courier New', Courier, monospace;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.code-comment {
    color: #ff9eaa;
    font-style: italic;
}

code {
    font-family: Consolas, "courier new";
    color: #c4145c;
    background: #fdeef3;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 102%;
}

.terminal-output {
    background-color: #06122b;
    color: #4ade80;
    padding: 16px;
    border-radius: 10px;
    margin-top: 12px;
    font-family: 'Courier New', Courier, monospace;
    border-left: 5px solid #2a5fc0;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

.terminal-output p { margin: 0; }

.highlight {
    background-color: #fff3bf;
    padding: 2px 6px;
    border-radius: 3px;
}

.highlight::before {
    content: "⚠️ Importante: ";
    font-weight: bold;
}

.content-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(10, 31, 68, 0.15);
}

/* =========================== EXERCÍCIOS =========================== */
.exercise-section {
    background: linear-gradient(135deg, #eef4ff 0%, #e7eefc 100%);
    border-radius: 14px;
    padding: 26px;
    margin-top: 30px;
    border-left: 6px solid var(--navy-600);
    box-shadow: 0 6px 18px rgba(10, 31, 68, 0.08);
}

.exercise-section h2 {
    color: var(--navy-800);
    border-bottom-color: var(--navy-600);
}

.quiz-form { margin-top: 20px; }

.quiz-question {
    margin-bottom: 20px;
    padding: 18px;
    background-color: #ffffff;
    border-radius: 10px;
    border: 1px solid #dbe3f3;
    box-shadow: 0 2px 6px rgba(10,31,68,0.05);
}

.options-list {
    list-style-type: none;
    padding: 0;
}

.options-list li { margin-bottom: 10px; }

.options-list label {
    display: block;
    padding: 12px 14px;
    background-color: #f7f9ff;
    border: 1px solid #d8e0f2;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s;
}

.options-list label:hover {
    background-color: #eaf0ff;
    border-color: var(--navy-500);
    transform: translateX(3px);
}

.submit-btn {
    background: linear-gradient(135deg, var(--navy-700), var(--navy-500));
    color: white;
    border: none;
    padding: 13px 26px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-top: 15px;
    box-shadow: 0 6px 14px rgba(20, 58, 122, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.submit-btn:hover {
    background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(20, 58, 122, 0.4);
}

/* Seção extra de exercícios de aplicação (AFF Education) */
.extra-exercise {
    background: linear-gradient(135deg, #fff8e6 0%, #fff1cc 100%);
    border-radius: 14px;
    padding: 26px;
    margin-top: 26px;
    border-left: 6px solid var(--accent);
    box-shadow: 0 6px 18px rgba(224, 150, 0, 0.12);
}

.extra-exercise h2 {
    color: var(--navy-800);
    border-bottom: 3px solid var(--accent);
}

.extra-exercise .badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--accent-d));
    color: var(--navy-900);
    font-size: 0.55em;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 8px;
    text-transform: uppercase;
}

/* ============================== RODAPÉ ============================== */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 24px;
    background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 100%);
    color: white;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(10, 31, 68, 0.3);
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 6px;
}

.footer-brand .brand-logo {
    width: 42px;
    height: 42px;
    font-size: 1em;
    border-radius: 10px;
}

.footer-brand .brand-name { font-size: 1.05em; }

.footer-slogan {
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 1.5px;
    font-size: 0.85em;
    text-transform: uppercase;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 30px;
}

.navigation-buttons a {
    display: inline-block;
    padding: 11px 20px;
    background: linear-gradient(135deg, var(--navy-600), var(--navy-500));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(20,58,122,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}

.navigation-buttons a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(20,58,122,0.35);
}

/* ============================== TABELAS ============================== */
.table-container { overflow-x: auto; margin: 20px 0; }

table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(10,31,68,0.08);
}

th, td {
    border: 1px solid #d8e0f2;
    padding: 12px;
    text-align: left;
}

th {
    background: linear-gradient(135deg, var(--navy-700), var(--navy-600));
    color: #fff;
    font-weight: bold;
}

tr:nth-child(even) { background-color: #f3f6fd; }
tr:hover { background-color: #e9eefb; }

/* ============================== CAIXAS ============================== */
.error-output {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    font-family: 'Courier New', Courier, monospace;
    border-left: 5px solid #dc3545;
}

.warning-box {
    background-color: #fff3cd;
    color: #856404;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 5px solid #ffc107;
}

.tip-box {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 5px solid #28a745;
}

.good-practice {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 5px solid #28a745;
}

.bad-practice {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 5px solid #dc3545;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.comparison-table th, .comparison-table td {
    border: 1px solid #d8e0f2;
    padding: 12px;
    text-align: left;
}

.comparison-table th {
    background: linear-gradient(135deg, var(--navy-700), var(--navy-600));
    color: #fff;
}

.comparison-table tr:nth-child(even) { background-color: #f3f6fd; }

.comparison-table .bad {
    color: #dc3545;
    background-color: #f8d7da;
    font-weight: bold;
}

.comparison-table .good {
    color: #28a745;
    background-color: #d4edda;
    font-weight: bold;
}

.info-box {
    background-color: #e3f0ff;
    color: #0a2f6b;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 5px solid var(--navy-500);
}

.summary-box {
    background-color: #fafbff;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 5px solid var(--navy-400);
    box-shadow: 0 2px 8px rgba(10, 31, 68, 0.08);
}

.formula-box {
    background-color: #f5f8ff;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #d8e0f2;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Cambria Math', serif;
    font-size: 1.2em;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.grid-item {
    background-color: #f7f9ff;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 4px 12px rgba(10, 31, 68, 0.08);
    border: 1px solid #e3e8f2;
    border-top: 3px solid var(--navy-500);
    transition: transform 0.2s, box-shadow 0.2s;
}

.grid-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(10, 31, 68, 0.14);
}

.grid-item h3 { margin-top: 0; }

.code-error {
    color: #dc3545;
    text-decoration: line-through;
}

.formula {
    font-family: 'Cambria Math', 'Times New Roman', serif;
    font-size: 1.2em;
    text-align: center;
    margin: 20px 0;
    background-color: #f5f8ff;
    padding: 15px;
    border-radius: 8px;
}

.image-container { text-align: center; margin: 20px 0; }

.image-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.image-row img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(10, 31, 68, 0.15);
}

.truth-table { width: auto; margin: 20px auto; }

.truth-table th {
    background: linear-gradient(135deg, var(--navy-700), var(--navy-600));
    color: white;
}

.truth-table td, .truth-table th {
    text-align: center;
    padding: 10px 20px;
}

.method-diagram {
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    padding: 15px;
    border: 2px solid var(--navy-600);
    border-radius: 10px;
    background-color: #f5f8ff;
}

.method-header {
    padding: 10px;
    background: linear-gradient(135deg, var(--navy-700), var(--navy-600));
    color: white;
    border-radius: 6px;
    margin-bottom: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
}

.method-body {
    padding: 10px;
    border: 1px dashed var(--navy-600);
    border-radius: 6px;
    margin-bottom: 10px;
    font-family: 'Courier New', Courier, monospace;
}

.method-return {
    padding: 10px;
    background-color: #e3f0ff;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
}

.flow-diagram {
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    padding: 15px;
    border: 2px solid var(--navy-600);
    border-radius: 10px;
    background-color: #f5f8ff;
    text-align: center;
}

.flow-condition {
    padding: 10px;
    background: linear-gradient(135deg, var(--navy-700), var(--navy-600));
    color: white;
    border-radius: 6px;
    margin-bottom: 10px;
    display: inline-block;
    min-width: 200px;
}

.flow-block {
    padding: 10px;
    border: 1px dashed var(--navy-600);
    border-radius: 6px;
    margin: 10px auto;
    display: inline-block;
    min-width: 200px;
}

.flow-arrow {
    font-size: 24px;
    color: var(--navy-600);
    margin: 5px 0;
}

.solution { display: none; }

.show-solution-btn {
    background: linear-gradient(135deg, var(--navy-600), var(--navy-400));
    color: white;
    border: none;
    padding: 11px 22px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(20,58,122,0.25);
}

.show-solution-btn:hover {
    background: linear-gradient(135deg, var(--navy-700), var(--navy-500));
}

/* ===================== ÍNDICE (index.html) ===================== */
.chapter-list {
    background-color: white;
    border-radius: 14px;
    padding: 26px;
    box-shadow: 0 6px 18px rgba(10, 31, 68, 0.08);
    border: 1px solid #e3e8f2;
}

.chapter-section, .quiz-section { margin-bottom: 30px; }

.chapter-section h2, .quiz-section h2 {
    color: var(--navy-700);
    border-bottom: 3px solid var(--navy-500);
    padding-bottom: 10px;
}

.chapter-links { list-style-type: none; padding: 0; }
.chapter-links li { margin-bottom: 10px; }

.chapter-links a {
    display: block;
    padding: 12px 16px;
    background-color: #f4f7fd;
    color: var(--ink);
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid #e3e8f2;
    border-left: 4px solid var(--navy-500);
    transition: all 0.25s ease;
}

.chapter-links a:hover {
    background-color: #e9eefb;
    transform: translateX(4px);
    box-shadow: 0 4px 10px rgba(10, 31, 68, 0.12);
    border-left-color: var(--accent);
}

.chapter-links a .chapter-number {
    font-weight: bold;
    color: var(--navy-700);
    margin-right: 10px;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.definicao {
    background-color: #eef4ff;
    color: #0a2f6b;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 5px solid var(--navy-600);
    font-size: 1.05em;
    line-height: 1.8;
    box-shadow: 0 2px 8px rgba(10, 31, 68, 0.06);
}

.definicao::before {
    content: "📖 Definição: ";
    font-weight: bold;
    color: var(--navy-600);
}
