/* Import Google Fonts - JetBrains Mono (brand/category/code voice) + Inter (body) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    /* Workbench palette - Light theme: cool paper, ink text, cobalt signal */
    --primary: #1E5EFF;
    --primary-dark: #1747C2;
    --primary-light: #6E93FF;
    --secondary: #5C6B7A;

    --background: #F7F9FB;
    --surface: #FFFFFF;
    --surface-hover: #EFF3F7;
    --text-primary: #16232F;
    --text-secondary: #5C6B7A;
    --text-muted: #8A98A6;
    --border: #E3E8ED;
    --border-strong: #D0D8E0;
    --shadow-color: rgba(22, 35, 47, 0.06);

    /* Per-category accent, resolved from --hue set per section/card.
       Lightness flips between themes so hues stay readable. */
    --cat-s: 62%;
    --cat-l: 40%;
    --cat-soft: 14%; /* tint strength for backgrounds */

    /* Layout */
    --sidebar-width: 280px;
    --link-padding: 10px 22px;
    --border-radius: 8px;
    --border-radius-sm: 6px;

    /* Type */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #6E93FF;
    --primary-dark: #4D7FFF;
    --primary-light: #9DB4FF;
    --secondary: #94A3B8;

    --background: #0D1420;
    --surface: #131C2B;
    --surface-hover: #1B2739;
    --text-primary: #E8EEF4;
    --text-secondary: #A9B7C6;
    --text-muted: #64748B;
    --border: #233042;
    --border-strong: #33415A;
    --shadow-color: rgba(0, 0, 0, 0.3);

    --cat-s: 70%;
    --cat-l: 64%;
    --cat-soft: 18%;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font-body);
    overflow: hidden;
    background-color: var(--background);
    color: var(--text-primary);
}

/* Remove animated background gradient */
body::before {
    display: none;
}

.container {
    display: flex;
    height: 100vh;
    position: relative;
    padding: 0;
    gap: 0;
    box-sizing: border-box;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: width var(--transition-normal);
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.sidebar h2 {
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 1.25em;
    font-weight: 700;
    font-family: var(--font-mono);
    padding: 0 24px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.25em;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.sidebar-header h2 .brand-cursor {
    color: var(--primary);
    font-weight: 700;
}

.sidebar-header a {
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    transition: color var(--transition-fast);
}

.sidebar-header a:hover {
    color: var(--primary);
    transition: color var(--transition-fast);
}

#search-box {
    width: calc(100% - 48px);
    padding: 10px 14px;
    margin: 0 24px 20px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    box-sizing: border-box;
    font-size: 0.9em;
    color: var(--text-primary);
    font-family: var(--font-body);
    transition: all var(--transition-fast);
}

#search-box::placeholder {
    color: var(--text-secondary);
}

#search-box:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.sidebar ul li {
    margin-bottom: 2px;
}

.sidebar ul li a {
    display: block;
    padding: var(--link-padding);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    margin: 4px 16px;
    transition: all var(--transition-fast);
    font-size: 0.9em;
    line-height: 1.5;
    font-weight: 500;
}

.sidebar ul li a:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    padding-left: 28px;
}

.sidebar ul li a.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    font-weight: 600;
    border-left: 3px solid var(--primary);
    padding-left: 28px;
}

.content {
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    box-sizing: border-box;
    background-color: var(--background);
}

/* Custom scrollbar for content */
.content::-webkit-scrollbar {
    width: 8px;
}

.content::-webkit-scrollbar-track {
    background: transparent;
}

.content::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

.content::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

#tool-frame {
    border: none;
    border-radius: var(--border-radius);
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background: transparent;
}

/* Styles for categorized tool list */
.sidebar ul li.category-header {
    font-weight: 600;
    margin-top: 16px;
    margin-bottom: 6px;
    padding: 10px 24px;
    color: var(--text-primary);
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    cursor: pointer;
    position: relative;
    user-select: none;
    font-family: var(--font-mono);
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Category hue dot - information, not decoration: locates the color of the section */
.sidebar ul li.category-header .cat-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
    background: hsl(var(--hue) var(--cat-s) var(--cat-l));
}

.sidebar ul li.category-header .cat-count {
    margin-left: auto;
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0;
}

.sidebar ul li.category-header:hover {
    color: var(--primary);
}

/* Add triangle indicator */
.sidebar ul li.category-header::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 4px 0 4px 7px;
    border-color: transparent transparent transparent var(--text-muted);
    margin-right: 4px;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
    transform-origin: 3px center;
    flex-shrink: 0;
}

.sidebar ul li.category-header:hover::before {
    border-color: transparent transparent transparent var(--primary);
}

/* Rotate triangle down when expanded */
.sidebar ul li.category-header.expanded::before {
    transform: rotate(90deg);
}

/* Keep triangle right when collapsed */
.sidebar ul li.category-header.collapsed::before {
    transform: rotate(0deg);
}

.sidebar ul ul.nested-tool-list {
    padding-left: 12px;
    list-style: none;
    margin: 0;
    border-left: 2px solid var(--border);
    margin-left: 18px;
    padding-top: 4px;
    padding-bottom: 4px;
    transition: border-color var(--transition-fast);
}

.sidebar ul ul.nested-tool-list:hover {
    border-color: var(--primary);
}

/* Adjust nested link margin and padding */
.sidebar ul ul.nested-tool-list li a {
    margin: 2px 12px 2px 8px;
    padding: 8px 12px;
    font-size: 0.85em;
}

/* --- Common Tool Styles --- */

/* Mobile-only sidebar toggle (hidden on desktop via media query below) */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 10px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 768px) {
    .sidebar-header {
        justify-content: flex-start;
    }
}

/* General container for tool UI elements */
.tool-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 95%;
    max-width: 1200px;
    margin: 24px auto;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background-color: var(--surface);
    box-sizing: border-box;
    min-height: calc(100vh - 88px);
    box-shadow: 0 1px 2px var(--shadow-color);
}

/* Container for vertical layouts like JSON/YAML */
.tool-container-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: calc(100% - 30px);
    padding: 15px;
    box-sizing: border-box;
}

/* Section within a tool (e.g., input group, result area) */
.tool-section {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Space between elements within a section */
}

/* Section for side-by-side controls */
.tool-inline-controls {
    display: flex;
    gap: 12px; /* Space between controls */
    align-items: center; /* Align items vertically */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

/* Section for I/O textareas */
.tool-io-section {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0; /* Prevent flex overflow */
}

/* Styling for labels */
.tool-label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    color: var(--text-primary);
    font-size: 0.9em;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.2px;
}

/* Common input field styling */
.tool-input,
.tool-select,
.tool-textarea {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    font-size: 0.95em;
    box-sizing: border-box;
    width: 100%;
    background-color: var(--surface);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    transition: all var(--transition-fast);
}

.tool-input::placeholder,
.tool-textarea::placeholder {
    color: var(--text-secondary);
}

.tool-input:focus,
.tool-select:focus,
.tool-textarea:focus {
    border-color: var(--primary);
    outline: none;
    background-color: var(--surface);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Specific styling for different input types */
.tool-input[type="text"],
.tool-input[type="number"] {
    /* Specific styles if needed */
}

.tool-select {
    min-width: 140px;
    width: auto;
    flex-grow: 1;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    appearance: none;
}

.tool-textarea {
    flex-grow: 1;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

/* Button styling - minimalist solid instead of gradient */
.tool-button {
    padding: 10px 24px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.95em;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.3);
}

.tool-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.4);
}

.tool-button:active {
    transform: translateY(0);
}

.tool-button:disabled {
    background-color: var(--text-muted);
    color: white;
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
    transform: none;
}

/* Container for centered buttons */
.tool-controls {
    display: flex;
    justify-content: flex-start; /* Align buttons to the start */
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* Result display area */
.tool-result {
    margin-top: 6px;
    padding: 14px;
    background-color: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    word-wrap: break-word;
    white-space: pre-wrap;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    min-height: 2em;
    line-height: 1.6;
    color: var(--text-primary);
}

.tool-result ul {
    margin: 5px 0;
    padding-left: 25px;
}

.tool-result li {
    margin-bottom: 3px;
}

/* Error message styling */
.tool-error {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #EF4444;
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    font-size: 0.9em;
    margin-top: 8px;
    min-height: 1em;
    font-weight: 500;
}

/* Specific overrides if needed */
/* Unified Tool Header */
.tool-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.tool-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 2px;
    background-color: var(--primary);
    border-radius: 1px;
}

.tool-header h1 {
    margin: 0;
    font-size: 2em;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.tool-header p {
    margin: 10px 0 0;
    color: var(--text-secondary);
    font-size: 1em;
    font-weight: 400;
}

/* Adjustments for JSON/YAML converter layout */
.tool-container-vertical .tool-label {
    text-align: left; /* Align labels left */
}

.tool-container-vertical .tool-error {
    text-align: center;
}

/* --- Home hero (only visible on the tool-cards view) --- */
.home-hero {
    padding: 48px 36px 8px;
}

.home-hero h1 {
    margin: 0 0 10px;
    font-family: var(--font-mono);
    font-size: 2em;
    font-weight: 700;
    letter-spacing: -1px;
    color: var(--text-primary);
}

.home-hero h1 .brand-cursor {
    color: var(--primary);
}

.home-hero .hero-sub {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.6;
    max-width: 60ch;
}

.home-hero .hero-stats {
    display: flex;
    gap: 24px;
    margin-top: 16px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--text-secondary);
}

.home-hero .hero-stats strong {
    color: var(--text-primary);
    font-weight: 700;
    margin-right: 4px;
}

.hero-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 28px 36px 0;
}

/* Tool Cards Grid */
.tool-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    padding: 20px 36px 48px;
}

.tool-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 16px 18px 14px;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
    border-top: 2px solid hsl(var(--hue) var(--cat-s) var(--cat-l));
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow-color);
    border-color: hsl(var(--hue) var(--cat-s) var(--cat-l));
}

.tool-card h4 {
    margin: 0 0 6px;
    font-size: 1em;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--text-primary);
}

.tool-card p {
    margin: 0;
    font-size: 0.75em;
    color: var(--text-muted);
    line-height: 1.5;
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tool Category Section */
.tool-category-section {
    margin-bottom: 36px;
}

.tool-category-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 1.02em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.tool-category-title .cat-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: hsl(var(--hue) var(--cat-s) var(--cat-l));
    flex-shrink: 0;
    align-self: center;
}

.tool-category-title .cat-count {
    font-weight: 400;
    font-size: 0.82em;
    color: var(--text-muted);
}

.tool-category-title .cat-name-en {
    font-weight: 400;
    font-size: 0.8em;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Socket.IO Tester Styles --- */

.sio-config-grid,
.sio-interaction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.sio-transports .tool-checkbox-group {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 5px; /* Align with input field's top padding */
}

.tool-help {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.tool-input-group {
    display: flex;
    gap: 8px;
}

.tool-input-group .tool-input {
    flex-grow: 1;
}

.tool-label-inline {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.sio-subscriptions-list {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sio-subscription-tag {
    display: flex;
    align-items: center;
    background-color: var(--surface-hover);
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 13px;
}

.sio-subscription-tag button {
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 6px;
    font-size: 14px;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}

.sio-subscription-tag button:hover {
    color: var(--text-primary);
}

.tool-label-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.tool-button-sm {
    padding: 4px 10px;
    font-size: 12px;
    background-color: var(--secondary);
    border-radius: var(--border-radius);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tool-button-sm:hover {
    background-color: #475569;
}

.sio-log {
    border: 1px solid var(--border);
    padding: 12px;
    overflow-y: auto;
    background-color: var(--surface-hover);
    white-space: pre-wrap;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.sio-log .log-message {
    margin-bottom: 5px;
}

.sio-log .log-message.sent {
    color: var(--primary);
}

.sio-log .log-message.received {
    color: #10B981;
}

.sio-log .log-message.error {
    color: #EF4444;
}

.sio-log .log-message.status {
    color: #F97316;
}

/* New layout styles for Socket.IO tester */
.sio-layout-wrapper {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 16px;
    height: 100%; /* Make wrapper fill the container height */
}

.sio-config-panel {
    flex: 1; /* Take up 1 part of the space */
    min-width: 300px; /* Minimum width before wrapping */
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sio-interaction-panel {
    flex: 1.5; /* Take up 1.5 parts of the space, making it wider */
    min-width: 300px; /* Minimum width before wrapping */
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: calc(100% - 120px);
}

.sio-interaction-panel hr {
    display: none; /* Hide the hr on large screens */
}

.sio-log-section {
    flex-grow: 1; /* Allow this section to grow */
    display: flex;
    flex-direction: column;
    min-height: 0; /* Prevent flex overflow */
}

.sio-log {
    flex-grow: 1; /* Make the log div grow to fill available space */
    min-height: 150px; /* Ensure a minimum height */
    height: auto; /* Override fixed height */
}

/* On smaller screens, stack the columns */
@media (max-width: 768px) {
    .sio-layout-wrapper {
        flex-direction: column;
    }
    .sio-interaction-panel {
        height: auto;
    }
    .sio-interaction-panel hr {
        display: block; /* Show the hr on small screens */
    }
}

/* ===============================================
   RESPONSIVE DESIGN & ACCESSIBILITY
   =============================================== */

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Tablet and below */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
        --border-radius: 6px;
        --border-radius-sm: 4px;
    }

    .tool-container {
        padding: 20px;
        margin: 16px auto;
    }

    .tool-header h1 {
        font-size: 1.6em;
    }

    .home-hero {
        padding: 32px 24px 4px;
    }

    .hero-divider {
        margin: 20px 24px 0;
    }

    .tool-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
        padding: 16px 24px 32px;
    }
}

/* Mobile: sidebar collapses behind the menu button */
@media (max-width: 768px) {
    .sidebar {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(84vw, 320px);
        height: 100vh;
        z-index: 20;
        box-shadow: 12px 0 32px rgba(0, 0, 0, 0.18);
    }

    .container.sidebar-open .sidebar {
        display: block;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .content {
        height: 100vh;
    }

    .tool-container {
        padding: 16px;
        width: 100%;
    }

    .tool-header h1 {
        font-size: 1.4em;
    }

    .home-hero {
        padding: 24px 16px 4px;
    }

    .home-hero h1 {
        font-size: 1.5em;
    }

    .home-hero .hero-stats {
        flex-wrap: wrap;
        gap: 12px 20px;
    }

    .hero-divider {
        margin: 16px 16px 0;
    }

    .tool-cards-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px 16px 32px;
    }

    .tool-button {
        width: 100%;
        padding: 12px 20px;
    }

    .sidebar ul li a {
        padding: 10px 16px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .tool-header h1 {
        font-size: 1.2em;
    }

    .tool-header p {
        font-size: 0.9em;
    }

    .tool-container {
        padding: 12px;
    }

    .sidebar-header h2 {
        font-size: 1.1em;
    }

    .home-hero h1 {
        font-size: 1.3em;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border: var(--text-secondary);
    }

    .tool-input,
    .tool-select,
    .tool-textarea {
        border-width: 2px;
    }

    .sidebar ul li a.active {
        border-left-width: 4px;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.tool-button:focus-visible {
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .sidebar {
        display: none;
    }

    .container {
        padding: 0;
    }

    .tool-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ===============================================
   THEME SWITCHER
   =============================================== */

.theme-switcher {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 1px 2px var(--shadow-color);
}

.theme-switcher:hover {
    background-color: var(--surface-hover);
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15);
}

.theme-switcher svg {
    width: 20px;
    height: 20px;
    transition: all var(--transition-normal);
}

/* Sun icon uses stroke */
.theme-switcher .theme-icon-sun {
    stroke: var(--primary);
    fill: none;
}

.theme-switcher:hover .theme-icon-sun {
    stroke: var(--primary-dark);
}

/* Moon icon uses fill */
.theme-switcher .theme-icon-moon {
    fill: var(--primary);
}

.theme-switcher:hover .theme-icon-moon {
    fill: var(--primary-dark);
}

/* Icon rotation animation */
.theme-switcher.rotating svg {
    animation: rotate-icon 0.5s ease-in-out;
}

@keyframes rotate-icon {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(0.8); }
    100% { transform: rotate(360deg) scale(1); }
}

/* Sun icon (light mode) */
.theme-icon-sun {
    display: block;
}

[data-theme="dark"] .theme-icon-sun {
    display: none;
}

/* Moon icon (dark mode) */
.theme-icon-moon {
    display: none;
}

[data-theme="dark"] .theme-icon-moon {
    display: block;
}

/* Theme switcher in sidebar header */
.sidebar-header .theme-switcher {
    width: 36px;
    height: 36px;
}

.sidebar-header .theme-switcher svg {
    width: 18px;
    height: 18px;
}
