/*
  ╔══════════════════════════════════════════════════════════════════════════╗
  ║                 dojoStringUtilityStyles.css                              ║
  ║          APCS Java Dojo — String Utilities Page Styling                  ║
  ║                                                                          ║
  ║  Color Theme:  Orange Puppet (from Pinocchio puppet icon)                ║
  ║  Structure:    Back bar → Hero section → Intro → 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 */
    
    /* String Utilities Orange Theme - Puppet Icon Colors */
    --string-primary:     #E94F07;    /* Primary orange accent (puppet) */
    --string-primary-light: #F5A962;  /* Light orange for backgrounds/accents */
    --string-primary-dark:  #C83D00;  /* Darker orange for hover/active states */
    --string-dim:         rgba(233, 79, 7, 0.18);    /* Dim orange overlay */
    
    /* 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(--string-primary);
    transition: color var(--transition);
}

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

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

#stringUtilsBackBar {
    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(--string-primary);
    font-size: 0.88rem;
}

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

#stringUtilsBackBar a {
    color: var(--string-primary-light);
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s;
}

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

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

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

#stringUtilsHero {
    position: relative;
    min-height: 50vh;
    background-image: url('../images/robotStrings.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    overflow: hidden;
    padding: 4rem 1rem 3rem;
}

#stringUtilsHero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(233, 79, 7, 0.35), rgba(200, 61, 0, 0.35));
    z-index: 1;
}

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

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

#stringUtilsHero .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;
}

#stringUtilsHero .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;
}

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

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

.btn-string-primary {
    display: inline-flex;
    align-items: center;
    padding: 0.65rem 1.5rem;
    background-color: var(--string-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.2s, transform 0.15s;
    text-decoration: none;
}

.btn-string-primary:hover {
    background-color: var(--string-primary-dark);
    transform: translateY(-2px);
    text-decoration: none;
    color: #ffffff;
}

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

#stringUtilsMain {
    background: #ffffff;
    padding: 3rem 0;
}

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

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

.intro-box {
    background: rgba(233, 79, 7, 0.08);
    border-left: 4px solid var(--string-primary);
    border-radius: 8px;
    padding: 1.75rem;
    margin-bottom: 2.5rem;
}

.intro-box h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--string-primary-dark);
    margin-bottom: 0.75rem;
}

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

.quick-tips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.tip {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background-color: rgba(233, 79, 7, 0.05);
    border-left: 3px solid var(--string-primary);
    border-radius: 6px;
    font-size: 0.85rem;
}

.tip i {
    color: var(--string-primary);
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.tip strong {
    color: var(--string-primary-dark);
    display: inline;
}

.tip code {
    background: rgba(233, 79, 7, 0.1);
    color: var(--string-primary-dark);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   UTILITIES CONTAINER & ACCORDION
   ══════════════════════════════════════════════════════════════════════════ */

.utilities-container {
    margin-top: 2.5rem;
}

.utility-accordion {
    background: #ffffff;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.utility-accordion:hover {
    box-shadow: 0 4px 12px rgba(233, 79, 7, 0.15);
    border-color: var(--string-primary);
}

/* Accordion Header */

.accordion-header {
    width: 100%;
    background: #f9f9f9;
    border: none;
    padding: 1.25rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s;
    font-family: var(--font-primary);
    font-size: 1rem;
}

.accordion-header:hover {
    background-color: rgba(233, 79, 7, 0.08);
}

.accordion-header.active {
    background-color: rgba(233, 79, 7, 0.12);
}

.accordion-header strong {
    color: var(--string-primary-dark);
    font-size: 1.1rem;
    flex: 1;
}

.accordion-header .utility-category {
    display: inline-block;
    background: var(--string-primary);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 1rem;
    white-space: nowrap;
}

.accordion-header i {
    color: var(--string-primary);
    transition: transform 0.2s;
}

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

/* Accordion Content (Initially Hidden) */

.accordion-content {
    display: none;
    background: #ffffff;
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

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

/* Utility Info Section */

.utility-info {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.utility-info p {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.6rem;
    line-height: 1.6;
}

.utility-info code {
    background: rgba(233, 79, 7, 0.1);
    color: var(--string-primary-dark);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* Code Terminal Header */

.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: var(--font-mono);
    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 Button */

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

.copy-btn:hover {
    background: rgba(233, 79, 7, 0.25);
    color: #fff;
}

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

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

/* Code Display Area */

.code-paper {
    background: var(--java-row-a);
    overflow-x: auto;
    counter-reset: code-line;
    font-family: var(--font-mono);
    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 */

.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;
}

/* Utility Notes Section */

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

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

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

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

.utility-notes li {
    margin-bottom: 0.4rem;
    line-height: 1.5;
    padding-left: 0;
}

.utility-notes li:before {
    content: "✅ ";
    color: var(--string-primary);
    font-weight: bold;
}

.utility-notes code {
    background: rgba(233, 79, 7, 0.08);
    color: var(--string-primary-dark);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.utility-notes pre {
    background: #fff4e6 !important;
    border-left: 4px solid var(--string-primary) !important;
}

/* Featured Utility Styling */

.featured-utility {
    background: rgba(233, 79, 7, 0.05);
    border-top: 2px solid var(--string-primary);
    border-bottom: none;
}

.featured-utility-notes {
    background: rgba(233, 79, 7, 0.05) !important;
}

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

@media (max-width: 768px) {
    #stringUtilsBackBar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    #stringUtilsBackBar .back-links {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }
    
    #stringUtilsHero {
        min-height: 40vh;
        padding: 2rem 1rem;
    }
    
    #stringUtilsHero .hero-title {
        font-size: 2rem;
    }
    
    #stringUtilsHero .hero-tagline {
        font-size: 0.95rem;
    }
    
    .accordion-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .accordion-header .utility-category {
        margin-left: 0;
        margin-top: 0.5rem;
    }
    
    .code-terminal-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .copy-btn {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .terminal-tag {
        display: none;
    }
    
    .intro-box {
        padding: 1.5rem 1.25rem;
    }
    
    .quick-tips {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    #stringUtilsHero .hero-title {
        font-size: 1.5rem;
    }
    
    #stringUtilsHero .hero-tagline {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }
    
    #stringUtilsHero .hero-cta {
        gap: 0.5rem;
    }
    
    .btn-string-primary {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .accordion-header {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .accordion-header strong {
        font-size: 0.95rem;
    }
    
    .accordion-header .utility-category {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }
    
    .attr-strip {
        font-size: 0.7rem;
        padding: 0.6rem 0.8rem;
    }
    
    .utility-notes {
        padding: 1rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .code-paper {
        font-size: 0.75rem;
    }
    
    .tip {
        font-size: 0.8rem;
        padding: 0.75rem;
    }
}

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

@media print {
    #stringUtilsHero {
        min-height: auto;
        padding: 2rem 1rem;
        background: none;
    }
    
    #stringUtilsMain {
        background: #fff;
    }
    
    .accordion-header {
        background: #f9f9f9;
        page-break-inside: avoid;
    }
    
    .utility-accordion {
        page-break-inside: avoid;
        box-shadow: none;
        border-color: #ccc;
    }
}
