:root {
    /* Hacker/Tech Theme Palette */
    --bg-color: #0a0a0a;
    /* Deep Black */
    --surface-color: #111111;
    /* Slightly lighter black */
    --text-primary: #e0e0e0;
    /* Off-white for readability */
    --text-secondary: #a0a0a0;
    /* Grey for secondary text */

    --primary-color: #00ff41;
    /* Matrix Green */
    --primary-hover: #00cc33;
    --accent-color: #00b8ff;
    /* Cyber Blue */
    --danger-color: #ff0055;
    /* Cyber Red */
    --warning-color: #ffcc00;

    --border-color: #333333;
    --border-active: #00ff41;

    /* Performance-focused Shadows (no heavy blurs) */
    --shadow-sm: 0 1px 0 0 rgba(255, 255, 255, 0.1);
    --shadow-glow: 0 0 10px rgba(0, 255, 65, 0.2);

    /* Typography - Monospace for that terminal feel */
    --font-mono: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
    --font-sans: var(--font-mono);
    /* Force mono everywhere for hacker vibe */
}

/**
 * Navigation Container
 * 
 * Reserve space for navigation to prevent layout shift
 * Navigation will be loaded before page render
 */
#navigation-container {
    min-height: 3.5rem;
    /* Reserve space for navigation bar height */
}

[data-theme="gray"] {
    --bg-color: #f5f5f5;
    --surface-color: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --primary-color: #007bff;
    /* Blue for a more standard look */
    --primary-hover: #0056b3;
    --accent-color: #17a2b8;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --border-color: #dddddd;
    --border-active: #007bff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 10px rgba(0, 123, 255, 0.2);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Page content spacing for navigation */
body>.container,
body>.main-content {
    padding-top: 2rem;
}

/* Subtle page background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(0, 255, 65, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 255, 65, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

[data-theme="gray"] body::before {
    background-image:
        radial-gradient(circle at 20% 50%, rgba(0, 123, 255, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 123, 255, 0.015) 0%, transparent 50%);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.1s ease;
}

textarea.form-control {
    min-height: 80px;
    max-height: 600px;
    overflow-y: auto;
    resize: vertical;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border: 1px solid var(--bg-color);
}

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

/* Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: var(--shadow-glow);
}

.card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.card:hover::before {
    opacity: 1;
}

.tool-card {
    display: block;
    /* Make anchor tag behave like a block */
    text-decoration: none;
    /* Remove default underline */
    color: inherit;
    cursor: pointer;
}

.tool-card h3 {
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.tool-card:hover h3 {
    color: var(--primary-color);
}

.tool-link-indicator {
    display: inline-block;
    margin-top: 1rem;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 500;
    transition: transform 0.2s ease;
}

.tool-card:hover .tool-link-indicator {
    transform: translateX(5px);
    text-decoration: underline;
}

/* Navigation Styles */
.main-navigation {
    background: rgba(10, 10, 10, 0.95);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(5px);
    /* Minimal blur for performance */
}

/* Removed duplicate - using the one below with better styling */

/* Unified button styles for all navigation buttons */
/**
 * Unified Navigation Button Styles
 * 
 * All navigation buttons (tools dropdown, language toggle, theme toggle, notes)
 * share the same base styles for visual consistency.
 * 
 * Common properties:
 * - Transparent background with visible border
 * - Consistent padding and sizing (36x36px minimum)
 * - Smooth transitions on hover
 * - Monospace font
 */
.theme-toggle-btn,
.lang-toggle-btn,
.nav-dropdown-btn,
.notes-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-mono);
    cursor: pointer;
    padding: 0.4rem 0.7rem;
    transition: all 0.2s ease;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    margin: 0;
    /* Remove all margins, use gap in parent (.nav-notes) instead */
}

/**
 * Unified Hover State
 * 
 * All navigation buttons share the same hover effect:
 * - Border color changes to primary color
 * - Text/icon color changes to primary color
 * - Subtle background highlight
 * - No transform effects for consistency
 */
.theme-toggle-btn:hover,
.lang-toggle-btn:hover,
.nav-dropdown-btn:hover,
.nav-dropdown-btn.active,
.notes-toggle-btn:hover,
.notes-toggle-btn.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(0, 255, 65, 0.05);
    transform: none;
    /* Remove scale transform for consistency */
}

/* Light theme hover background */
[data-theme="gray"] .theme-toggle-btn:hover,
[data-theme="gray"] .lang-toggle-btn:hover,
[data-theme="gray"] .nav-dropdown-btn:hover,
[data-theme="gray"] .nav-dropdown-btn.active,
[data-theme="gray"] .notes-toggle-btn:hover,
[data-theme="gray"] .notes-toggle-btn.active {
    background: rgba(0, 123, 255, 0.08);
}

/**
 * Icon-Only Button Adjustments
 * 
 * Theme and notes buttons display emoji/icons, so they need slightly larger
 * font size for better visibility and touch targets.
 */
.theme-toggle-btn,
.notes-toggle-btn {
    font-size: 1.1rem;
    /* Slightly larger for emoji/icons */
}

/**
 * Text Button Adjustments
 * 
 * Tools dropdown button has text content, so it needs gap for spacing
 * between text and dropdown arrow.
 */
.nav-dropdown-btn {
    gap: 0.5rem;
    /* Space between text and dropdown arrow */
    justify-content: space-between;
    /* Push arrow to the right */
    min-width: auto;
    /* Allow button to size based on content */
    padding: 0.4rem 0.8rem;
    /* Slightly more horizontal padding for text button */
}

/* Navigation Styles - Elegant Visual Distinction */
.main-navigation {
    background: linear-gradient(180deg,
            rgba(10, 14, 39, 0.98) 0%,
            rgba(15, 20, 50, 0.95) 100%);
    border-bottom: 1px solid transparent;
    border-image: linear-gradient(90deg,
            transparent 0%,
            var(--primary-color) 50%,
            transparent 100%) 1;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 8px 24px rgba(0, 255, 65, 0.08),
        inset 0 -1px 0 rgba(0, 255, 65, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px) saturate(180%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-navigation::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(0, 255, 65, 0.3) 20%,
            rgba(0, 255, 65, 0.6) 50%,
            rgba(0, 255, 65, 0.3) 80%,
            transparent 100%);
    animation: navGlow 3s ease-in-out infinite;
}

@keyframes navGlow {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Gray Theme Navigation */
[data-theme="gray"] .main-navigation {
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(248, 249, 250, 0.95) 100%);
    border-image: linear-gradient(90deg,
            transparent 0%,
            rgba(0, 123, 255, 0.3) 50%,
            transparent 100%) 1;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 4px 16px rgba(0, 123, 255, 0.06),
        inset 0 -1px 0 rgba(0, 123, 255, 0.1);
}

[data-theme="gray"] .main-navigation::before {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(0, 123, 255, 0.2) 20%,
            rgba(0, 123, 255, 0.4) 50%,
            rgba(0, 123, 255, 0.2) 80%,
            transparent 100%);
}

/**
 * Navigation Container
 * 
 * Main container for navigation bar. Uses flexbox with space-between to separate
 * left (brand/logo) and right (tools dropdown + buttons) sections.
 * 
 * Layout:
 * - width: 100% - full width to allow left/right alignment
 * - padding: 1rem 2rem - provides spacing from screen edges
 * - justify-content: space-between - pushes left and right sections to edges
 * 
 * This ensures:
 * - Left side (nav-brand) is flush with left padding edge
 * - Right side (nav-notes) is flush with right padding edge
 */
.nav-container {
    width: 100%;
    margin: 0;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-sizing: border-box;
}

/* Removed media query - no longer needed with full-width layout */

/**
 * Navigation Right Side Container
 * 
 * Contains tools dropdown, language toggle, theme toggle, and notes buttons.
 * All right-side navigation elements are grouped here.
 * 
 * Layout strategy:
 * - display: flex - arranges tools dropdown and buttons horizontally
 * - align-items: center - vertically centers all items
 * - gap: 0.5rem - provides consistent spacing between elements
 * - flex-shrink: 0 - prevents shrinking on small screens
 * 
 * Since .nav-container uses justify-content: space-between, this container
 * is automatically pushed to the right edge, flush with the right padding.
 */
.nav-notes {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    /* No margins needed - justify-content handles positioning */
    flex-shrink: 0;
    /* Prevent shrinking on small screens */
}

/* Removed duplicate .lang-toggle-btn styles - now unified above */

.nav-logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.nav-logo::before {
    content: '> ';
}

/**
 * Tools Dropdown Container
 * 
 * Contains the "🛠️ 工具集合" dropdown button.
 * Now positioned inside .nav-notes on the right side of the navigation bar.
 * 
 * Layout:
 * - position: relative - for absolute positioning of dropdown content
 * - No margin needed - gap in parent (.nav-notes) handles spacing
 * - flex-shrink: 0 - prevents shrinking to maintain button visibility
 */
.nav-dropdown {
    position: relative;
    /* No margin needed - parent gap handles spacing */
    flex-shrink: 0;
    /* Prevent shrinking to maintain button visibility */
}

/* Removed duplicate .nav-dropdown-btn styles - now unified above */

.nav-dropdown-content {
    display: none;
    /* Hidden by default */
    position: absolute;
    top: 100%;
    right: 0;
    /* Align to the right of the parent */
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    padding: 0;
    min-width: 280px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.nav-dropdown-content.show {
    display: block !important;
}

.dropdown-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.75rem 1rem 0.25rem;
    border-bottom: 1px solid #222;
}

.dropdown-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    border-left: 2px solid transparent;
}


.dropdown-link:hover {
    background: rgba(0, 255, 65, 0.1);
    padding-left: 1.5rem;
    border-left: 2px solid var(--primary-color);
}

/* Notes Dropdown Styles */
.notes-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 0.5rem;
}

/* Removed duplicate .notes-toggle-btn styles - now unified above */

.notes-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    padding: 0.5rem 0;
    min-width: 180px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    margin-top: 0.5rem;
}

.notes-dropdown-content.show {
    display: block !important;
}

.notes-dropdown-content a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.notes-dropdown-content a:hover {
    background: rgba(0, 255, 65, 0.1);
    padding-left: 1.5rem;
    color: var(--primary-color);
}

/* Footer */
footer {
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Glitch Effect Utility (Optional, keep simple) */
.glitch-text {
    position: relative;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}