/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --background: #ffffff;
    --surface: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Light mode (explicit) */
[data-theme="light"] {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --background: #ffffff;
    --surface: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark mode variables */
[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #94a3b8;
    --secondary-hover: #64748b;
    --background: #0f172a;
    --surface: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border: #334155;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Automatic dark mode based on system preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --primary-color: #3b82f6;
        --primary-hover: #2563eb;
        --secondary-color: #94a3b8;
        --secondary-hover: #64748b;
        --background: #0f172a;
        --surface: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --border: #334155;
        --success: #10b981;
        --error: #ef4444;
        --warning: #f59e0b;
        --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--surface);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Navigation */
.navbar {
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

[data-theme="dark"] .navbar {
    background-color: rgba(59, 130, 246, 0.95);
    border-bottom: 1px solid #3b82f6;
}

[data-theme="dark"] .nav-link {
    color: #e0e7ff;
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
    color: #ffffff;
}

[data-theme="dark"] .nav-link.active::after {
    background-color: #60a5fa;
}

[data-theme="dark"] .nav-logo {
    color: #ffffff;
}

[data-theme="dark"] .nav-toggle span {
    background-color: #e0e7ff;
}

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

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-logo:hover {
    color: var(--primary-hover);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    gap: 4px;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

/* Main Website Link Styling */
.nav-link-main-site {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.external-link-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-link-main-site:hover .external-link-icon {
    opacity: 1;
}

/* Mode Switch Button */
.mode-switch {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-secondary);
    font-size: 1.25rem;
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    margin-left: 1rem;
}

.mode-switch:hover {
    color: var(--primary-color);
    background-color: var(--surface);
}

.mode-switch:active {
    transform: scale(0.95);
}

.mode-switch svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    stroke: currentColor;
}

.mode-icon-light,
.mode-icon-dark {
    transition: opacity 0.2s;
}


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

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

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

.tool-card {
    background: var(--background);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.tool-card h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.tool-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

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

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

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

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

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn:disabled,
.btn.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Forms */
.calculator-container,
.password-generator-container,
.qr-decoder-container {
    background: var(--background);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    margin-top: 2rem;
    position: relative;
    transition: transform 0.3s ease, width 0.3s ease, padding 0.3s ease;
    overflow: visible;
}

.calculator-container.collapsed {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%) translateX(-100%);
    width: 300px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    z-index: 1000;
    max-height: 80vh;
    overflow: visible;
    margin-top: 0;
    cursor: pointer;
    margin-left: 0;
}

.calculator-container.collapsed input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.calculator-container.collapsed input[type="number"]::-webkit-outer-spin-button,
.calculator-container.collapsed input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.calculator-container.collapsed .calculator-form {
    display: none;
}


.toggle-calculator-btn {
    position: absolute;
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 60px;
    left: auto;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1001;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    line-height: 1;
    max-height: 60px;
    min-height: 60px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.toggle-calculator-btn::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.toggle-calculator-btn.visible {
    opacity: 1;
    pointer-events: all;
}

.toggle-calculator-btn:hover {
    background: var(--primary-hover);
}

.arrow-icon {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
    display: inline-block;
    line-height: 1;
    margin: 0;
    padding: 0;
    overflow: visible;
}

.calculator-container.collapsed .arrow-icon {
    transform: rotate(0deg);
}

.calculator-container:not(.collapsed) .arrow-icon {
    transform: rotate(180deg);
}

.calculator-form,
.password-form {
    max-width: 800px;
}

.form-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 1rem;
    padding-bottom: 0;
}

.form-section h2 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input[type="number"],
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
    background-color: var(--background);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-with-prefix:focus-within input {
    border-left-color: var(--primary-color);
}

.input-with-prefix:focus-within .input-prefix {
    border-color: var(--primary-color);
    border-right-color: transparent;
}

.form-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: transparent;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.strength-slider {
    background: linear-gradient(to right, #ef4444 0%, #ef4444 4.35%, #f97316 4.35%, #f97316 8.7%, #10b981 8.7%, #10b981 26.1%, #059669 26.1%, #059669 100%);
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.form-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    position: relative;
    z-index: 1;
}

.form-group input[type="range"]::-moz-range-track {
    background: transparent;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.input-with-prefix {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-prefix {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    background-color: var(--surface);
    color: var(--text-secondary);
    font-weight: 500;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 6px 0 0 6px;
    flex-shrink: 0;
}

.input-with-prefix input {
    flex: 1;
    border-radius: 0 6px 6px 0;
    border-left: none;
}

.input-with-prefix:focus-within .input-prefix,
.input-with-prefix:focus-within input {
    border-color: var(--primary-color);
}

.input-with-prefix:focus-within input {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}

.input-suffix {
    position: absolute;
    right: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    pointer-events: none;
    z-index: 1;
}

.input-with-suffix input {
    padding-right: 2.5rem;
    width: 100%;
}

/* Hide spinner arrows on number inputs with suffix */
.input-with-suffix input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.input-with-suffix input[type="number"]::-webkit-outer-spin-button,
.input-with-suffix input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Ensure suffix is positioned correctly */
.input-with-suffix input[type="number"] {
    padding-right: 3rem;
}

.input-with-suffix-and-toggle {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.input-with-toggle {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.input-with-toggle input {
    flex: 1;
}

.toggle-group {
    display: flex;
    gap: 0.25rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px;
}

.toggle-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    color: var(--text-secondary);
}

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

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s;
    flex-wrap: wrap;
}

.radio-label:hover,
.checkbox-label:hover {
    background-color: var(--surface);
}

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

.form-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.contributions-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.contributions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.contribution-section {
    padding-left: 1rem;
    border-left: 3px solid var(--primary-color);
}

/* Toggle Switch */
.toggle-switch-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.toggle-switch {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    transition: background 0.3s;
    flex-shrink: 0;
    display: block;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

.toggle-switch:checked + .toggle-slider::after {
    transform: translateX(24px);
}

.toggle-label-text {
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

/* Segmented Control */
.segmented-control {
    display: inline-flex;
    background: var(--surface);
    border-radius: 8px;
    padding: 0;
    border: 1px solid var(--border);
    gap: 0;
    overflow: hidden;
    width: 100%;
}

.segmented-control input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.segment-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--surface);
    color: var(--text-secondary);
    font-weight: 500;
    border: none;
    flex: 1;
    user-select: none;
    position: relative;
    margin: 0;
}

.segmented-control input[type="radio"]:checked + .segment-label {
    background: var(--primary-color);
    color: white;
}

.segmented-control input[type="radio"]:first-of-type + .segment-label {
    border-radius: 7px 0 0 7px;
}

.segmented-control input[type="radio"]:last-of-type + .segment-label {
    border-radius: 0 7px 7px 0;
}

.segmented-control input[type="radio"]:first-of-type:checked + .segment-label {
    border-radius: 7px 0 0 7px;
}

.segmented-control input[type="radio"]:last-of-type:checked + .segment-label {
    border-radius: 0 7px 7px 0;
}

/* Results */
.results-container {
    background: var(--background);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    margin-top: 2rem;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
}

.result-card-large {
    grid-column: span 2;
}

.result-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
}

#breakdown-table-container {
    overflow-x: auto;
    margin-top: 2rem;
    min-height: 100px;
}

#breakdown-table-container:empty::before {
    content: 'Calculating...';
    display: block;
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

.breakdown-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--background);
    border-radius: 8px;
    overflow: hidden;
}

.breakdown-table th,
.breakdown-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.breakdown-table th {
    background: var(--surface);
    font-weight: 600;
    color: var(--text-primary);
}

.breakdown-table tr:hover {
    background: var(--surface);
}

/* QR Decoder */
.qr-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.camera-container {
    margin: 2rem 0;
    text-align: center;
}

.camera-container video {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    margin-bottom: 1rem;
}

.upload-preview {
    margin: 2rem 0;
    text-align: center;
}

.upload-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.result-container {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--surface);
    border-radius: 8px;
}

.qr-result {
    margin-top: 1rem;
}

.qr-result-content {
    background: var(--background);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    word-break: break-all;
    margin-bottom: 1rem;
    font-family: monospace;
}

.camera-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    min-width: auto;
    width: 40px;
    height: 40px;
    transition: opacity 0.2s ease;
}

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

.focus-mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.focus-mode-toggle input[type="checkbox"] {
    cursor: pointer;
}

.focus-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.focus-control label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.focus-control input[type="range"] {
    flex: 1;
    min-width: 150px;
    max-width: 200px;
}

.focus-control span {
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
}

.advanced-info {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.advanced-info h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.info-value {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-family: monospace;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
}

[data-theme="dark"] .error-message {
    background: #7f1d1d;
    color: #fecaca;
}

/* Password Generator */
.password-results {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border);
}

.strength-meter-container {
    margin-bottom: 2rem;
}

.strength-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.strength-bar {
    height: 12px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.strength-bar-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s, background-color 0.3s;
    border-radius: 6px;
}

.strength-bar-fill.very-weak {
    width: 20%;
    background-color: var(--error);
}

.strength-bar-fill.weak {
    width: 40%;
    background-color: #f97316;
}

.strength-bar-fill.fair {
    width: 60%;
    background-color: var(--warning);
}

.strength-bar-fill.good {
    width: 80%;
    background-color: #84cc16;
}

.strength-bar-fill.strong {
    width: 100%;
    background-color: var(--success);
}

.strength-bar-fill.very-strong {
    width: 100%;
    background-color: #059669;
}

.passwords-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.password-item {
    background: var(--surface);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.password-text {
    flex: 1;
    font-family: monospace;
    font-size: 1.125rem;
    word-break: break-all;
    color: var(--text-primary);
}

.password-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Password Preview */
.password-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.password-preview-text {
    flex: 1;
    font-family: monospace;
    font-size: 1.125rem;
    word-break: break-all;
    color: var(--text-primary);
}

/* Advanced Options Toggle */
.advanced-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s;
    margin-bottom: 1rem;
}

.advanced-toggle:hover {
    background: var(--border);
}

.toggle-icon {
    transition: transform 0.3s;
    font-size: 0.875rem;
}

.advanced-options {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Help Icon */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-secondary);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 0.5rem;
    cursor: help;
    position: relative;
    flex-shrink: 0;
}

.help-icon:hover {
    background: var(--primary-color);
}

.help-icon::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--text-primary);
    color: white;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: pre-wrap;
    max-width: 300px;
    word-break: break-all;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1000;
    font-weight: normal;
    text-align: left;
    line-height: 1.4;
}

#custom-charset-help::after {
    max-width: 400px;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.75rem;
}

.help-icon:hover::after {
    opacity: 1;
    visibility: visible;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 64px;
        flex-direction: column;
        background-color: var(--background);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow-md);
        padding: 2rem 0;
        gap: 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-item {
        margin: 0.5rem 0;
    }

    .nav-link.active::after {
        display: none;
    }

    .nav-right {
        gap: 0.5rem;
    }

    .nav-link-main-site {
        font-size: 0.875rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .results-summary {
        grid-template-columns: 1fr;
    }

    .result-card-large {
        grid-column: span 1;
    }

    .calculator-container,
    .password-generator-container,
    .qr-decoder-container {
        padding: 1.5rem;
    }

    .input-with-toggle {
        flex-direction: column;
        align-items: stretch;
    }

    .toggle-group {
        width: 100%;
        justify-content: center;
    }

    .contributions-row {
        grid-template-columns: 1fr;
    }
}

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

    .calculator-container,
    .password-generator-container,
    .qr-decoder-container {
        padding: 1rem;
    }

    .btn {
        width: 100%;
    }

    .qr-controls {
        flex-direction: column;
    }

    .password-item {
        flex-direction: column;
        align-items: stretch;
    }

    .password-actions {
        flex-direction: column;
    }
}

/* Help Button */
.help-button-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.help-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.help-button:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.help-menu {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 10000;
}

.help-menu.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.help-menu-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 0.875rem;
}

.help-menu-item:hover {
    background: var(--surface);
}

.help-menu-item:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .help-button-container {
        bottom: 15px;
        right: 15px;
    }

    .help-button {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }

    .help-menu {
        min-width: 180px;
        bottom: 55px;
    }
}

