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

:root {
    /* TI Primary Colors */
    --ti-red: #CC0000;
    --ti-black: #000000;
    --ti-grey: #AAAAAA;
    --ti-white: #FFFFFF;

    /* TI Secondary Colors */
    --ti-red-dark: #990000;
    --ti-blue-dark: #115566;
    --ti-teal: #007C8C;
    --ti-cyan: #00BBCC;
    --ti-grey-light: #E0E0E0;

    /* Application Colors */
    --primary-color: #CC0000;
    --primary-hover: #990000;
    --secondary-color: #115566;
    --accent-color: #007C8C;
    --error-color: #CC0000;
    --success-color: #007C8C;
    --warning-color: #CC0000;
    --bg-color: #FFFFFF;
    --card-bg: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #115566;
    --border-color: #E0E0E0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--ti-red) 0%, var(--ti-red-dark) 100%);
    min-height: 100vh;
    padding: 0;
    color: var(--text-primary);
}

/* Top Navigation Bar */
.top-nav {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-decoration: none;
    transition: opacity 0.2s;
}

.nav-brand-section:hover {
    opacity: 0.8;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.nav-tagline {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
}

.nav-links {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.nav-link svg {
    flex-shrink: 0;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 1rem;
}

.doc-link {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.1s;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.doc-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.header-links {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

main {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

section {
    margin-bottom: 2rem;
}

section:last-child {
    margin-bottom: 0;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.input-section {
    background: var(--ti-grey-light);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

label {
    width: 100%;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

input[type="text"] {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    white-space: nowrap;
}

button:active {
    transform: translateY(1px);
}

#decodeBtn {
    background-color: var(--primary-color);
    color: white;
}

#decodeBtn:hover {
    background-color: var(--primary-hover);
}

#clearBtn {
    background-color: var(--ti-grey);
    color: white;
}

#clearBtn:hover {
    background-color: var(--ti-blue-dark);
}

.format-hint {
    background: var(--ti-white);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--ti-teal);
}

.format-hint p {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.format-hint ul {
    list-style: none;
    padding-left: 1rem;
}

.format-hint li {
    margin: 0.25rem 0;
    color: var(--ti-blue-dark);
}

.format-hint strong {
    color: var(--text-primary);
}

.results-section {
    background: var(--ti-grey-light);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

#resultsContainer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.error-card {
    background: var(--ti-white);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--ti-red);
    box-shadow: var(--shadow);
}

.error-card.no-errors {
    border-left-color: var(--ti-teal);
}

.error-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.error-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.error-bit {
    background: var(--ti-red);
    color: var(--ti-white);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
}

.error-description {
    color: var(--ti-blue-dark);
    line-height: 1.5;
}

.input-info {
    background: var(--ti-white);
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid var(--ti-cyan);
}

.input-info strong {
    color: var(--ti-blue-dark);
}

.table-container {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: var(--ti-grey-light);
}

th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background: var(--ti-grey-light);
}

tbody tr:last-child td {
    border-bottom: none;
}

.error-name-cell {
    font-family: 'Courier New', monospace;
    color: var(--ti-red);
    font-weight: 600;
}

.bit-cell {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.hex-cell {
    font-family: 'Courier New', monospace;
    color: var(--ti-blue-dark);
    white-space: nowrap;
    min-width: 120px;
}

footer {
    text-align: center;
    margin-top: 2rem;
    color: white;
    opacity: 0.9;
    font-size: 0.875rem;
}

.error-message {
    background: var(--ti-white);
    color: var(--ti-red);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--ti-red);
    font-weight: 500;
    border: 1px solid var(--ti-red);
}

/* Landing Page Styles */
/* Category Filter Section */
.category-filter-section {
    margin-bottom: 2rem;
}

.category-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.category-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    background: white;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.category-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.category-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.category-btn.active:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
}

/* Search Section */
.search-section {
    margin-bottom: 2rem;
}

.search-container {
    max-width: 800px;
    margin: 0 auto;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--ti-grey);
    pointer-events: none;
}

#toolSearch {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
    background: white;
}

#toolSearch:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.1);
}

#toolSearch::placeholder {
    color: var(--ti-grey);
}

.clear-search-btn {
    position: absolute;
    right: 0.5rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--ti-grey-light);
    color: var(--ti-grey);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: all 0.2s;
    padding: 0;
}

.clear-search-btn:hover {
    background: var(--ti-red);
    color: white;
}

.search-results {
    margin-top: 1.5rem;
    display: none;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.search-results-header h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin: 0;
}

.show-all-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: var(--ti-grey-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.show-all-btn:hover {
    background: var(--ti-red);
    color: white;
    border-color: var(--ti-red);
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.search-result-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.search-result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--ti-red);
}

.search-result-category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--ti-teal);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.search-result-card h4 {
    color: var(--ti-red);
    margin: 0 0 0.75rem 0;
    font-size: 1.125rem;
}

.search-result-card p {
    color: var(--ti-blue-dark);
    line-height: 1.6;
    flex-grow: 1;
    margin: 0 0 1rem 0;
}

.search-result-card mark {
    background: #FFF9C4;
    color: var(--text-primary);
    font-weight: 600;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

.no-results {
    text-align: center;
    padding: 3rem 1.5rem;
    background: white;
    border-radius: 8px;
    border: 2px dashed var(--border-color);
}

.no-results svg {
    color: var(--ti-grey);
    margin-bottom: 1rem;
}

.no-results h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.no-results p {
    color: var(--ti-blue-dark);
    margin-bottom: 0.5rem;
}

.no-results .hint {
    color: var(--ti-grey);
    font-size: 0.875rem;
    font-style: italic;
}

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

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.tool-card {
    background: var(--ti-white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.tool-card:not(.coming-soon):hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--ti-red);
}

.tool-card.coming-soon {
    opacity: 0.6;
    cursor: default;
}

.tool-card h3 {
    color: var(--ti-red);
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.tool-card p {
    color: var(--ti-blue-dark);
    line-height: 1.6;
    flex-grow: 1;
    margin-bottom: 1rem;
}

.tool-link-arrow {
    color: var(--ti-red);
    font-weight: 600;
    align-self: flex-start;
}

.tool-link-arrow.disabled {
    color: var(--ti-grey);
}

.info-section {
    background: var(--ti-grey-light);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.info-section p {
    color: var(--ti-blue-dark);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.resources {
    background: var(--ti-white);
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid var(--ti-teal);
}

.resources h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

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

.resources li {
    margin: 0.75rem 0;
}

.resources a {
    color: var(--ti-red);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.resources a:hover {
    color: var(--ti-red-dark);
    text-decoration: underline;
}

.section-description {
    color: var(--ti-blue-dark);
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
}

.partner-card {
    border: 2px solid var(--ti-cyan);
}

.partner-card:hover {
    border-color: var(--ti-teal);
}

/* Security Utils / Key Configuration Styles */
.config-group {
    background: var(--ti-white);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.config-group h3 {
    color: var(--ti-red);
    margin-bottom: 1rem;
    font-size: 1.15rem;
}

.config-group label {
    display: block;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

.config-group label:first-of-type {
    margin-top: 0;
}

select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: white;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: border-color 0.2s;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--ti-grey-light);
    border-radius: 6px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.button-group button {
    flex: 1;
    min-width: 150px;
}

button.secondary {
    background-color: var(--ti-grey);
    color: white;
}

button.secondary:hover {
    background-color: var(--ti-blue-dark);
}

#generateBtn, #generateCBtn, #saveConfigBtn, #loadConfigBtn, #validateBtn {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(204, 0, 0, 0.2);
}

#generateBtn:hover, #generateCBtn:hover, #saveConfigBtn:hover, #loadConfigBtn:hover, #validateBtn:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(204, 0, 0, 0.3);
    transform: translateY(-1px);
}

.experimental-warning {
    background: #E3F2FD;
    border: 2px solid #2196F3;
    border-left: 4px solid #1976D2;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.experimental-warning h3 {
    color: #0D47A1;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.experimental-warning p {
    color: #1565C0;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.experimental-warning p:last-child {
    margin-bottom: 0;
}

.experimental-warning a {
    color: #0D47A1;
    font-weight: 600;
    text-decoration: underline;
    word-break: break-all;
}

.experimental-warning a:hover {
    color: #1976D2;
}

.disclaimer-box {
    background: #FFF3CD;
    border: 2px solid #FFC107;
    border-left: 4px solid #FF9800;
    padding: 1.5rem;
    border-radius: 8px;
}

.disclaimer-box h3 {
    color: #E65100;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.disclaimer-box p {
    color: #5D4037;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.disclaimer-box p:last-child {
    margin-bottom: 0;
}

.result-card {
    background: var(--ti-white);
    padding: 1.5rem;
    border-radius: 8px;
    border: 2px solid var(--ti-teal);
    box-shadow: var(--shadow);
}

.result-card h3 {
    color: var(--ti-red);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.result-card h4 {
    color: var(--ti-blue-dark);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.result-card p {
    color: var(--ti-blue-dark);
    margin-bottom: 0.5rem;
}

.code-preview {
    background: var(--ti-grey-light);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.download-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.1s;
}

.download-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.success-message {
    background: var(--ti-white);
    color: var(--ti-teal);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--ti-teal);
    font-weight: 500;
    border: 1px solid var(--ti-teal);
}

.info-text {
    color: var(--ti-grey);
    font-size: 0.875rem;
    font-style: italic;
    margin-top: 1rem;
}

.info-section code {
    background: var(--ti-grey-light);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--ti-blue-dark);
}

/* Device Tree Validator Styles */
#treeViewContainer {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    max-height: none;
    overflow-y: visible;
}

#templateSelector {
    background: var(--ti-grey-light);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

#templateSelector select {
    flex: 1;
    min-width: 200px;
}

/* Tree Visualization Styles */
.tree-help-banner {
    background: linear-gradient(135deg, #E3F2FD 0%, #F3E5F5 100%);
    border: 1px solid #2196F3;
    border-left: 4px solid var(--ti-teal);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--ti-blue-dark);
}

.tree-help-banner strong {
    color: #0D47A1;
}

.tree-node-container {
    margin: 0.5rem 0;
}

.tree-preprocessor {
    background: var(--ti-grey-light);
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--ti-grey);
}

.tree-preprocessor div {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--ti-grey);
    font-style: italic;
    line-height: 1.4;
}

.tree-node-box {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.tree-node-box:hover {
    border-color: var(--ti-red);
    box-shadow: var(--shadow-lg);
}

/* Section type indicators */
.tree-node-box[data-section-type="memory"] {
    border-left: 4px solid #9C27B0;
}

.tree-node-box[data-section-type="config"] {
    border-left: 4px solid #FF9800;
}

.tree-node-box[data-section-type="hardware"] {
    border-left: 4px solid #2196F3;
}

.tree-node-box[data-section-type="power"] {
    border-left: 4px solid #4CAF50;
}

.tree-node-box[data-section-type="peripheral"] {
    border-left: 4px solid var(--ti-teal);
}

.tree-node-box[data-section-type="pinmux"] {
    border-left: 4px solid #FFC107;
}

.tree-node-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--ti-grey-light) 0%, white 100%);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.tree-expand-btn {
    font-size: 0.75rem;
    color: var(--ti-red);
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s;
    width: 16px;
    display: inline-block;
    text-align: center;
}

.tree-expand-btn:hover {
    transform: scale(1.3);
}

.tree-expand-spacer {
    width: 16px;
    display: inline-block;
}

.tree-node-name {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 1rem;
    color: var(--ti-red);
    flex: 1;
}

.tree-node-label {
    color: var(--ti-teal);
    font-weight: 700;
}

.tree-child-badge {
    background: var(--ti-teal);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tree-node-content {
    padding: 1rem;
    background: white;
    max-height: 500px;
    overflow-y: auto;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.tree-node-content.collapsed {
    max-height: 0;
    padding: 0 1rem;
    overflow: hidden;
}

.tree-property {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    padding: 0.35rem 0;
    line-height: 1.5;
}

.tree-prop-name {
    color: var(--ti-blue-dark);
    font-weight: 600;
}

.tree-prop-value {
    color: var(--text-primary);
}

.tree-children-container {
    margin-left: 2rem;
    padding-left: 1rem;
    border-left: 2px solid var(--ti-cyan);
    margin-top: 1rem;
    transition: max-height 0.3s ease, opacity 0.3s ease, border-color 0.2s;
    max-height: 10000px;
    opacity: 1;
    cursor: help;
}

.tree-children-container:hover {
    border-left-color: var(--ti-red);
}

.tree-children-container.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.tree-child-wrapper {
    position: relative;
    margin: 1rem 0;
}

.tree-connector {
    position: absolute;
    left: -1rem;
    top: 1.5rem;
    width: 1rem;
    height: 2px;
    background: var(--ti-cyan);
}

.tree-connector::before {
    content: '';
    position: absolute;
    left: 0;
    top: -1.5rem;
    width: 2px;
    height: 1.5rem;
    background: var(--ti-cyan);
}

.tree-connector:hover,
.tree-connector:hover::before {
    background: var(--ti-red);
    cursor: help;
}

/* Make tooltips more visible */
[title]:hover {
    cursor: help;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem 0.5rem;
    }

    .nav-container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-brand-section {
        text-align: center;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-tagline {
        font-size: 0.7rem;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .nav-link {
        width: 100%;
        justify-content: center;
        font-size: 0.875rem;
        padding: 0.625rem 1rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    main {
        padding: 1.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    input[type="text"] {
        min-width: 100%;
    }

    button {
        width: 100%;
    }

    .error-header {
        flex-direction: column;
        align-items: start;
    }

    th, td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .header-links {
        flex-direction: column;
        align-items: center;
    }

    .doc-link {
        width: 100%;
        text-align: center;
    }

    .config-group {
        padding: 1rem;
    }

    .checkbox-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
    }

    .tree-children-container {
        margin-left: 1rem;
        padding-left: 0.5rem;
    }

    .tree-node-header {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .tree-node-content {
        padding: 0.75rem;
    }

    .tree-help-banner {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }

    /* Search responsive styles */
    .search-results-grid {
        grid-template-columns: 1fr;
    }

    .search-results-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    .show-all-btn {
        width: 100%;
    }

    #toolSearch {
        font-size: 0.875rem;
        padding: 0.75rem 1rem 0.75rem 2.75rem;
    }

    .search-icon {
        left: 0.75rem;
        width: 18px;
        height: 18px;
    }
}
