/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans SC', 'Noto Sans TC', Arial, sans-serif;
    line-height: 1.6;
    color: #333333;
    background-color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for accessibility */
*:focus {
    outline: 2px solid #007BFF;
    outline-offset: 2px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #007BFF;
    margin: 0;
}

.nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    /* Ensure proper stacking context */
    position: relative;
    z-index: 1000;
}

.nav-link {
    text-decoration: none;
    color: #2c3e50;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.05s;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.025em;
    /* Ensure nav links are above dropdown interference */
    z-index: 1001;
    pointer-events: auto;
    /* Create clear boundaries for hover detection */
    border: 1px solid transparent;
    /* Prevent hover area expansion */
    box-sizing: border-box;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.6s;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover,
.nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.nav-link.active {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
}

.contrast-toggle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.contrast-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: all 0.4s ease;
    transform: translate(-50%, -50%);
}

.contrast-toggle:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.contrast-toggle:hover::before {
    width: 100%;
    height: 100%;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    position: relative;
    z-index: 1001;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
}

.hamburger {
    width: 25px;
    height: 3px;
    background-color: #333333;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.mobile-menu-toggle.active .hamburger:nth-child(1) {
    transform: rotate(-45deg) translate(-6px, 6px);
}

.mobile-menu-toggle.active .hamburger:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger:nth-child(3) {
    transform: rotate(45deg) translate(-6px, -6px);
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    /* Add small margin to prevent hover bleeding */
    margin: 0 2px;
}

.dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: auto;
    /* Ensure dropdown toggle has defined boundaries */
    position: relative;
    z-index: 1003;
}

.dropdown-toggle::after {
    content: '▼';
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

/* Use more specific hover trigger - only on the dropdown toggle itself */
.dropdown-toggle:hover::after,
.dropdown:hover .dropdown-toggle::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1002;
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    pointer-events: none;
}

/* Create invisible hover bridge between toggle and dropdown */
.dropdown::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 5px;
    z-index: 1001;
    pointer-events: auto;
}

/* Show dropdown when hovering the dropdown container or the dropdown menu itself */
.dropdown:hover .dropdown-menu,
.dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Keep dropdown visible when hovering over the invisible bridge */
.dropdown:hover::before {
    pointer-events: auto;
}

.dropdown-link {
    display: block;
    padding: 0.75rem 1rem;
    color: #333333;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-radius: 4px;
    margin: 0 0.5rem;
}

.dropdown-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    transform: translateX(4px);
}

/* Navigation list item isolation */
.nav-menu li {
    position: relative;
    z-index: 1001;
    /* Prevent hover area bleeding */
    isolation: isolate;
    /* Add padding to prevent hover conflicts */
    margin: 0 1px;
}

/* Ensure regular nav links are not affected by dropdown hover */
.nav-menu li:not(.dropdown) .nav-link {
    position: relative;
    z-index: 1004;
    /* Ensure proper hover boundaries */
    display: block;
    /* Prevent hover interference */
    isolation: isolate;
}

/* Add hover delay to prevent rapid switching */
.dropdown {
    transition: all 0.3s ease;
    transition-delay: 0.15s;
}

.dropdown:hover {
    transition-delay: 0s;
}

/* Add debouncing for dropdown menu visibility */
.dropdown-menu {
    transition: opacity 0.3s ease 0.1s, visibility 0.3s ease 0.1s, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.1s;
}

.dropdown:hover .dropdown-menu {
    transition-delay: 0s;
}

/* Prevent rapid hover state changes on nav links */
.nav-link:hover {
    transition-delay: 0s;
}

/* Create buffer zones around dropdown to prevent interference */
.dropdown::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 5px;
    z-index: 999;
    pointer-events: none;
    right: -5px;
}

/* Ensure About and History links maintain their hover states */
.nav-menu li:not(.dropdown) .nav-link:hover {
    /* Force hover state to remain active */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #ffffff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4) !important;
}

/* Mobile dropdown adjustments */
@media (max-width: 768px) {
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: rgba(255, 255, 255, 0.1);
        margin-left: 1rem;
        pointer-events: auto;
    }
    
    .dropdown-toggle::after {
        display: none;
    }
}

.mobile-menu-toggle.active .hamburger:nth-child(3) {
    transform: rotate(45deg) translate(-6px, -6px);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

.converter-section {
    margin-bottom: 3rem;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: #333333;
    margin-bottom: 1rem;
}

.section-description {
    text-align: center;
    font-size: 1.1rem;
    color: #666666;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Conversion Controls */
.conversion-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.direction-toggle {
    display: flex;
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 0.5rem;
    gap: 0.5rem;
}

.direction-toggle input[type="radio"] {
    display: none;
}

.toggle-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: transparent;
    border: 2px solid transparent;
}

.toggle-label:hover {
    background-color: #e9ecef;
}

.direction-toggle input[type="radio"]:checked + .toggle-label {
    background-color: #007BFF;
    color: #ffffff;
    border-color: #007BFF;
}

.toggle-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.toggle-subtext {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Conversion Interface */
.conversion-interface {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.textarea-container {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease;
}

.textarea-container:focus-within {
    border-color: #007BFF;
}

.textarea-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #333333;
}

.input-textarea,
.output-textarea {
    width: 100%;
    min-height: 200px;
    border: none;
    background-color: #ffffff;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Noto Sans SC', 'Noto Sans TC', Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: box-shadow 0.3s ease;
}

.input-textarea:focus,
.output-textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.output-textarea {
    background-color: #f8f9fa;
    cursor: default;
}

.textarea-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.char-count {
    font-size: 0.9rem;
    color: #666666;
}

.clear-btn,
.copy-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.clear-btn {
    background-color: #dc3545;
    color: #ffffff;
}

.clear-btn:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}

.copy-btn {
    background-color: #28a745;
    color: #ffffff;
}

.copy-btn:hover:not(:disabled) {
    background-color: #218838;
    transform: translateY(-1px);
}

.copy-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.help-text {
    font-size: 0.85rem;
    color: #666666;
    margin-top: 0.5rem;
}

/* Messages */
.error-message,
.success-message {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* History Section */
.history-section {
    border-top: 1px solid #e9ecef;
    padding-top: 2rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-title {
    margin: 0;
}

.history-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s ease;
}

.history-toggle:hover {
    color: #007BFF;
}

.toggle-arrow {
    transition: transform 0.3s ease;
}

.history-toggle[aria-expanded="true"] .toggle-arrow {
    transform: rotate(180deg);
}

.clear-history-btn {
    background-color: #dc3545;
    color: #ffffff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.clear-history-btn:hover {
    background-color: #c82333;
}

.history-panel {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-empty {
    text-align: center;
    color: #666666;
    padding: 2rem;
}

.history-item {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
}

.history-item:hover {
    border-color: #007BFF;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-direction {
    font-size: 0.85rem;
    color: #007BFF;
    font-weight: 600;
}

.history-timestamp {
    font-size: 0.8rem;
    color: #666666;
}

.history-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.history-original,
.history-converted {
    font-size: 0.9rem;
    line-height: 1.4;
}

.history-original {
    color: #333333;
}

.history-converted {
    color: #007BFF;
}

.history-delete {
    background-color: #dc3545;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.history-delete:hover {
    background-color: #c82333;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    padding: 4rem 0 0;
    margin-top: auto;
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 118, 117, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 119, 198, 0.2) 0%, transparent 50%);
    animation: float 15s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-10px) rotate(1deg); }
    66% { transform: translateY(-5px) rotate(-1deg); }
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 3rem;
    position: relative;
    z-index: 1;
    margin-bottom: 3rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 2rem;
}

.footer-section {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.footer-brand .footer-logo {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    background: linear-gradient(45deg, #fff, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-description {
    font-size: 0.95rem;
    line-height: 1.6;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.footer-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
}

.stat-item:hover {
    transform: translateY(-5px) scale(1.05);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #f093fb;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

.footer-section h3,
.footer-section h4,
.footer-section h5 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    color: #f093fb;
}

.footer-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-nav li {
    margin-bottom: 0.75rem;
}

.footer-text {
    color: #bdc3c7;
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
}

.footer-links {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.footer-link {
    color: white;
    text-decoration: none;
    font-weight: 400;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-radius: 6px;
    position: relative;
}

.footer-link:hover {
    color: #f093fb;
    transform: translateX(5px);
    padding-left: 0.5rem;
}

.footer-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #f093fb, #667eea);
    transition: width 0.3s ease;
    transform: translateY(-50%);
}

.footer-link:hover::before {
    width: 20px;
}

.link-icon {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.footer-link:hover .link-icon {
    transform: scale(1.2) rotate(5deg);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.social-link {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px) rotate(5deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.social-link svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.social-link:hover svg {
    transform: scale(1.1);
}

.newsletter-signup {
    margin-top: 1rem;
}

.newsletter-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.newsletter-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.newsletter-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.newsletter-input:focus {
    outline: none;
    border-color: #f093fb;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 3px rgba(240, 147, 251, 0.2);
}

.newsletter-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(45deg, #f093fb, #667eea);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.newsletter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.3);
    background: linear-gradient(45deg, #667eea, #f093fb);
}

.footer-bottom {
    background: rgba(0, 0, 0, 0.2);
    padding: 2rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.copyright {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-bottom-links {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-bottom-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.footer-bottom-link:hover {
    color: #f093fb;
    text-decoration: underline;
}

.back-to-top-btn {
    width: 45px;
    height: 45px;
    background: linear-gradient(45deg, #f093fb, #667eea);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
}

.back-to-top-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.4);
    background: linear-gradient(45deg, #667eea, #f093fb);
}

.back-to-top-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.back-to-top-btn:hover svg {
    transform: translateY(-2px);
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 9999;
}

.loading-indicator.show {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007BFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-weight: 500;
    color: #333333;
}

/* High Contrast Mode */
body.high-contrast {
    background-color: #000000;
    color: #ffffff;
}

body.high-contrast .header {
    background-color: #000000;
    border-bottom-color: #ffffff;
}

body.high-contrast .nav-link {
    color: #ffffff;
}

body.high-contrast .nav-link:hover,
body.high-contrast .nav-link.active {
    background-color: #ffffff;
    color: #000000;
}

body.high-contrast .textarea-container {
    background-color: #333333;
    border-color: #ffffff;
}

body.high-contrast .input-textarea,
body.high-contrast .output-textarea {
    background-color: #000000;
    color: #ffffff;
    border: 1px solid #ffffff;
}

body.high-contrast .footer {
    background-color: #000000;
    border-top-color: #ffffff;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    
    .footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .nav-container {
        position: relative;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #ffffff;
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 8px 8px;
        z-index: 1000;
        list-style: none;
        margin: 0;
        gap: 0.5rem;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu li {
        width: 100%;
    }
    
    .nav-link {
        display: block;
        width: 100%;
        text-align: center;
        padding: 0.75rem 1rem;
        margin: 0;
    }
    
    .contrast-toggle {
        margin: 0 auto;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .conversion-interface {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .direction-toggle {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .toggle-label {
        padding: 0.75rem 1.5rem;
    }
    
    .history-content {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .footer {
        padding: 3rem 0 0;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-stats {
        justify-content: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-bottom-links {
        justify-content: center;
    }
    
    .footer-links {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .content-section {
        padding: 2rem 1rem;
        margin-bottom: 3rem;
    }
    
    .content-section h2 {
        font-size: 2rem;
    }
    
    .container {
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 1.75rem;
    }
    
    .textarea-container {
        padding: 1rem;
    }
    
    .input-textarea,
    .output-textarea {
        min-height: 150px;
        font-size: 0.9rem;
    }
    
    .toggle-label {
        padding: 0.5rem 1rem;
    }
    
    .toggle-text {
        font-size: 1rem;
    }
    
    .toggle-subtext {
        font-size: 0.8rem;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .history-section,
    .loading-indicator {
        display: none;
    }
    
    .main-content {
        padding: 0;
    }
    
    .conversion-interface {
        display: block;
    }
    
    .textarea-container {
        border: 1px solid #000000;
        margin-bottom: 1rem;
    }
}

/* Smooth transitions for all interactive elements */
button,
input,
textarea,
a {
    transition: all 0.3s ease;
}

/* About Page Styles */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #007BFF;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
}

.skip-link:focus {
    top: 6px;
}

.logo {
    text-align: center;
}

.logo a {
    text-decoration: none;
    color: inherit;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #007BFF;
    margin: 0;
}

.logo-subtitle {
    font-size: 0.9rem;
    color: #666666;
    font-weight: 400;
}

.main {
    flex: 1;
    padding: 2rem 0;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333333;
    margin-bottom: 1rem;
}

.page-subtitle {
    font-size: 1.2rem;
    color: #666666;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.content-section {
    margin-bottom: 5rem;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(248,250,252,0.8));
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.content-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #4facfe, #00f2fe);
    background-size: 300% 100%;
    animation: gradientShift 6s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.content-section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2c3e50, #3498db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2.5rem;
    text-align: center;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.feature-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(248,250,252,0.9));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    opacity: 0;
    transition: opacity 0.5s ease;
}

.feature-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.feature-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.2rem;
    position: relative;
    z-index: 1;
}

.feature-card p {
    color: #5a6c7d;
    line-height: 1.7;
    font-size: 1rem;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

.usage-steps {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #007BFF;
}

.step-number {
    background: #007BFF;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.step-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333333;
    margin-bottom: 0.5rem;
}

.step-content p {
    color: #666666;
    line-height: 1.6;
    margin: 0;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.shortcut-item kbd {
    background: #333333;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0 0.25rem;
}

.shortcut-item span {
    color: #666666;
    font-size: 0.9rem;
}

.tech-details {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid #e9ecef;
}

.tech-details h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333333;
    margin-bottom: 1rem;
}

.tech-details p {
    color: #666666;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.tech-details ul {
    color: #666666;
    padding-left: 1.5rem;
}

.tech-details li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Responsive adjustments for about page */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 2rem;
    }
    
    .page-subtitle {
        font-size: 1rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .feature-card {
        padding: 1.5rem;
    }
    
    .step {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }
    
    .shortcut-item {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 1rem 0;
    }
    
    .page-header h1 {
        font-size: 1.75rem;
    }
    
    .content-section h2 {
        font-size: 1.5rem;
    }
    
    .feature-card {
        padding: 1rem;
    }
    
    .step {
        padding: 1rem;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}