/* Nanogear - Custom Styles (shadcn-inspired) */

/* CSS Variables - Light Theme */
:root {
    --background: 0 0% 100%;
    --foreground: 240 10% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 240 10% 3.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 240 10% 3.9%;
    --primary: 240 5.9% 10%;
    --primary-foreground: 0 0% 98%;
    --secondary: 240 4.8% 95.9%;
    --secondary-foreground: 240 5.9% 10%;
    --muted: 240 4.8% 95.9%;
    --muted-foreground: 240 4% 60%;
    --accent: 240 4.8% 95.9%;
    --accent-foreground: 240 5.9% 10%;
    --border: 240 5.9% 90%;
    --input: 240 5.9% 90%;
    --ring: 240 5.9% 10%;
    --radius: 0.5rem;
    
    /* Custom additions */
    --header-height: 56px;
    --sidebar-width: 280px;
}

/* Dark Theme */
[data-theme="dark"] {
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 10% 3.9%;
    --card-foreground: 0 0% 98%;
    --popover: 240 10% 3.9%;
    --popover-foreground: 0 0% 98%;
    --primary: 0 0% 98%;
    --primary-foreground: 240 5.9% 10%;
    --secondary: 240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 40%;
    --accent: 240 3.7% 15.9%;
    --accent-foreground: 0 0% 98%;
    --border: 240 3.7% 15.9%;
    --input: 240 3.7% 15.9%;
    --ring: 240 4.9% 83.9%;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    max-width: 100vw;
}

/* Prevent horizontal overflow on mobile */
.app-container,
.main-content,
.tool-container {
    max-width: 100%;
    overflow-x: hidden;
}

/* Material Symbols */
.material-symbols-outlined,
.material-symbols-rounded {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    user-select: none;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: hsl(var(--background));
    border-bottom: 1px solid hsl(var(--border));
    z-index: 50;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1rem;
    max-width: 100%;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: hsl(var(--foreground));
}

.header-logo-text {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.header-logo-svg {
    height: 20px;
    width: auto;
}

/* Logo fill colors */
.logo-fill {
    fill: hsl(240 5% 25%);
}

[data-theme="dark"] .logo-fill {
    fill: hsl(240 5% 85%);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Search Hint Button */
.search-hint-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem 0.375rem 0.5rem;
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.search-hint-btn:hover {
    background: hsl(var(--accent));
    border-color: hsl(var(--ring));
    color: hsl(var(--foreground));
}

.search-hint-btn .material-symbols-outlined {
    font-size: 18px;
}

.search-hint-text {
    display: none;
}

@media (min-width: 640px) {
    .search-hint-text {
        display: inline;
    }
}

.search-hint-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.25rem;
    font-family: inherit;
    font-size: 0.6875rem;
    font-weight: 500;
    background: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    color: hsl(var(--muted-foreground));
}

.search-hint-btn:hover .search-hint-kbd {
    border-color: hsl(var(--ring));
}

/* Theme Toggle Icons */
.theme-icon-dark {
    display: none;
}

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

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

/* App Container */
.app-container {
    display: flex;
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: hsl(var(--background));
    border-right: 1px solid hsl(var(--border));
    overflow-y: auto;
    z-index: 40;
    transition: transform 0.2s ease;
}

.sidebar-content {
    padding: 1rem;
}

.sidebar-search {
    margin-bottom: 1rem;
}

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

.search-icon {
    position: absolute;
    left: 0.875rem;
    color: hsl(var(--muted-foreground));
    font-size: 18px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 2.5rem;
    padding: 0 0.75rem 0 2.625rem;
    font-size: 0.875rem;
    background: hsl(var(--secondary));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    color: hsl(var(--foreground));
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.search-input::placeholder {
    color: hsl(var(--muted-foreground));
}

/* Search Clear Button */
.search-clear-btn {
    position: absolute;
    right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: none;
    background: hsl(var(--muted));
    border-radius: 50%;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.search-clear-btn:hover {
    background: hsl(var(--accent));
    color: hsl(var(--foreground));
}

.search-clear-btn .material-symbols-outlined {
    font-size: 14px;
}

.search-clear-btn.hidden {
    display: none;
}

/* Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.nav-category-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
}

.nav-category-icon {
    font-size: 16px;
    color: hsl(var(--muted-foreground));
}

.nav-category-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--muted-foreground));
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    transition: background-color 0.15s;
}

.nav-link:hover {
    background: hsl(var(--accent));
}

.nav-link.active {
    background: hsl(var(--accent));
    font-weight: 500;
}

.nav-link-icon {
    font-size: 18px;
    color: hsl(var(--muted-foreground));
}

.nav-link.active .nav-link-icon {
    color: hsl(var(--foreground));
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: calc(100vh - var(--header-height));
}

/* Tool Container */
.tool-container {
    max-width: 900px;
    margin: 0 auto;
}

.tool-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

.tool-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: hsl(var(--foreground));
    margin: 0 0 0.5rem 0;
}

.tool-title-icon {
    font-size: 28px;
    color: hsl(var(--muted-foreground));
}

.tool-description {
    color: hsl(var(--muted-foreground));
    font-size: 0.95rem;
    margin: 0;
}

/* Share Tool Button */
.share-tool-btn {
    flex-shrink: 0;
}

/* Tool Header Buttons alignment */
.tool-header .favorite-tool-btn,
.tool-header .share-tool-btn {
    align-self: flex-start;
}

.share-tool-btn.shared {
    background: hsl(142 76% 36%);
    color: white;
}

.share-tool-btn.shared .material-symbols-outlined::before {
    content: 'check';
}

@media (max-width: 480px) {
    .share-btn-text {
        display: none;
    }
    
    .share-tool-btn {
        padding: 0.5rem;
    }
}

/* Cards */
.tool-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
}

.tool-card + .tool-card {
    margin-top: 1rem;
}

.card-header {
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin: 0;
}

.card-description {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin: 0.25rem 0 0 0;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    background: hsl(var(--background));
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    color: hsl(var(--foreground));
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.form-textarea {
    min-height: 150px;
    resize: vertical;
    font-family: 'JetBrains Mono', monospace;
}

.form-input-mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Select */
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: background-color 0.15s, opacity 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.btn-secondary:hover:not(:disabled):not(.active) {
    background: hsl(var(--accent));
}

.btn-ghost {
    background: transparent;
    color: hsl(var(--foreground));
}

.btn-ghost:hover:not(:disabled):not(.active) {
    background: hsl(var(--accent));
}

.btn-outline {
    background: transparent;
    border: 1px solid hsl(var(--input));
    color: hsl(var(--foreground));
}

.btn-outline:hover:not(:disabled) {
    background: hsl(var(--accent));
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
}

.btn-sm {
    height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    height: 2.75rem;
    padding: 0 1.5rem;
    font-size: 1rem;
}

/* Button Groups */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-group .btn.active,
.btn.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-group .btn.active:hover,
.btn.active:hover {
    opacity: 0.9;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid hsl(var(--border));
    margin-bottom: 1rem;
    gap: 0;
}

.tab {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

.tab:hover {
    color: hsl(var(--foreground));
}

.tab.active {
    color: hsl(var(--foreground));
    border-bottom-color: hsl(var(--foreground));
}

/* Range Slider */
.form-range {
    width: 100%;
    height: 0.5rem;
    background: hsl(var(--secondary));
    border-radius: 9999px;
    appearance: none;
    cursor: pointer;
    touch-action: none; /* Prevent scrolling while dragging */
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    background: hsl(var(--primary));
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 2px solid hsl(var(--background));
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.form-range::-moz-range-thumb {
    width: 1.25rem;
    height: 1.25rem;
    background: hsl(var(--primary));
    border: 2px solid hsl(var(--background));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Mobile Touch-Friendly Slider Enhancements */
@media (pointer: coarse), (max-width: 768px) {
    .form-range {
        height: 0.625rem;
        padding: 0.5rem 0;
        margin: 0.5rem 0;
        background-clip: content-box;
        /* Larger touch area via pseudo-element technique - applied via wrapper */
    }
    
    .form-range::-webkit-slider-thumb {
        width: 1.75rem;
        height: 1.75rem;
        border-width: 3px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }
    
    .form-range::-webkit-slider-thumb:hover,
    .form-range::-webkit-slider-thumb:active {
        transform: scale(1.15);
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
    }
    
    .form-range::-moz-range-thumb {
        width: 1.75rem;
        height: 1.75rem;
        border-width: 3px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }
}

/* Slider wrapper for enhanced touch area and value tooltip */
.slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.slider-wrapper .form-range {
    flex: 1;
}

.slider-value {
    min-width: 3.5rem;
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* Active/dragging state for touch feedback */
.form-range.is-dragging::-webkit-slider-thumb {
    transform: scale(1.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    background: hsl(var(--primary));
}

.form-range.is-dragging::-moz-range-thumb {
    transform: scale(1.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Tooltip for slider value on mobile */
.slider-tooltip {
    position: absolute;
    top: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: hsl(var(--foreground));
    color: hsl(var(--background));
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    pointer-events: none;
    z-index: 10;
}

.slider-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid hsl(var(--foreground));
}

.slider-wrapper.show-tooltip .slider-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Track highlight (filled portion) */
.form-range {
    background: linear-gradient(
        to right,
        hsl(var(--primary)) 0%,
        hsl(var(--primary)) var(--slider-progress, 0%),
        hsl(var(--secondary)) var(--slider-progress, 0%),
        hsl(var(--secondary)) 100%
    );
}

@media (pointer: coarse), (max-width: 768px) {
    .form-range {
        background-clip: content-box;
        background: linear-gradient(
            to right,
            hsl(var(--primary)) 0%,
            hsl(var(--primary)) var(--slider-progress, 0%),
            hsl(var(--secondary)) var(--slider-progress, 0%),
            hsl(var(--secondary)) 100%
        );
    }
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    width: 2.75rem;
    height: 1.5rem;
    background: hsl(var(--input));
    border-radius: 9999px;
    transition: background-color 0.15s;
    position: relative;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.25rem;
    height: 1.25rem;
    background: white;
    border-radius: 50%;
    transition: transform 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-input:checked + .toggle-slider {
    background: hsl(var(--primary));
}

.toggle-input:checked + .toggle-slider::after {
    transform: translateX(1.25rem);
}

/* Dark mode toggle - dimmer inactive state, brighter active state */
[data-theme="dark"] .toggle-slider {
    background: hsl(240 5% 15%);
}

[data-theme="dark"] .toggle-slider::after {
    background: hsl(240 5% 30% / 1);
}

[data-theme="dark"] .toggle-input:checked + .toggle-slider {
    background: hsl(240 5% 40%);
}

[data-theme="dark"] .toggle-input:checked + .toggle-slider::after {
    background: hsl(0 0% 95%);
}

.toggle-label {
    font-size: 0.875rem;
    color: hsl(var(--foreground));
}

/* Switch (compact toggle variant used in tools) */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: hsl(var(--input));
    transition: 0.2s;
    border-radius: 22px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

input:checked + .switch-slider {
    background-color: hsl(var(--primary));
}

input:checked + .switch-slider:before {
    transform: translateX(18px);
}

/* Dark mode for switch-slider */
[data-theme="dark"] .switch-slider {
    background: hsl(240 5% 15%);
}

[data-theme="dark"] .switch-slider:before {
    background: hsl(240 5% 30%);
}

[data-theme="dark"] input:checked + .switch-slider {
    background: hsl(240 5% 40%);
}

[data-theme="dark"] input:checked + .switch-slider:before {
    background: hsl(0 0% 95%);
}

/* Checkbox */
.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-input {
    width: 1rem;
    height: 1rem;
    accent-color: hsl(var(--primary));
}

.checkbox-label {
    font-size: 0.875rem;
    color: hsl(var(--foreground));
}

/* Output Display */
.output-display {
    background: hsl(var(--secondary));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
    word-break: break-all;
}

.output-display-lg {
    font-size: 1.5rem;
    text-align: center;
    padding: 1.5rem;
}

/* Copy Button */
.copy-btn {
    position: relative;
}

.copy-btn .copied-text,
[data-copy] .copied-text {
    display: none;
}

.copy-btn.copied .copy-text,
[data-copy].copied .copy-text {
    display: none;
}

.copy-btn.copied .copied-text,
[data-copy].copied .copied-text {
    display: inline;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.stat-item {
    background: hsl(var(--secondary));
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    font-family: 'JetBrains Mono', monospace;
}

.stat-label {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Split View */
.split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    min-height: 400px;
}

.split-pane {
    display: flex;
    flex-direction: column;
}

.split-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.split-pane-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
}

/* Preview Frame */
.preview-frame {
    flex: 1;
    background: white;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
}

/* Upload Area */
.upload-area {
    border: 2px dashed hsl(var(--border));
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: hsl(var(--ring));
    background: hsl(var(--accent));
}

.upload-icon {
    font-size: 48px;
    color: hsl(var(--muted-foreground));
    margin-bottom: 1rem;
}

.upload-text {
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* Image Preview */
.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius);
    margin: 1rem 0;
}

/* Progress Bar */
.progress {
    width: 100%;
    height: 0.5rem;
    background: hsl(var(--secondary));
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: hsl(var(--primary));
    transition: width 0.3s ease;
}

/* Strength Indicator */
.strength-indicator {
    display: flex;
    gap: 4px;
    margin-top: 0.5rem;
}

.strength-segment {
    flex: 1;
    height: 4px;
    background: hsl(var(--secondary));
    border-radius: 2px;
    transition: background-color 0.2s;
}

.strength-segment.active.weak {
    background: #ef4444;
}

.strength-segment.active.fair {
    background: #f59e0b;
}

.strength-segment.active.good {
    background: #22c55e;
}

.strength-segment.active.strong {
    background: #22c55e;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: toast-in 0.2s ease;
    max-width: 320px;
}

.toast-success {
    border-left: 3px solid #22c55e;
}

.toast-error {
    border-left: 3px solid #ef4444;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* SEO Description Section */
.seo-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid hsl(var(--border));
}

.seo-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: hsl(var(--foreground));
}

.seo-section h3 {
    font-size: 1rem;
    font-weight: 500;
    margin: 1.5rem 0 0.75rem;
    color: hsl(var(--foreground));
}

.seo-section p,
.seo-section li {
    color: hsl(var(--muted-foreground));
    line-height: 1.7;
}

.seo-section ul {
    padding-left: 1.5rem;
}

.seo-section li {
    margin-bottom: 0.5rem;
}

/* Mobile Sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .tool-title {
        font-size: 1.5rem;
    }
    
    .split-view {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .header-logo-text {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: hsl(var(--muted-foreground)) !important;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.grid { display: grid; }
.w-full { width: 100%; }

/* Syntax Highlighting (for paste/JSON) */
.syntax-string { color: #22c55e; }
.syntax-number { color: #3b82f6; }
.syntax-boolean { color: #f59e0b; }
.syntax-null { color: #6b7280; }
.syntax-key { color: #a855f7; }

[data-theme="dark"] .syntax-string { color: #4ade80; }
[data-theme="dark"] .syntax-number { color: #60a5fa; }
[data-theme="dark"] .syntax-boolean { color: #fbbf24; }
[data-theme="dark"] .syntax-null { color: #9ca3af; }
[data-theme="dark"] .syntax-key { color: #c084fc; }


/* Homepage Styles */
.home-hero {
    text-align: center;
    padding: 3rem 1rem;
    margin-bottom: 2rem;
}

.home-hero-content {
    max-width: 600px;
    margin: 0 auto;
}

.home-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0 0 0.75rem 0;
    color: hsl(var(--foreground));
}

.home-logo-icon {
    font-size: 2.5rem;
    color: hsl(var(--foreground));
}

.home-logo-svg {
    height: 2.5rem;
    width: auto;
}

.home-subtitle {
    font-size: 1.125rem;
    color: hsl(var(--muted-foreground));
    margin: 0 0 2rem 0;
    line-height: 1.6;
}

.home-search {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

.home-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: hsl(var(--muted-foreground));
    font-size: 20px;
    pointer-events: none;
}

.home-search-input {
    width: 100%;
    height: 3rem;
    padding: 0 1rem 0 3rem;
    font-size: 1rem;
    background: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: 9999px;
    color: hsl(var(--foreground));
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.home-search-input:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.1);
}

.home-search-input::placeholder {
    color: hsl(var(--muted-foreground));
}

/* Stats */
.home-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 1.5rem;
    margin-bottom: 3rem;
    background: hsl(var(--secondary));
    border-radius: var(--radius);
}

.home-stat {
    text-align: center;
}

.home-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}

.home-stat-label {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Category Sections */
.home-category {
    margin-bottom: 3rem;
}

.home-category-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin: 0 0 1.25rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid hsl(var(--border));
}

.home-category-title .material-symbols-outlined {
    font-size: 22px;
    color: hsl(var(--muted-foreground));
}

/* Tools Grid */
.home-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Homepage Tool Card (distinct from .tool-card used in tools) */
.home-tool-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.home-tool-card:hover {
    border-color: hsl(var(--ring));
    box-shadow: 0 4px 12px hsl(var(--foreground) / 0.05);
    transform: translateY(-2px);
}

.home-tool-card-icon {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--secondary));
    border-radius: var(--radius);
}

.home-tool-card-icon .material-symbols-outlined {
    font-size: 20px;
    color: hsl(var(--foreground));
}

.home-tool-card-content {
    flex: 1;
    min-width: 0;
}

.home-tool-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin: 0 0 0.25rem 0;
}

.home-tool-card-description {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-tool-card-arrow {
    flex-shrink: 0;
    font-size: 18px;
    color: hsl(var(--muted-foreground));
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.15s, transform 0.15s;
}

.home-tool-card:hover .home-tool-card-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Footer */
.home-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    border-top: 1px solid hsl(var(--border));
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

.home-footer p {
    margin: 0 0 0.5rem 0;
}

.home-footer-links a {
    color: hsl(var(--muted-foreground));
    text-decoration: none;
}

.home-footer-links a:hover {
    color: hsl(var(--foreground));
}

/* Responsive Homepage */
@media (max-width: 768px) {
    .home-title {
        font-size: 2rem;
    }
    
    .home-logo-icon {
        font-size: 2rem;
    }
    
    .home-logo-svg {
        height: 2rem;
    }
    
    .home-subtitle {
        font-size: 1rem;
    }
    
    .home-stats {
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .home-stat-value {
        font-size: 1.25rem;
    }
    
    .home-tools-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .home-hero {
        padding: 2rem 0.5rem;
    }
    
    .home-stats {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .home-stat {
        flex: 1;
        min-width: 80px;
    }
}

/* Favorites Section */
.favorites-section {
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid hsl(var(--border));
}

.favorites-section .nav-category-header {
    opacity: 0.8;
}

.favorites-section .nav-category-icon {
    color: #f59e0b;
}

.favorites-section .nav-link {
    padding: 0.5rem 0.75rem;
}

.favorites-section .nav-link-icon {
    font-size: 18px;
}

.favorites-section .nav-link-text {
    font-size: 0.8125rem;
}

.favorite-item {
    position: relative;
}

.favorite-item .nav-link {
    padding-right: 2rem;
}

.favorite-remove-btn {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    background: transparent;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    border-radius: var(--radius);
}

.favorite-item:hover .favorite-remove-btn {
    opacity: 1;
}

.favorite-remove-btn:hover {
    color: hsl(var(--destructive, 0 84% 60%));
    background: hsl(var(--destructive, 0 84% 60%) / 0.1);
}

.favorite-remove-btn .material-symbols-outlined {
    font-size: 14px;
}

/* Favorite Tool Button */
.favorite-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.15s ease;
}

.favorite-tool-btn.is-favorited {
    background: hsl(45 93% 47% / 0.15);
    border-color: hsl(45 93% 47% / 0.3);
    color: hsl(45 93% 37%);
}

.favorite-tool-btn.is-favorited .material-symbols-outlined {
    color: #f59e0b;
}

.favorite-tool-btn:hover:not(.is-favorited) {
    border-color: hsl(45 93% 47% / 0.5);
}

@media (max-width: 640px) {
    .favorite-btn-text {
        display: none;
    }
}

/* Service Worker Update Notification */
.sw-update-notification {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: slideUp 0.3s ease-out;
}

.sw-update-notification .material-symbols-outlined {
    color: hsl(var(--primary));
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 1rem);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@media (max-width: 640px) {
    .sw-update-notification {
        left: 1rem;
        right: 1rem;
        transform: none;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: hsl(38 92% 50%);
    color: hsl(0 0% 100%);
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 1000;
    display: none;
}

.offline-indicator.visible {
    display: block;
}
