/* CSS Variables for Theming */
:root {
    /* Light Theme (default) */
    --primary: #4A90E2;
    --background: #FFFFFF;
    --container-bg: #f5f5f5;
    --text: #333333;
    --text-secondary: #666666;
    --highlight: #FFD700;
    --zero-width-highlight: #FF1493;
    --header-bg: #FFFFFF;
    --header-text: #333333;
    --btn-primary: #4A90E2;
    --btn-secondary: #2ECC71;
    --border: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
    --input-bg: #FFFFFF;
    --footer-bg: #f8f9fa;
}

[data-theme="dark"] {
    --primary: #5BA3F5;
    --background: #121212;
    --container-bg: #1E1E1E;
    --text: #FFFFFF;
    --text-secondary: #AAAAAA;
    --highlight: #FFD700;
    --zero-width-highlight: #FF1493;
    --header-bg: #1E1E1E;
    --header-text: #FFFFFF;
    --btn-primary: #5BA3F5;
    --btn-secondary: #3FD86C;
    --border: #333333;
    --shadow: rgba(0, 0, 0, 0.3);
    --input-bg: #2A2A2A;
    --footer-bg: #1E1E1E;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
}

/* Site Container */
.site-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation Bar */
.navbar {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px var(--shadow);
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    position: relative;
}

.logo-text {
    font-family: 'UnifrakturCook', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    line-height: 1;
    position: absolute;
    left: 2rem;
}

.logo-text:hover {
    opacity: 0.8;
}

.logo-center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    margin: 0 auto;
}

.logo-image {
    height: 3.5rem;
    width: auto;
    max-height: calc(100% - 0.5rem);
    transition: filter 0.3s ease;
}

.logo-center {
    background: transparent;
}

[data-theme="dark"] .logo-image {
    filter: invert(1);
}

[data-theme="dark"] .logo-center {
    background: var(--header-bg);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

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

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

.theme-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 1rem;
    padding: 0.75rem 0;
}

.hero-section h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Transformer Section */
.transformer-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Text Sections */
.text-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.text-section label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.char-count {
    font-weight: normal;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

textarea,
.output-display {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--input-bg);
    color: var(--text);
    resize: vertical;
    transition: border-color 0.2s, background-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.output-display {
    overflow-y: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
    position: relative;
}

.output-display:empty::before {
    content: "... and your modified text appears here.";
    color: var(--text-secondary);
    opacity: 0.6;
    position: absolute;
    top: 1rem;
    left: 1rem;
    pointer-events: none;
}

/* Highlighted Characters */
.char-swapped {
    background-color: var(--highlight);
    color: #000000;
    border-radius: 2px;
}

.char-zero-width {
    background-color: var(--zero-width-highlight);
    color: #FFFFFF;
    border-radius: 2px;
    padding: 0 2px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s, box-shadow 0.2s;
}

.btn:hover {
    opacity: 0.9;
    box-shadow: 0 2px 8px var(--shadow);
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-clear {
    background-color: #FF6B6B;
    color: #FFFFFF;
}

.btn-clear:hover {
    background-color: #FF5252;
}

/* Options Section */
.options-section {
    background-color: var(--container-bg);
    padding: 1.1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    transition: height 0.3s ease-in-out;
}

.options-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.option-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: fit-content;
}

.option-item label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.option-item label span {
    color: var(--text-secondary);
}

.checkbox-label {
    flex-direction: row !important;
    align-items: center;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-label span {
    color: var(--text) !important;
}

.toggle-label {
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    width: 100%;
}

.toggle-label span {
    color: var(--text) !important;
}

.option-item .theme-label {
    color: var(--text) !important;
    margin-right: 0.5rem;
}

.option-item .switch {
    margin-left: auto;
}

/* Zero Width Percentage Container */
.zero-width-setting {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    overflow: hidden;
    transition: grid-template-rows 0.3s ease-in-out, opacity 0.3s ease-in-out;
    margin: 0;
}

.zero-width-setting > * {
    min-height: 0;
}

.zero-width-setting.visible {
    grid-template-rows: 1fr;
    opacity: 1;
    padding-bottom: 0.5rem;
}

/* Coming Soon Section */
.coming-soon-section {
    background-color: var(--container-bg);
    padding: 1.1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    width: fit-content;
    max-width: 100%;
    margin: 2rem auto 0;
}

.coming-soon-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text);
    text-align: center;
}

.app-icons {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: center;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.app-icon svg {
    width: 48px;
    height: 48px;
}

.app-icon span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Donate Section */
.donate-section {
    background-color: var(--container-bg);
    padding: 1.1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    width: fit-content;
    max-width: 100%;
    margin: 2rem auto 0;
}

.donate-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text);
    text-align: center;
}

.donate-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s, transform 0.2s;
}

.donate-link:hover {
    color: var(--primary);
    transform: scale(1.05);
}

.donate-link svg {
    width: 48px;
    height: 48px;
}

.donate-link span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

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

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Range Slider */
input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* 404 Error Page */
.error-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    min-height: 60vh;
}

.error-text {
    margin-bottom: 3rem;
}

.error-code {
    font-family: 'UnifrakturCook', serif;
    font-size: 8rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1;
}

.error-message {
    font-family: 'UnifrakturCook', serif;
    font-size: 3rem;
    font-weight: 700;
    color: var(--text);
    margin: 1rem 0 0 0;
    line-height: 1;
}

.error-logo {
    margin-top: 2rem;
}

.error-logo-image {
    height: 16rem;
    width: auto;
    transition: filter 0.3s ease;
}

[data-theme="dark"] .error-logo-image {
    filter: invert(1);
}

[data-theme="dark"] .error-logo {
    background: var(--background);
}

/* Footer */
.site-footer {
    background-color: var(--footer-bg);
    border-top: 1px solid var(--border);
    padding: 3rem 2rem 1.5rem;
    margin-top: auto;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
    margin-bottom: 2rem;
    justify-items: center;
}

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

.footer-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.footer-section p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.footer-section a {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.footer-bottom p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--text);
    color: var(--background);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    z-index: 2000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Info Pages - Shared Styles */
.header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 4px var(--shadow);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.back-btn {
    color: var(--primary);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-btn:hover {
    opacity: 0.8;
}

.header-spacer {
    width: 44px;
}

/* Info Content */
.info-content {
    flex: 1;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.info-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text);
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.info-section {
    margin-bottom: 2rem;
}

.info-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.info-section p {
    line-height: 1.7;
    margin-bottom: 1rem;
}

.info-section ul {
    padding-left: 1.5rem;
    line-height: 1.8;
}

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

.example-box {
    background-color: var(--container-bg);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.example-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.last-updated {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.license-list {
    list-style: none;
    padding-left: 0;
}

.license-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.license-text {
    background-color: var(--container-bg);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.license-text p {
    margin-bottom: 1rem;
}

/* App Container for Info Pages */
.app-container {
    max-width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }

    .navbar-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0;
    }
    
    .logo-text {
        position: relative;
        left: 0;
        margin-right: 0;
    }
    
    .logo-center {
        flex: 0 0 auto;
        margin-left: 0;
        margin-right: 0;
    }

    .nav-links {
        gap: 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .hero-section h1 {
        font-size: 1.1rem;
    }

    .options-grid {
        flex-direction: column;
    }

    input[type="range"] {
        width: 100%;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: 0.5rem 0;
        margin-bottom: 0.75rem;
    }

    .hero-section h1 {
        font-size: 1rem;
    }

    .tagline {
        font-size: 1rem;
    }
}
