/* =====================================================
   DEVELOPER TOOLS – GLOBAL STYLESHEET
   Dark / Light theme via data-theme="dark"|"light"
   Default: dark
   ===================================================== */

/* ── CSS Variables ─────────────────────────────────── */
:root {
    --sidebar-width: 260px;
    --transition: 0.22s ease;
    --radius: 8px;
    --radius-sm: 5px;
}

html[data-theme="dark"] {
    /* Backgrounds */
    --bg-main:        #0d1117;
    --bg-card:        #161b22;
    --bg-card-hover:  #1c2128;
    --bg-input:       #0d1117;
    --bg-code:        #161b22;
    --bg-preview:     #1c2128;
    /* Sidebar */
    --sidebar-bg:     #010409;
    --sidebar-hover:  #21262d;
    --sidebar-active: rgba(31,111,235,.18);
    --sidebar-text:   #e6edf3;
    --sidebar-muted:  #8b949e;
    --sidebar-border: #21262d;
    --sidebar-toggle-bg:  rgba(255,255,255,.05);
    /* Text */
    --text-primary:   #e6edf3;
    --text-secondary: #8b949e;
    --text-muted:     #6e7681;
    /* Borders */
    --border:         #30363d;
    --border-muted:   #21262d;
    /* Accents */
    --accent-blue:    #58a6ff;
    --accent-purple:  #bc8cff;
    --accent-green:   #3fb950;
    --accent-orange:  #d29922;
    --accent-red:     #f85149;
    --accent-teal:    #39d5c4;
    /* Buttons */
    --btn-primary-bg:   #238636;
    --btn-primary-hov:  #2ea043;
    --btn-sec-bg:       #21262d;
    --btn-sec-hov:      #30363d;
    --btn-sec-text:     #c9d1d9;
    /* Code tokens */
    --tok-key:     #e06c75;
    --tok-string:  #98c379;
    --tok-number:  #d19a66;
    --tok-bool:    #56b6c2;
    --tok-null:    #c678dd;
    /* SQL */
    --sql-keyword: #79b8ff;
    --sql-comment: #6a737d;
    --sql-string:  #9ecbff;
    /* Diff */
    --diff-add-bg:     rgba(63,185,80,.12);
    --diff-add-fg:     #3fb950;
    --diff-rem-bg:     rgba(248,81,73,.12);
    --diff-rem-fg:     #f85149;
    --diff-chg-bg:     rgba(210,153,34,.12);
    --diff-chg-fg:     #d29922;
}

html[data-theme="light"] {
    /* Backgrounds */
    --bg-main:        #f6f8fa;
    --bg-card:        #ffffff;
    --bg-card-hover:  #f3f4f6;
    --bg-input:       #ffffff;
    --bg-code:        #f6f8fa;
    --bg-preview:     #ffffff;
    /* Sidebar – light */
    --sidebar-bg:         #ffffff;
    --sidebar-hover:      #eaeef2;
    --sidebar-active:     rgba(9,105,218,.1);
    --sidebar-text:       #24292f;
    --sidebar-muted:      #57606a;
    --sidebar-border:     #d0d7de;
    --sidebar-toggle-bg:  rgba(0,0,0,.04);
    /* Text */
    --text-primary:   #24292f;
    --text-secondary: #57606a;
    --text-muted:     #6e7781;
    /* Borders */
    --border:         #d0d7de;
    --border-muted:   #eaeef2;
    /* Accents */
    --accent-blue:    #0969da;
    --accent-purple:  #8250df;
    --accent-green:   #1a7f37;
    --accent-orange:  #9a6700;
    --accent-red:     #d1242f;
    --accent-teal:    #0ca89a;
    /* Buttons */
    --btn-primary-bg:   #1f883d;
    --btn-primary-hov:  #1a7f37;
    --btn-sec-bg:       #f6f8fa;
    --btn-sec-hov:      #e8eaed;
    --btn-sec-text:     #24292f;
    /* Code tokens */
    --tok-key:     #d73a49;
    --tok-string:  #22863a;
    --tok-number:  #e36209;
    --tok-bool:    #005cc5;
    --tok-null:    #6f42c1;
    /* SQL */
    --sql-keyword: #005cc5;
    --sql-comment: #6a737d;
    --sql-string:  #032f62;
    /* Diff */
    --diff-add-bg:     #e6ffec;
    --diff-add-fg:     #22863a;
    --diff-rem-bg:     #ffebe9;
    --diff-rem-fg:     #b31d28;
    --diff-chg-bg:     #fff8c5;
    --diff-chg-fg:     #735c0f;
}

/* ── Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 14px;
    min-height: 100%;
}
@media (min-width: 768px) { html { font-size: 15px; } }

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { color: var(--text-primary); }

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
    opacity: 1;
}

/* ── Sidebar ────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition), width var(--transition);
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 2px; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 15px;
    border-bottom: 1px solid var(--sidebar-border);
    text-decoration: none !important;
}
.sidebar-brand:hover { text-decoration: none !important; background: var(--sidebar-hover); }

.sidebar-brand-logo {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #1f6feb, #bc8cff);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    color: #fff;
}

.sidebar-brand-text {
    color: var(--sidebar-text);
    font-weight: 700;
    font-size: 0.95em;
    line-height: 1.25;
    white-space: nowrap;
}

.sidebar-brand-sub {
    display: block;
    font-size: 0.7em;
    color: var(--sidebar-muted);
    font-weight: 400;
}

/* Theme toggle */
.sidebar-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--sidebar-border);
}

.theme-row-label {
    font-size: 0.78em;
    color: var(--sidebar-muted);
    letter-spacing: 0.04em;
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--sidebar-toggle-bg);
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    border-radius: 20px;
    padding: 4px 11px;
    cursor: pointer;
    font-size: 0.78em;
    transition: all var(--transition);
    white-space: nowrap;
}
.theme-toggle-btn:hover { background: var(--sidebar-hover); border-color: var(--sidebar-muted); }

/* Nav */
.sidebar-nav { flex: 1; padding: 6px 0; }

/* Direct link (no children) */
.nav-direct {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--sidebar-muted);
    font-size: 0.93em;
    transition: all var(--transition);
    text-decoration: none !important;
    white-space: nowrap;
    border-left: 2px solid transparent;
}
.nav-direct:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    text-decoration: none !important;
}
.nav-direct.active {
    background: var(--sidebar-active);
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
}

/* Collapsible section */
.nav-group { }

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    cursor: pointer;
    color: var(--sidebar-muted);
    font-size: 0.93em;
    background: none;
    border: none;
    border-left: 2px solid transparent;
    width: 100%;
    text-align: left;
    transition: all var(--transition);
    white-space: nowrap;
}
.nav-group-header:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.nav-group.open .nav-group-header { color: var(--sidebar-text); }

.nav-chevron {
    margin-left: auto;
    font-size: 0.7em;
    transition: transform var(--transition);
}
.nav-group.open .nav-chevron { transform: rotate(90deg); }

.nav-group-items {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.28s ease;
}
.nav-group.open .nav-group-items { max-height: 400px; }

.nav-sub {
    display: block;
    padding: 6px 16px 6px 40px;
    color: var(--sidebar-muted);
    font-size: 0.89em;
    transition: all var(--transition);
    text-decoration: none !important;
    white-space: nowrap;
    border-left: 2px solid transparent;
}
.nav-sub:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    text-decoration: none !important;
}
.nav-sub.active {
    background: var(--sidebar-active);
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
}

.nav-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.8;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--sidebar-border);
    font-size: 0.74em;
    color: var(--sidebar-muted);
    line-height: 1.6;
}
.sidebar-footer a { color: var(--sidebar-muted); }
.sidebar-footer a:hover { color: var(--sidebar-text); text-decoration: none; }

/* ── Main Layout ────────────────────────────────────── */
#main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.top-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 50px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 12px;
}

.top-bar-title {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-secondary);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

#main-content {
    flex: 1;
    padding: 28px 28px 16px;
}

.page-footer {
    padding: 14px 28px;
    border-top: 1px solid var(--border);
    font-size: 0.78em;
    color: var(--text-muted);
}
.page-footer a { color: var(--text-muted); }
.page-footer a:hover { color: var(--accent-blue); text-decoration: none; }

/* ── Bootstrap Overrides ────────────────────────────── */
.form-control,
.form-select {
    background-color: var(--bg-input);
    border-color: var(--border);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    font-size: 0.92em;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-input);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(88,166,255,.15);
    outline: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-label, label {
    color: var(--text-secondary);
    font-size: 0.84em;
    font-weight: 500;
    margin-bottom: 5px;
}

.form-group { margin-bottom: 14px; }

.btn {
    font-size: 0.88em;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    cursor: pointer;
}

.btn-primary {
    background-color: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--btn-primary-hov);
    border-color: var(--btn-primary-hov);
    color: #fff;
}

.btn-secondary {
    background-color: var(--btn-sec-bg);
    border-color: var(--border);
    color: var(--btn-sec-text);
}
.btn-secondary:hover, .btn-secondary:focus {
    background-color: var(--btn-sec-hov);
    border-color: var(--border);
    color: var(--text-primary);
}

.btn:focus { box-shadow: 0 0 0 3px rgba(88,166,255,.22); }
.btn:active:focus { box-shadow: 0 0 0 3px rgba(88,166,255,.22); }

.card {
    background: var(--bg-card);
    border-color: var(--border);
}

.alert-danger {
    background: var(--diff-rem-bg);
    border-color: var(--accent-red);
    color: var(--text-primary);
}

.alert-warning {
    background: var(--diff-chg-bg);
    border-color: var(--accent-orange);
    color: var(--text-primary);
}

/* Tables */
.table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-striped-bg: transparent;
    --bs-table-hover-bg: transparent;
}

.table thead th {
    background: var(--bg-card);
    color: var(--text-secondary);
    border-color: var(--border);
    font-size: 0.82em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.table td {
    border-color: var(--border);
    font-size: 0.9em;
    color: var(--text-primary);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.table-striped > tbody > tr:nth-of-type(even) > * {
    background-color: var(--bg-main);
    color: var(--text-primary);
}

.table-bordered, .table-bordered td, .table-bordered th {
    border-color: var(--border);
}

.form-check-input {
    background-color: var(--bg-input);
    border-color: var(--border);
}
.form-check-input:checked {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}
.form-check-label { color: var(--text-secondary); }

/* ── Shared Component Styles ────────────────────────── */

/* Code block (pre) */
.code-block {
    background: var(--bg-code);
    color: var(--text-primary);
    padding: 14px;
    border-radius: var(--radius);
    overflow: auto;
    white-space: pre-wrap;
    font-family: 'Consolas', 'Cascadia Code', 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid var(--border);
    margin: 0;
}

.code-textarea {
    font-family: 'Consolas', 'Cascadia Code', monospace;
    font-size: 13px;
    line-height: 1.4em;
    white-space: pre;
}

/* Tree container */
.tree-container {
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    background: var(--bg-card);
    font-family: 'Consolas', monospace;
    font-size: 13px;
}

/* JSON token colors */
.token-key    { color: var(--tok-key);    font-weight: 600; }
.token-string { color: var(--tok-string); }
.token-number { color: var(--tok-number); }
.token-boolean { color: var(--tok-bool); }
.token-null   { color: var(--tok-null); }
.list-index   { color: var(--text-muted); margin-right: 6px; }
.toggle       { cursor: pointer; color: var(--accent-blue); user-select: none; }
.collapsed > .children { display: none; }
.node         { margin-left: 16px; }

/* Preview pane */
.preview {
    margin-top: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-preview);
    color: var(--text-primary);
}
.preview h1, .preview h2, .preview h3 { color: var(--text-primary); margin-top: .6em; margin-bottom: .3em; }
.preview p  { color: var(--text-secondary); margin: .35em 0; }
.preview table { border-collapse: collapse; width: 100%; }
.preview table, .preview th, .preview td { border: 1px solid var(--border); }
.preview th  { background: var(--bg-card); color: var(--text-primary); }
.preview th, .preview td { padding: 6px 10px; }

/* Collapsible sections */
.toggle-section {
    background: none;
    border: none;
    color: var(--accent-blue);
    cursor: pointer;
    font-size: 1.05em;
    font-weight: 600;
    padding: 0;
    transition: color var(--transition);
}
.toggle-section:hover { color: var(--text-primary); }

.section-content { display: none; margin-bottom: 1.4em; }
.section-content.active { display: block; }

.actions { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

/* Code container (textarea + line numbers) */
.code-container {
    --lh: 20px;
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Consolas', 'Cascadia Code', monospace;
    background: var(--bg-input);
    overflow: hidden;
}

.line-numbers {
    background: var(--bg-code);
    color: var(--text-muted);
    user-select: none;
    min-width: 44px;
    border-right: 1px solid var(--border);
    padding: 8px 8px 8px 4px;
    overflow: hidden;
    position: relative;
    font-size: 13px;
}
.line-numbers .nums { position: relative; will-change: transform; }
.line-numbers .nums span { display: block; height: var(--lh); line-height: var(--lh); text-align: right; }

.code-container .code-textarea {
    flex: 1;
    border: none;
    resize: none;
    font-family: inherit;
    font-size: 13px;
    line-height: var(--lh);
    padding: 8px 10px;
    white-space: pre;
    overflow: auto;
    box-sizing: border-box;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
}
.code-container .code-textarea:focus { box-shadow: none; }

/* Feature description */
.feature-description {
    color: var(--text-muted);
    margin-top: 6px;
    white-space: pre-line;
    font-style: italic;
    font-size: 0.87em;
    line-height: 1.55;
}

/* Validation messages */
.validation-message { margin-left: 10px; font-weight: 600; }
.validation-message.valid   { color: var(--accent-green); }
.validation-message.invalid { color: var(--accent-red);   }

/* sr-only */
.sr-only {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ── SQL Tool Styles ────────────────────────────────── */
.sql-code {
    font-family: 'Consolas', monospace;
    background: var(--bg-code);
    color: var(--text-primary);
    padding: 14px;
    border-radius: var(--radius);
    white-space: pre-wrap;
    border: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.5;
}
.sql-blue  { color: var(--sql-keyword); font-weight: bold; }
.sql-gray  { color: var(--sql-comment); }
.sql-red   { color: var(--accent-red); }
.sql-green { color: var(--accent-green); }

/* ── Diff Checker Styles ────────────────────────────── */
.input-row { display: flex; gap: 16px; margin-bottom: 16px; }
.input-col { flex: 1; min-width: 0; }

.diff-block {
    font-family: 'Consolas', monospace;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    background: var(--bg-code);
    white-space: pre-wrap;
    font-size: 13px;
}

/* ── Text Diff output lines ─────────────────────────── */
.diff-line {
    display: flex;
    align-items: baseline;
    font-family: var(--font-mono, 'Consolas', monospace);
    font-size: 0.84em;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-all;
    padding: 0 6px;
}

.diff-sign {
    width: 14px;
    flex-shrink: 0;
    user-select: none;
    font-weight: 700;
}

.diff-content { flex: 1; min-width: 0; }

.diff-same    { color: var(--text-secondary); }
.diff-add     { background: var(--diff-add-bg); color: var(--diff-add-fg); }
.diff-remove  { background: var(--diff-rem-bg); color: var(--diff-rem-fg); }

/* Inline word highlights within a changed line */
mark.diff-word-add {
    background: rgba(63,185,80,.45);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
    font-weight: 700;
}

mark.diff-word-del {
    background: rgba(248,81,73,.45);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
    font-weight: 700;
    text-decoration: line-through;
}

.item.add    { display: block; background: var(--diff-add-bg); color: var(--diff-add-fg); padding: 3px 6px; margin: 2px 0; border-radius: 3px; }
.item.remove { display: block; background: var(--diff-rem-bg); color: var(--diff-rem-fg); padding: 3px 6px; margin: 2px 0; border-radius: 3px; }
.item.change { display: block; background: var(--diff-chg-bg); color: var(--diff-chg-fg); padding: 3px 6px; margin: 2px 0; border-radius: 3px; }

.summary { font-size: 1em; margin-bottom: 10px; color: var(--text-primary); }
.summary .count { margin-left: 8px; color: var(--text-muted); }

/* ── Home Page Styles ───────────────────────────────── */
.home-hero {
    padding-bottom: 24px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.home-hero h1 {
    font-size: 1.75em;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(120deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.home-hero p {
    color: var(--text-secondary);
    font-size: 0.98em;
    margin: 0;
}

.tool-section { margin-bottom: 32px; }

.tool-section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--text-muted);
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.tool-section-heading i { color: var(--accent-blue); font-size: 1.1em; }

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 12px 16px;
    text-align: center;
    text-decoration: none !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.18s ease;
    color: var(--text-primary) !important;
}

.tool-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    text-decoration: none !important;
    color: var(--text-primary) !important;
}

.tool-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25em;
}

.tool-card.cat-beautifier .tool-card-icon { background: rgba(188,140,255,.12); color: var(--accent-purple); }
.tool-card.cat-base64     .tool-card-icon { background: rgba(88,166,255,.12);  color: var(--accent-blue);   }
.tool-card.cat-sql        .tool-card-icon { background: rgba(63,185,80,.12);   color: var(--accent-green);  }

.tool-card-name {
    font-size: 0.88em;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Mobile Apps showcase */
.mobile-section {
    padding-top: 24px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.mobile-section-heading {
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.app-showcase { display: flex; gap: 16px; flex-wrap: wrap; }

.app-item {
    text-align: center;
    width: 148px;
    transition: all .25s ease;
}

.app-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 8px;
    border-radius: 12px;
}

.app-title {
    margin: 4px 0;
    font-weight: 600;
    font-size: 0.83em;
    color: var(--text-primary);
    line-height: 1.3;
}

.play-badge { width: 108px; margin: 6px 0; opacity: .85; }
.play-badge:hover { opacity: 1; }

.app-description {
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease;
    font-size: 0.8em;
    color: var(--text-muted);
}

.app-item:hover .app-description {
    max-height: 90px;
    margin-top: 6px;
}

.external-links {
    margin-top: 16px;
    font-size: 0.84em;
    color: var(--text-muted);
}

/* ── Result Section Accordion Cards ────────────────── */

/* Labelled divider above results */
.results-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 14px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    user-select: none;
}
.results-divider::before,
.results-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.result-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    background: var(--bg-card);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.result-section.open {
    border-color: color-mix(in srgb, var(--accent-blue) 35%, var(--border));
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
}

.result-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
    gap: 10px;
}

.result-section-header:hover {
    background: var(--bg-card-hover);
}

.result-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88em;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.result-section-title > i {
    font-size: 1em;
    flex-shrink: 0;
    color: var(--accent-blue);
}

.result-section-tools {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.result-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--btn-sec-bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 3px 9px;
    font-size: 0.77em;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.5;
}

.result-btn:hover {
    background: var(--btn-sec-hov);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.result-btn i { font-size: 0.95em; }

.result-chevron-wrap {
    display: flex;
    align-items: center;
    padding-left: 8px;
    margin-left: 2px;
    border-left: 1px solid var(--border-muted);
    color: var(--text-muted);
}

.result-chevron-icon {
    display: inline-block;
    transition: transform var(--transition);
}

/* .open class is toggled via Bootstrap collapse events in JS */
.result-section.open .result-chevron-icon {
    transform: rotate(180deg);
}

/* Body uses Bootstrap .collapse / .collapse.show for visibility */
.result-section-body {
    border-top: 1px solid var(--border);
    padding: 14px 16px;
}

/* ── Additional Bootstrap / Browser Overrides ──────── */

/* Form-select dropdown arrow – light color in dark mode */
html[data-theme="dark"] .form-select {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238b949e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Date input calendar icon colour */
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.6);
}

/* Bootstrap table border variable */
.table {
    --bs-table-border-color: var(--border);
    --bs-border-color: var(--border);
}

/* Disclaimer inner footer – override Bootstrap text-muted */
.text-muted { color: var(--text-muted) !important; }

/* ── Mobile Responsive ──────────────────────────────── */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }
    #sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,.4);
    }
    #main-wrapper {
        margin-left: 0;
    }
    .mobile-menu-btn {
        display: flex !important;
    }
    #main-content {
        padding: 16px;
    }
    .input-row {
        flex-direction: column;
    }
    .tool-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
}
.sidebar-overlay.active { display: block; }

/* ── Network Tools ──────────────────────────────────────────────── */
.tool-card.cat-network   .tool-card-icon { background: rgba(210,153,34,.12); color: var(--accent-orange); }
.tool-card.cat-encoding  .tool-card-icon { background: rgba(57,213,196,.12);  color: var(--accent-teal);   }
.tool-card.cat-other     .tool-card-icon { background: rgba(248,81,73,.12);   color: var(--accent-red);    }

.net-info-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.net-info-row:last-child { border-bottom: none; }
.net-info-label {
    min-width: 160px;
    font-size: .85em;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.net-info-value {
    color: var(--text-primary);
    font-size: .92em;
    word-break: break-all;
}

/* DNS record type badges */
.dns-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: .78em;
    font-weight: 600;
    letter-spacing: .04em;
    font-family: var(--font-mono);
    background: var(--bg-hover);
    color: var(--text-secondary);
}
.dns-type-a     { background: #1a4a2e; color: #3fb950; }
.dns-type-aaaa  { background: #1a3a4a; color: #58a6ff; }
.dns-type-mx    { background: #3a2a1a; color: #e3a03a; }
.dns-type-txt   { background: #2e1a4a; color: #bc8cff; }
.dns-type-cname { background: #1a3a3a; color: #39d5c4; }
.dns-type-ns    { background: #3a1a1a; color: #f85149; }
.dns-type-soa   { background: #2a2a1a; color: #d4c53a; }
.dns-type-ptr   { background: #1a2a3a; color: #79c0ff; }

/* ── Tip of the Day ─────────────────────────────────── */
.tip-section {
    padding-top: 24px;
    border-top: 1px solid var(--border);
    margin-bottom: 32px;
}

/* ── Hash Generator ──────────────────────────────── */
.hash-output {
    font-family: var(--font-mono, monospace);
    font-size: 0.9em;
    color: var(--accent-teal);
    word-break: break-all;
}

.badge-weak {
    font-size: 0.72em;
    font-weight: 500;
    background: rgba(248,81,73,.15);
    color: var(--accent-red);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

/* ── Regex Tester ────────────────────────────────── */
.regex-highlight {
    background: rgba(57,213,196,.25);
    color: var(--accent-teal);
    border-radius: 2px;
    padding: 0 1px;
}

.regex-match-item {
    font-family: var(--font-mono, monospace);
    font-size: 0.85em;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    margin: 3px 3px 0 0;
    display: inline-block;
    color: var(--text-primary);
}

/* ── Color Converter ─────────────────────────────── */
.color-preview-box {
    width: 100%;
    height: 80px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 14px;
    transition: background-color 0.2s ease;
}

.color-format-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.color-format-label {
    width: 50px;
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    flex-shrink: 0;
}

.color-format-value {
    flex: 1;
    font-family: var(--font-mono, monospace);
    font-size: 0.88em;
    background: var(--bg-input, var(--bg-card));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    color: var(--text-primary);
}

/* ── GUID Generator ──────────────────────────────── */
.guid-list {
    font-family: var(--font-mono, monospace);
    font-size: 0.88em;
    white-space: pre;
    line-height: 1.8;
}

/* ── Timestamp Converter ─────────────────────────── */
.ts-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.ts-label {
    width: 140px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.85em;
}

.ts-value {
    font-family: var(--font-mono, monospace);
    color: var(--text-primary);
    flex: 1;
    word-break: break-all;
}


.tip-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-blue);
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.tip-card-icon {
    font-size: 1.35em;
    color: var(--accent-blue);
    flex-shrink: 0;
    margin-top: 1px;
}

.tip-card-body {
    flex: 1;
    min-width: 0;
}

.tip-card-label {
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--accent-blue);
    margin-bottom: 5px;
}

.tip-card-text {
    color: var(--text-primary);
    font-size: 0.95em;
    line-height: 1.6;
    margin: 0;
}

.tip-card-text code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-hover);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--accent-purple);
}

.dns-type-srv   { background: #2a1a3a; color: #d2a8ff; }
