/*
  ╔══════════════════════════════════════════════════════════════════════════╗
  ║                   dojoMathUtilityStyles.css                              ║
  ║            APCS Java Dojo — Math Utilities Page Styling                  ║
  ║                                                                          ║
  ║  Color Theme:  Green Chalkboard (from hero image)                       ║
  ║  Structure:    Back bar → Hero section → Intro → Driver → Utilities     ║
  ║  Component:    Terminal code display, copy buttons, accordion sections   ║
  ║  Responsive:   Mobile-first, tablet & desktop layouts                   ║
  ╚══════════════════════════════════════════════════════════════════════════╝
*/

/* ══════════════════════════════════════════════════════════════════════════
   ROOT / CSS CUSTOM PROPERTIES
   ══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Primary & Accent Colors: Java Blue Theme (Mystic Shield Palette) */
    --dojo:               #5eb3d6;    /* Primary Java Blue */
    --dojo-mid:           #3a8fb5;    /* Mid blue for accents */
    --dojo-dark:          #1a5c8a;    /* Dark blue for text/borders */
    --dojo-dim:           rgba(94, 179, 214, 0.18);  /* Dim blue overlay */
    
    /* Math Utilities Green Theme (from hero chalkboard) */
    --math-primary:       #2d7f3f;    /* Primary green accent (chalkboard) */
    --math-primary-dark:  #1f5c2a;    /* Dark green for hover/active states */
    
    /* Neutral & Structural */
    --dojo-bg:            #ffffff;    /* Page background */
    --dojo-light:         #f8f8f8;    /* Light section bg */
    --dojo-text:          #333333;    /* Text color */
    --dojo-border:        #e0e0e0;    /* Border color */
    
    /* Mystic Shield Java Color Palette (Standard for Java code at TNT) */
    --java-row-a:         #f4f9ff;    /* Alternating row A (light blue) */
    --java-row-b:         #b8d5f0;    /* Alternating row B (medium blue) */
    --java-kw:            #000099;    /* Keywords (dark blue) */
    --java-str:           #990000;    /* Strings (dark red) */
    --java-cmt:           #005540;    /* Comments (dark green) */
    --java-num:           #003d80;    /* Numbers (blue) */
    --java-num-lit:       #660099;    /* Numeric literals (purple) */
    --java-text:          #001020;    /* Text (very dark blue) */
    
    /* Typography */
    --font-primary:       'Inter', sans-serif;
    --font-mono:          'Source Code Pro', monospace;
    --font-display:       'Boogaloo', cursive;
    
    /* Sizing & Spacing */
    --radius-sm:          0.25rem;
    --radius-md:          0.5rem;
    --radius-lg:          0.75rem;
    --transition:         0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ══════════════════════════════════════════════════════════════════════════
   RESET & BASE STYLES
   ══════════════════════════════════════════════════════════════════════════ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--dojo-bg);
    color: var(--dojo-dark);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--math-primary);
    transition: color var(--transition);
}

a:hover {
    color: var(--math-primary-dark);
    text-decoration: underline;
}

/* ══════════════════════════════════════════════════════════════════════════
   BACK BAR — Navigation
   ══════════════════════════════════════════════════════════════════════════ */

#mathUtilsBackBar {
    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;
}

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

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

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

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

/* ══════════════════════════════════════════════════════════════════════════
   HERO SECTION
   ══════════════════════════════════════════════════════════════════════════ */

#mathUtilsHero {
    position: relative;
    height: 300px;
    background-image: url('../images/sonnyMathProblems.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    overflow: hidden;
}

#mathUtilsHero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(94, 179, 214, 0.35), rgba(26, 92, 138, 0.35));
    z-index: 1;
}

#mathUtilsHero .hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

#mathUtilsHero .hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 600px;
    padding: 2rem;
}

#mathUtilsHero .hero-label {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    opacity: 0.95;
}

#mathUtilsHero .hero-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

#mathUtilsHero .hero-tagline {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    line-height: 1.5;
}

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

.btn-math-primary {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--dojo);
    color: #ffffff;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    border: 2px solid var(--dojo);
}

.btn-math-primary:hover {
    background-color: var(--dojo-mid);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(94, 179, 214, 0.3);
    text-decoration: none;
}

@media (max-width: 768px) {
    #mathUtilsHero {
        height: 200px;
    }
    #mathUtilsHero .hero-title {
        font-size: 2rem;
    }
    #mathUtilsHero .hero-tagline {
        font-size: 0.95rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT CONTAINER
   ══════════════════════════════════════════════════════════════════════════ */

#mathUtilsMain {
    padding: 3rem 1rem;
    background-color: var(--dojo-bg);
}

#mathUtilsMain .container {
    max-width: 900px;
    margin: 0 auto;
}

/* ══════════════════════════════════════════════════════════════════════════
   INTRO BOX
   ══════════════════════════════════════════════════════════════════════════ */

.intro-box {
    background: linear-gradient(135deg, var(--dojo-light), #f5f5f5);
    border-left: 4px solid var(--dojo);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 3rem;
}

.intro-box h2 {
    font-family: var(--font-display);
    color: var(--dojo-dark);
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.intro-box p {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    color: var(--dojo-dark);
}

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

.tip {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background-color: rgba(94, 179, 214, 0.08);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--dojo);
}

.tip i {
    color: var(--dojo-dark);
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.tip strong {
    color: var(--dojo-dark);
}

@media (max-width: 768px) {
    .intro-box {
        padding: 1.5rem;
    }
    .intro-box h2 {
        font-size: 1.5rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   UTILITY SECTION CONTAINERS
   ══════════════════════════════════════════════════════════════════════════ */

.utility-section {
    margin-bottom: 3rem;
}

.section-title {
    font-family: var(--font-display);
    color: var(--dojo-dark);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title i {
    color: var(--dojo);
}

.section-desc {
    color: #666666;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════════════════════
   UTILITY CARD & CODE DISPLAY
   ══════════════════════════════════════════════════════════════════════════ */

.utility-card {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

/* Terminal Header */
.code-terminal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: #f0f0f0;
    border-bottom: 1px solid var(--dojo-border);
}

.terminal-dots {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

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

.td-red {
    background-color: #ff5f56;
}

.td-yellow {
    background-color: #ffbd2e;
}

.td-green {
    background-color: #27c93f;
}

.terminal-filename {
    font-family: var(--font-mono);
    color: var(--java-text);
    font-size: 0.85rem;
    font-weight: 600;
    flex: 1;
}

.terminal-tag {
    display: inline-block;
    font-family: var(--font-mono);
    color: var(--java-cmt);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.5rem;
    background-color: rgba(94, 179, 214, 0.1);
    border-radius: var(--radius-sm);
}

/* Copy Button */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: var(--dojo);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.copy-btn:hover {
    background-color: var(--dojo-mid);
    box-shadow: 0 2px 8px rgba(94, 179, 214, 0.3);
}

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

.copy-btn-label {
    min-width: 50px;
}

/* Code Paper / Listing */
.code-paper {
    padding: 1rem;
    background-color: #ffffff;
    overflow-x: auto;
}

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

.code-paper li {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--java-text);
    padding: 0.25rem 0.5rem 0.25rem 0;
    white-space: pre-wrap;
    word-break: break-word;
}

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

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

/* Attribute Strip */
.attr-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: rgba(94, 179, 214, 0.05);
    border-top: 1px solid var(--dojo-border);
    font-size: 0.85rem;
}

.attr-label {
    color: var(--dojo-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.attr-value {
    color: #666666;
    font-family: var(--font-mono);
}

@media (max-width: 768px) {
    .code-terminal-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .terminal-filename {
        order: 3;
        flex-basis: 100%;
        margin-top: 0.25rem;
    }
    .code-paper li {
        font-size: 0.8rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   ACCORDION SECTIONS
   ══════════════════════════════════════════════════════════════════════════ */

.utility-accordion {
    margin-bottom: 1rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: var(--dojo-mid);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.accordion-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    background-color: var(--dojo-light);
    border: 1px solid var(--dojo-border);
    border-bottom: none;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--dojo-dark);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.accordion-header:hover {
    background-color: rgba(94, 179, 214, 0.05);
    border-color: var(--dojo);
}

.accordion-header.active {
    background-color: rgba(94, 179, 214, 0.08);
    border-color: var(--dojo);
    border-bottom-color: var(--dojo);
}

.accordion-header i {
    transition: transform var(--transition);
    color: var(--dojo);
}

.accordion-header.active i {
    transform: rotate(90deg);
}

.utility-category {
    display: inline-block;
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--java-cmt);
    background-color: rgba(93, 209, 140, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* Accordion Content (Collapsed by default) */
.accordion-content {
    display: none;
    padding: 0;
    overflow: hidden;
}

.accordion-content.show {
    display: block;
}

.utility-info {
    padding: 1.5rem;
    background-color: var(--dojo-bg);
    border-top: 1px solid var(--dojo-border);
    color: var(--dojo-text);
    line-height: 1.7;
}

.utility-info p {
    margin-bottom: 0.75rem;
}

.utility-info p:last-child {
    margin-bottom: 0;
}

.utility-info code {
    background-color: rgba(94, 179, 214, 0.08);
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    color: var(--dojo-dark);
}

.utility-notes {
    padding: 1.5rem;
    background-color: rgba(94, 179, 214, 0.05);
    border-top: 1px solid var(--dojo-border);
    color: var(--dojo-text);
    line-height: 1.6;
}

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

.utility-notes strong:first-child {
    margin-top: 0;
}

.utility-notes ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 1rem;
}

.utility-notes li {
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    position: relative;
}

.utility-notes li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--dojo);
    font-weight: bold;
}

@media (max-width: 768px) {
    .accordion-header {
        padding: 1rem;
        font-size: 0.95rem;
    }
    .utility-category {
        display: block;
        margin-left: 0;
        margin-top: 0.5rem;
    }
    .utility-info,
    .utility-notes {
        padding: 1rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   HOW-TO BOX
   ══════════════════════════════════════════════════════════════════════════ */

.how-to-box {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(94, 179, 214, 0.08), rgba(58, 143, 181, 0.05));
    border: 2px solid var(--dojo);
    border-radius: var(--radius-lg);
    margin: 3rem 0;
}
    
.how-to-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.how-to-content {
    flex: 1;
}

.how-to-content h3 {
    color: var(--dojo-dark);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.how-to-content ol {
    list-style-position: inside;
    color: var(--dojo-text);
    line-height: 1.8;
}

.how-to-content li {
    margin-bottom: 0.75rem;
}

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

.how-to-content a {
    color: var(--dojo);
    font-weight: 600;
}

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

@media (max-width: 768px) {
    .how-to-box {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem;
    }
    .how-to-icon {
        font-size: 2rem;
    }
}

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

.back-section {
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 2px solid var(--dojo-border);
}

.back-link {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--math-primary);
    color: #ffffff;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.back-link:hover {
    background-color: var(--math-primary-dark);
    box-shadow: 0 4px 12px rgba(45, 127, 63, 0.3);
    text-decoration: none;
    transform: translateX(-0.25rem);
}

/* ══════════════════════════════════════════════════════════════════════════
   PRINT STYLES
   ══════════════════════════════════════════════════════════════════════════ */

@media print {
    #mathUtilsBackBar,
    .hero-cta,
    .back-section,
    .copy-btn {
        display: none;
    }
    
    .utility-accordion .accordion-content {
        display: block !important;
    }
    
    .code-paper {
        page-break-inside: avoid;
    }
}
