/*
 * dojoJavaTemplateStyles.css
 * APCS Java Dojo — Utilities Section: Code Templates
 * Color identity: Java Blue #5eb3d6 (matches Dojo theme)
 * Hero: Dynamic workspace with AI robot (Sonny from I, Robot) crafting code templates
 * Purpose: Lightweight, focused styles for copy-paste templates with zero friction
 * Created: 2026-11-18
 */

:root {
    --dojo:        #5eb3d6;
    --dojo-mid:    #3a8fb5;
    --dojo-dark:   #1a5c8a;
    --dojo-dim:    rgba(94, 179, 214, 0.18);
    --dojo-bg:     #030c16;
    --code-bg:     #0d1117;
    --code-color:  #7ee8ff;
    --comment:     rgba(255,255,255,0.40);
    --text-light:  rgba(255,255,255,0.90);
    --text-muted:  rgba(255,255,255,0.60);
    
    /* Mystic Shield Java color palette - vintage banded style */
    --java-row-a: #f4f9ff;
    --java-row-b: #b8d5f0;
    --java-num: #003d80;
    --java-text: #001020;
    --java-kw: #000099;
    --java-cmt: #005540;
    --java-str: #990000;
    --java-num-lit: #660099;
}

/* ════════════════════════════════════════════════════════════════════════════
   BACK BAR NAVIGATION
   ════════════════════════════════════════════════════════════════════════════ */

#templatesBackBar {
    background: #030c16;
    padding: 0.55rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 2px solid var(--dojo);
    font-size: 0.88rem;
}

#templatesBackBar .back-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
}

#templatesBackBar a {
    color: var(--dojo);
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s;
}

#templatesBackBar a:hover {
    color: #fff;
}

#templatesBackBar .back-label {
    color: rgba(255, 255, 255, 0.28);
    font-size: 0.80rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   GENERAL LAYOUT & TYPOGRAPHY
   ════════════════════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--dojo-bg);
    color: var(--text-light);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    line-height: 1.6;
}

a {
    color: var(--dojo);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #fff;
    text-decoration: underline;
}

/* ════════════════════════════════════════════════════════════════════════════
   HERO SECTION with Background Image
   ════════════════════════════════════════════════════════════════════════════ */

#templatesHero {
    min-height: 50vh;
    background:
        linear-gradient(135deg, rgba(5,15,30,0.38) 0%, rgba(10,45,80,0.25) 100%),
        url('../images/javaTemplateImage.jpg') center / cover no-repeat;
    background-color: var(--dojo-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem 3rem;
    position: relative;
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 12, 22, 0.35);
    pointer-events: none;
}

.hero-content {
    max-width: 760px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-label {
    font-size: 0.75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.50);
    margin-bottom: 0.6rem;
    display: block;
}

.hero-title {
    font-family: 'Boogaloo', cursive;
    font-size: clamp(2.2rem, 6vw, 3.6rem);
    line-height: 1.1;
    margin-bottom: 1rem;
    color: #fff;
    font-weight: 700;
}

.hero-tagline {
    font-size: clamp(0.95rem, 2.2vw, 1.1rem);
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-inspiration {
    display: inline-flex;
    align-items: center;
    padding: 0.6rem 1.4rem;
    background: var(--dojo);
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, transform 0.15s;
}

.btn-inspiration:hover {
    background: #3a8fb5;
    transform: translateY(-2px);
    text-decoration: none;
    color: #fff;
}

.hero-cta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.btn-templates-primary,
.btn-templates-secondary {
    display: inline-flex;
    align-items: center;
    padding: 0.65rem 1.4rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, transform 0.15s, border-color 0.2s;
    text-decoration: none;
}

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

.btn-templates-primary:hover {
    background: #3a8fb5;
    transform: translateY(-2px);
    text-decoration: none;
    color: #fff;
}

.btn-templates-secondary {
    background: rgba(94, 179, 214, 0.15);
    color: var(--text-light);
    border: 1.5px solid var(--dojo-dim);
}

.btn-templates-secondary:hover {
    background: rgba(94, 179, 214, 0.25);
    border-color: var(--dojo);
    transform: translateY(-2px);
    text-decoration: none;
    color: #fff;
}

/* ════════════════════════════════════════════════════════════════════════════
   MAIN CONTENT SECTION
   ════════════════════════════════════════════════════════════════════════════ */

#templatesMain {
    background: #fff;
    padding: 3rem 0;
    color: #2a2a3a;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   INTRODUCTION BOX
   ════════════════════════════════════════════════════════════════════════════ */

.intro-box {
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 2rem 1.75rem;
    margin-bottom: 2.5rem;
}

.intro-box h2 {
    font-family: 'Boogaloo', cursive;
    font-size: 1.75rem;
    color: var(--dojo-dark);
    margin-bottom: 0.75rem;
}

.intro-box p {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.75;
    margin-bottom: 1.5rem;
}

.quick-tips {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.tip {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.tip i {
    color: var(--dojo);
    flex-shrink: 0;
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
}

.tip strong {
    color: var(--dojo-dark);
    display: block;
    margin-bottom: 0.3rem;
}

.tip code {
    background: rgba(94, 179, 214, 0.08);
    color: var(--dojo-dark);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.8rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   TEMPLATE CARD (Code Container)
   ════════════════════════════════════════════════════════════════════════════ */

.template-card {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.template-card:hover {
    box-shadow: 0 4px 12px rgba(94, 179, 214, 0.15);
    border-color: var(--dojo);
}

/* Terminal Header (file, copy button, language tag) */

.code-terminal-header {
    background: #001428;
    border-bottom: 2px solid #3380cc;
    padding: 0.75rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.terminal-dots {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.td {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.td-red    { background: #ff5f56; }
.td-yellow { background: #ffbd2e; }
.td-green  { background: #27c93f; }

.terminal-filename {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.85rem;
    color: #64b5f6;
    font-weight: 600;
    white-space: nowrap;
}

.terminal-tag {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.70);
    white-space: nowrap;
}

.copy-btn {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 1rem;
    background: rgba(94, 179, 214, 0.12);
    border: 1px solid rgba(94, 179, 214, 0.40);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--dojo);
    cursor: pointer;
    transition: background 0.18s, color 0.18s, transform 0.1s;
    white-space: nowrap;
}

.copy-btn:hover {
    background: rgba(94, 179, 214, 0.25);
    color: #fff;
}

.copy-btn:active {
    transform: scale(0.98);
}

.copy-btn-label {
    white-space: nowrap;
}

/* Code Display Area - Vintage Banded Java Look (Mystic Shield style) */

.code-paper {
    background: var(--java-row-a);
    overflow-x: auto;
    counter-reset: code-line;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.83rem;
    line-height: 1.65;
    padding: 0.6rem 0;
}

.code-paper ol {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: code-line;
}

.code-paper li {
    padding: 1px 0;
    white-space: pre;
    display: flex;
    counter-increment: code-line;
    color: var(--java-text);
}

.code-paper li:nth-child(odd)  { background: var(--java-row-a); }
.code-paper li:nth-child(even) { background: var(--java-row-b); }

.code-paper li::before {
    content: counter(code-line);
    display: inline-block;
    min-width: 36px;
    padding: 0 12px 0 10px;
    color: var(--java-num);
    user-select: none;
    text-align: right;
    border-right: 1px solid rgba(51, 128, 204, 0.18);
    margin-right: 12px;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.code-paper code {
    white-space: pre;
    color: var(--java-text);
    flex: 1;
}

.code-paper .kw { color: var(--java-kw); font-weight: 700; }
.code-paper .cm { color: var(--java-cmt); font-style: italic; }
.code-paper .st { color: var(--java-str); }
.code-paper .nm { color: var(--java-num-lit); }

/* Attribute Strip (Difficulty, Category, etc.) */

.attr-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.2rem;
    background: #001428;
    border-top: 1px solid rgba(51, 128, 204, 0.40);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
}

.attr-label {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

.attr-value {
    color: #64b5f6;
    font-weight: 700;
}

/* Template Notes Section */

.template-notes {
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    padding: 1.25rem 1.2rem;
    font-size: 0.85rem;
    color: #555;
}

.template-notes strong {
    color: var(--dojo-dark);
    display: block;
    margin-bottom: 0.5rem;
}

.template-notes ul {
    margin: 0;
    padding-left: 1.25rem;
}

.template-notes li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
}

.template-notes code {
    background: rgba(94, 179, 214, 0.08);
    color: var(--dojo-dark);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.8rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   HOW TO USE BOX
   ════════════════════════════════════════════════════════════════════════════ */

.how-to-box {
    background: rgba(94, 179, 214, 0.08);
    border: 1.5px solid var(--dojo-dim);
    border-radius: 10px;
    padding: 2rem 1.75rem;
    margin: 3rem 0 2.5rem;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.5rem;
    align-items: start;
}

.how-to-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.how-to-content h3 {
    font-family: 'Boogaloo', cursive;
    font-size: 1.3rem;
    color: var(--dojo-dark);
    margin: 0 0 0.75rem 0;
}

.how-to-content ol {
    margin: 0;
    padding-left: 1.5rem;
    color: #2a2a3a;
}

.how-to-content li {
    margin-bottom: 0.5rem;
    line-height: 1.65;
}

.how-to-content strong {
    color: var(--dojo-dark);
}

.how-to-content code {
    background: rgba(94, 179, 214, 0.12);
    color: var(--dojo-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.85rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   BACK SECTION
   ════════════════════════════════════════════════════════════════════════════ */

.back-section {
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid #e5e7eb;
    margin-top: 2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.2rem;
    background: #f0f1f3;
    color: var(--dojo-dark);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}

.back-link:hover {
    background: var(--dojo);
    color: #fff;
    text-decoration: none;
}

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    #templatesBackBar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #templatesBackBar .back-links {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }
    .hero-title {
        font-size: 2rem;
    }
    
    .code-terminal-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .copy-btn {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .terminal-tag {
        display: none;
    }
    
    .how-to-box {
        grid-template-columns: 1fr;
    }
    
    .how-to-icon {
        font-size: 2rem;
    }
    
    .intro-box {
        padding: 1.5rem 1.25rem;
    }
    
    .quick-tips {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-tagline {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }
    
    .template-card {
        margin-bottom: 1.75rem;
    }
    
    .attr-strip {
        font-size: 0.7rem;
        padding: 0.6rem 0.8rem;
    }
    
    .template-notes {
        padding: 1rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .how-to-box {
        padding: 1.5rem 1rem;
        gap: 1rem;
    }
}

/* ════════════════════════════════════════════════════════════════════════════
   PRINT STYLES (For students who want to print templates)
   ════════════════════════════════════════════════════════════════════════════ */

@media print {
    #templatesHero {
        min-height: auto;
        padding: 2rem 1rem;
        background: none;
    }
    
    #templatesMain {
        background: #fff;
    }
    
    .hero-cta,
    .back-section,
    .how-to-box {
        display: none;
    }
    
    .template-card {
        page-break-inside: avoid;
        box-shadow: none;
        border-color: #ccc;
    }
}
