:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-bg: #1f2937;
    --light-bg: #f8fafc;
    --border-color: #e5e7eb;
    --code-bg: #1e1e1e;
    --code-text: #d4d4d4;
}

/* Navigation */
.site-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.28);
    color: white;
}

.nav-separator {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

/* Breadcrumb */
.breadcrumb-nav {
    margin-bottom: 16px;
}

.breadcrumb {
    list-style: none;
    display: flex;
    gap: 6px;
    font-size: 0.88rem;
    flex-wrap: wrap;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.85);
}

.breadcrumb li:not(:last-child)::after {
    content: '›';
    margin-left: 6px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: opacity 0.2s;
}

.breadcrumb a:hover {
    opacity: 0.75;
    text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
    color: white;
    font-weight: 600;
}

/* Tool Switcher */
.tool-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    padding: 10px 16px;
    margin-bottom: 16px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.tool-switcher-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
    white-space: nowrap;
}

.tool-switch-btn {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
    white-space: nowrap;
    cursor: pointer;
    display: inline-block;
}

.tool-switch-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.tool-switch-btn.active {
    background: white;
    color: #667eea;
    font-weight: 700;
    border-color: white;
    pointer-events: none;
}

@media (max-width: 600px) {
    .tool-switcher {
        gap: 6px;
        padding: 8px 12px;
    }

    .tool-switch-btn {
        font-size: 0.78rem;
        padding: 5px 10px;
    }
}

/* Related Tools */
.related-tools-section {
    background: white;
    border-radius: 12px;
    padding: 25px 30px;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.related-tools-section h3 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.related-link {
    display: inline-block;
    padding: 8px 18px;
    background: #f0f4ff;
    color: #4a5568;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.88rem;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.related-link:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* FAQ Section */
.faq-section {
    background: white;
    border-radius: 12px;
    padding: 25px 30px;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.faq-section h3 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.faq-item {
    background: #f8fafc;
    padding: 14px 18px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.faq-item summary {
    font-weight: 600;
    color: #333;
    cursor: pointer;
    padding: 4px 0;
    font-size: 0.92rem;
}

.faq-item summary:hover {
    color: var(--primary-color);
}

.faq-item p {
    margin-top: 8px;
    color: #555;
    line-height: 1.6;
    font-size: 0.9rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    padding: 20px;
    color: #1f2937;
    transition: background 0.3s ease;
}

body.dark-theme {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
    animation: fadeInDown 0.5s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    margin-bottom: 30px;
    animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.card-header {
    background: var(--dark-bg);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.card-header h2 {
    font-size: 1.5rem;
}

.mode-toggle {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px;
    border-radius: 12px;
}

.mode-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: none;
    padding: 8px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 600;
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.mode-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.control-button {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    font-weight: 500;
}

.control-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* FIXED: Side-by-side layout with flex row */
.card-body {
    padding: 0;
    display: flex;
    flex-direction: row;
    min-height: 500px;
    width: 100%;
}

.input-panel {
    flex: 1;
    min-width: 0;
    /* Prevents flex overflow */
    display: flex;
    flex-direction: column;
}

.swap-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--light-bg);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}

.output-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Responsive: stack on mobile */
@media (max-width: 768px) {
    .card-body {
        flex-direction: column;
    }

    .swap-wrapper {
        border-left: none;
        border-right: none;
        border-top: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
        padding: 15px;
    }
}

.panel-header {
    padding: 15px 20px;
    background: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-title {
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-badge {
    background: rgba(102, 126, 234, 0.15);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-family: monospace;
    color: var(--primary-color);
    font-weight: 500;
}

.panel-actions {
    display: flex;
    gap: 8px;
}

.action-button {
    background: white;
    border: 1px solid var(--border-color);
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.action-button:hover {
    background: #f3f4f6;
    border-color: var(--primary-color);
}

.textarea-container {
    flex: 1;
    position: relative;
}

textarea {
    width: 100%;
    min-height: 350px;
    border: none;
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    background: var(--light-bg);
    color: #1f2937;
}

textarea:focus {
    background: #ffffff;
}

textarea[readonly] {
    background: #f1f5f9;
    color: #334155;
}

body.dark-theme textarea {
    background: #2d2d2d;
    color: #d4d4d4;
}

body.dark-theme textarea[readonly] {
    background: #252525;
    color: #b0b0b0;
}

body.dark-theme .panel-header {
    background: #2d2d2d;
    border-bottom-color: #404040;
}

body.dark-theme .panel-title {
    color: #e0e0e0;
}

body.dark-theme .action-button {
    background: #3d3d3d;
    border-color: #555;
    color: #ccc;
}

body.dark-theme .action-button:hover {
    background: #4d4d4d;
    border-color: var(--primary-color);
}

body.dark-theme .options-panel {
    background: #2d2d2d;
    border-top-color: #404040;
}

body.dark-theme .option-group label {
    color: #ddd;
}

body.dark-theme .option-select {
    background: #3d3d3d;
    border-color: #555;
    color: #ddd;
}

body.dark-theme .stats-panel {
    background: #252525;
    border-color: #404040;
}

body.dark-theme .stat-label {
    color: #9ca3af;
}

body.dark-theme .shortcuts-hint {
    background: #252525;
    border-color: #404040;
    color: #aaa;
}

body.dark-theme .kbd {
    background: #3d3d3d;
    border-color: #555;
    color: #ccc;
}

body.dark-theme .swap-wrapper {
    background: #2d2d2d;
    border-left-color: #404040;
    border-right-color: #404040;
}

@media (max-width: 768px) {
    body.dark-theme .swap-wrapper {
        border-top-color: #404040;
        border-bottom-color: #404040;
    }
}

body.dark-theme .related-tools-section,
body.dark-theme .faq-section {
    background: #1e1e2e;
}

body.dark-theme .related-tools-section h3,
body.dark-theme .faq-section h3 {
    color: #e0e0e0;
}

body.dark-theme .related-link {
    background: #2d2d3d;
    color: #ccc;
    border-color: #404060;
}

body.dark-theme .faq-item {
    background: #252535;
    border-color: #404060;
}

body.dark-theme .faq-item summary {
    color: #e0e0e0;
}

body.dark-theme .faq-item p {
    color: #aaa;
}

.panel-foot {
    padding: 8px 15px;
    font-size: 0.7rem;
    color: #6b7280;
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
}

body.dark-theme .panel-foot {
    background: #252525;
    border-top-color: #404040;
    color: #9ca3af;
}

.swap-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--border-color);
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--primary-color);
}

.swap-btn:hover {
    transform: rotate(180deg);
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

body.dark-theme .swap-btn {
    background: #3d3d3d;
    border-color: #555;
}

.options-panel {
    padding: 25px;
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.option-group {
    display: flex;
    flex-direction: column;
}

.option-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 0.85rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
}

.checkbox-group input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
}

.checkbox-group code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
}

body.dark-theme .checkbox-group code {
    background: #404040;
    color: #ccc;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.success-btn {
    background: var(--success-color);
}

.success-btn:hover {
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

.secondary-btn {
    background: rgba(0, 0, 0, 0.08);
    color: #374151;
    border: 1px solid var(--border-color);
    padding: 10px 24px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

body.dark-theme .secondary-btn {
    background: #3d3d3d;
    color: #ddd;
    border-color: #555;
}

body.dark-theme .secondary-btn:hover {
    background: #4d4d4d;
}

.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 15px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    font-family: monospace;
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 5px;
}

.message {
    padding: 12px 15px;
    border-radius: 8px;
    margin: 15px 0;
    display: none;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.show {
    display: block;
}

.error-message {
    background: #fef2f2;
    color: var(--error-color);
    border: 1px solid #fecaca;
}

.success-message {
    background: #f0fdf4;
    color: var(--success-color);
    border: 1px solid #bbf7d0;
}

body.dark-theme .error-message {
    background: #2d1f1f;
    border-color: #7f2e2e;
    color: #f87171;
}

body.dark-theme .success-message {
    background: #1f2d1f;
    border-color: #2e7f2e;
    color: #4ade80;
}

.shortcuts-hint {
    margin-top: 20px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #6b7280;
    border: 1px solid var(--border-color);
}

.kbd {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 2px 8px;
    font-family: monospace;
    font-size: 0.75rem;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.feature {
    text-align: center;
    padding: 25px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s;
}

.feature:hover {
    transform: translateY(-3px);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.feature h4 {
    margin-bottom: 8px;
    color: #1f2937;
}

.feature p {
    font-size: 0.85rem;
    color: #6b7280;
}

body.dark-theme .feature {
    background: #1e1e2e;
}

body.dark-theme .feature h4 {
    color: #e0e0e0;
}

body.dark-theme .feature p {
    color: #aaa;
}

.footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
    font-size: 0.85rem;
}

.footer a {
    color: white;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Toast */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    min-width: 300px;
    max-width: 500px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-success {
    background: #10b981;
}

.toast-error {
    background: #ef4444;
}

.toast-info {
    background: #3b82f6;
}

.toast-body {
    flex: 1;
    line-height: 1.4;
}

.toast-title {
    font-weight: 700;
    margin-bottom: 3px;
}

.toast-detail {
    font-size: 0.8rem;
    opacity: 0.9;
}

.toast-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 8px;
    border-radius: 6px;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Additional SEO content styling */
.seo-content h2 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 8px;
}

.seo-content p {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.7;
    margin-bottom: 16px;
}

.seo-content code {
    background: #f0f4ff;
    padding: 2px 6px;
    border-radius: 4px;
}

body.dark-theme .seo-content {
    background: #1e1e2e;
}

body.dark-theme .seo-content h2 {
    color: #e0e0e0;
}

body.dark-theme .seo-content p {
    color: #aaa;
}

body.dark-theme .seo-content code {
    background: #2d2d3d;
    color: #ccc;
}