/* Reset and Base Styles */
* {
    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;
    color: #2c3e50;
    background-color: #ffffff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header and Navigation Styles */
.header {
    background: #ffffff;
    border-bottom: 1px solid #e8ecef;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

/* Logo Styles */
.logo-link {
    text-decoration: none;
    color: inherit;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    letter-spacing: -0.02em;
}

.logo-link:hover .logo-text {
    color: #2563eb;
    transition: color 0.3s ease;
}

/* Navigation Styles */
.nav {
    display: flex;
    align-items: center;
}

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

.nav-item {
    position: relative;
}

.nav-link {
    text-decoration: none;
    color: #6c757d;
    font-weight: 400;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
    display: block;
}

.nav-link:hover,
.nav-link.active {
    color: #2563eb;
}

.nav-link.active {
    font-weight: 500;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
}

.dropdown-toggle::after {
    content: '▼';
    font-size: 0.75rem;
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
}

.dropdown:hover .dropdown-toggle::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    border: 1px solid #e8ecef;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    z-index: 1001;
}

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

.dropdown-link {
    display: block;
    padding: 0.5rem 1rem;
    color: #6c757d;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown-link:hover {
    background: #f8f9fa;
    color: #2563eb;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    gap: 0.25rem;
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background: #6c757d;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover .hamburger-line {
    background: #2563eb;
}

/* Mobile Menu Toggle Animation */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Hero Section */
.hero {
    background: #ffffff;
    color: #2c3e50;
    padding: 4rem 0 2rem 0;
    text-align: center;
    margin-top: 0;
    border-bottom: 1px solid #e8ecef;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 1rem;
    color: #2c3e50;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
    max-width: 600px;
    margin: 0 auto;
    font-weight: 400;
}

/* Translation Section */
.translation-section {
    padding: 3rem 0;
    background: #f8f9fa;
}

.translation-container {
    background: white;
    border-radius: 8px;
    border: 1px solid #e8ecef;
    padding: 2.5rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Language Selector */
.language-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.language-input,
.language-output {
    flex: 1;
    min-width: 120px;
}

.language-label {
    display: block;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: #6c757d;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.language-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.language-select:focus {
    outline: none;
    border-color: #495057;
    box-shadow: 0 0 0 2px rgba(73, 80, 87, 0.1);
}

.swap-languages {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1.5rem;
    color: #6c757d;
}

.swap-languages:hover {
    background: #f8f9fa;
    border-color: #495057;
    color: #495057;
    transform: rotate(180deg);
}

/* Text Areas */
.text-areas {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.input-section,
.output-section {
    position: relative;
}

.text-area-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.text-area-label {
    font-weight: 400;
    color: #6c757d;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.clear-btn,
.copy-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.clear-btn:hover,
.copy-btn:hover {
    color: #495057;
    background: #f8f9fa;
}

.text-area {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s ease;
    background: #ffffff;
}

.text-area:focus {
    outline: none;
    border-color: #495057;
    box-shadow: 0 0 0 2px rgba(73, 80, 87, 0.1);
}

.output-area {
    background: #f8f9fa;
    cursor: default;
}

.text-area-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.char-count {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 400;
}

/* Translate Button */
.translate-button-container {
    text-align: center;
}

.translate-btn {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    letter-spacing: 0.02em;
}

.translate-btn:hover {
    background: #34495e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.3);
}

.translate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.translate-btn.loading .btn-text {
    display: none;
}

.translate-btn.loading .loading-spinner {
    display: block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* API Status Indicator */
.api-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 400;
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #28a745;
}

.status-indicator.demo {
    background: #ffc107;
}

.status-indicator.error {
    background: #dc3545;
}

/* Features section removed */

/* Footer */
.footer {
    background: #f8f9fa;
    color: #6c757d;
    padding: 2rem 0 1rem;
    border-top: 1px solid #e8ecef;
}

.footer-content {
    text-align: center;
    margin-bottom: 1rem;
}

.footer-brand {
    margin-bottom: 1.5rem;
}

.footer-logo {
    font-size: 1.25rem;
    font-weight: 300;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.footer-description {
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-link {
    color: #6c757d;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
    padding: 0.25rem 0;
}

.footer-link:hover {
    color: #2c3e50;
}

.footer-bottom {
    border-top: 1px solid #e8ecef;
    padding-top: 1rem;
    text-align: center;
}

.footer-copyright {
    color: #6c757d;
    font-size: 0.75rem;
    font-weight: 400;
}

/* Responsive Design - Tablet */
@media (min-width: 768px) {
    .hero-title {
        font-size: 3rem;
    }

    .hero-subtitle {
        font-size: 1.25rem;
    }

    .language-selector {
        flex-wrap: nowrap;
    }

    .text-areas {
        grid-template-columns: 1fr 1fr;
    }
}

/* Responsive Design - Desktop */
@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }

    .translation-container {
        padding: 3rem;
    }

    .text-area {
        min-height: 150px;
    }
}

/* Mobile navigation removed */

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
select:focus,
textarea:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .text-area {
        border-width: 3px;
    }

    .translate-btn {
        border: 2px solid white;
    }
}

/* Mobile-specific optimizations */
@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .hero {
        padding: 2rem 0;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .translation-container {
        padding: 1.5rem;
        margin: 0 0.5rem;
        border-radius: 12px;
    }

    .language-selector {
        flex-direction: column;
        gap: 1rem;
    }

    .language-input,
    .language-output {
        min-width: 100%;
    }

    .swap-languages {
        align-self: center;
        margin-top: 0;
        transform: rotate(90deg);
    }

    .swap-languages:hover {
        transform: rotate(270deg);
    }

    .text-area {
        min-height: 100px;
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    .translate-btn {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }



    .footer {
        padding: 2rem 0 1rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {

    .clear-btn,
    .copy-btn,
    .swap-languages {
        min-width: 44px;
        min-height: 44px;
        padding: 0.75rem;
    }

    .language-select {
        min-height: 44px;
        padding: 0.75rem;
    }

    .nav-link {
        padding: 0.75rem 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 1.5rem 0;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .text-area {
        min-height: 80px;
    }

    .translation-section {
        padding: 2rem 0;
    }
}

/* PWA and mobile app-like features */
@media (display-mode: standalone) {
    .header {
        padding-top: env(safe-area-inset-top);
    }

    .footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Mobile Navigation Styles */
@media (max-width: 768px) {
    .header-content {
        padding: 0.75rem 0;
    }

    .nav {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: #ffffff;
        display: flex;
        align-items: start;
        border-top: 1px solid #e8ecef;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }

    .nav.mobile-menu-open {
        top: 100%;
        transform: translateY(0);
    }

    .nav-list {
        width: 100%;
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
    }

    .nav-item {
        width: 100%;
        border-bottom: 1px solid #f1f3f4;
    }

    .nav-item:last-child {
        border-bottom: none;
    }

    .nav-link {
        padding: 1rem;
        display: block;
        width: 100%;
        text-align: left;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    /* Mobile Dropdown Styles */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-top: 1px solid #f1f3f4;
        background: #f8f9fa;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .dropdown.mobile-dropdown-open .dropdown-menu {
        max-height: 200px;
    }

    .dropdown-toggle::after {
        content: '▶';
        float: right;
    }

    .dropdown.mobile-dropdown-open .dropdown-toggle::after {
        content: '▼';
    }

    .dropdown-link {
        padding: 0.75rem 2rem;
        font-size: 0.9rem;
    }
}

/* Enhanced UI Features */

/* Speak Button */
.speak-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
}

.speak-btn:hover {
    color: #495057;
    background: #f8f9fa;
}

/* History Button */
.history-btn {
    background: #ffffff;
    border: 1px solid #dee2e6;
    color: #6c757d;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

.history-btn:hover {
    background: #f8f9fa;
    color: #495057;
    border-color: #adb5bd;
}

/* Keyboard shortcuts removed */

/* History Modal */
.history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.history-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.history-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.history-modal-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.25rem;
}

.history-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.history-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.history-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.history-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    border-color: #2563eb;
    background: #f8fafc;
}

.history-item-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-source,
.history-target {
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.5;
}

.history-arrow {
    color: #6b7280;
    font-weight: bold;
}

.history-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #6b7280;
}

.history-time {
    font-style: italic;
}

.history-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.clear-history-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-history-btn:hover {
    background: #dc2626;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile optimizations for enhanced features */
@media (max-width: 768px) {


    .history-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .history-item-content {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        text-align: center;
    }

    .history-arrow {
        transform: rotate(90deg);
    }

    .history-btn {
        margin-left: 0;
        margin-top: 1rem;
        width: 100%;
        justify-content: center;
    }

    .translate-button-container {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
}

/* Features Section */
.features-section {
    padding: 4rem 0;
    background: #f8f9fa;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-size: 2.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature-card {
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: #e3f2fd;
    border-radius: 50%;
    margin-bottom: 1.5rem;
    color: #1976d2;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.feature-description {
    color: #6c757d;
    line-height: 1.6;
}

/* How It Works Section */
.how-it-works-section {
    padding: 4rem 0;
    background: #ffffff;
}

.steps-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-top: 3rem;
}

.step {
    flex: 1;
    text-align: center;
    position: relative;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 30px;
    right: -1rem;
    width: 2rem;
    height: 2px;
    background: #e9ecef;
    z-index: 1;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: #1976d2;
    color: #ffffff;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
}

.step-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.step-description {
    color: #6c757d;
    line-height: 1.6;
}

/* Languages Section */
.languages-section {
    padding: 4rem 0;
    background: #f8f9fa;
}

.languages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.language-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.language-item:hover {
    transform: translateY(-2px);
}

.language-flag {
    font-size: 1.5rem;
}

.language-name {
    font-weight: 500;
    color: #2c3e50;
}

/* FAQ Section */
.faq-section {
    padding: 4rem 0;
    background: #ffffff;
}

.faq-container {
    max-width: 800px;
    margin: 3rem auto 0;
}

.faq-item {
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 1rem;
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    cursor: pointer;
    transition: color 0.3s ease;
}

.faq-question:hover {
    color: #1976d2;
}

.faq-question h3 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #2c3e50;
    margin: 0;
}

.faq-toggle {
    font-size: 1.5rem;
    font-weight: 300;
    color: #6c757d;
    transition: transform 0.3s ease;
}

.faq-item.active .faq-toggle {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 200px;
}

.faq-answer p {
    padding-bottom: 1.5rem;
    color: #6c757d;
    line-height: 1.6;
    margin: 0;
}

/* Responsive Design for New Sections */
@media (max-width: 768px) {
    .section-title {
        font-size: 1.75rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .steps-container {
        flex-direction: column;
        gap: 3rem;
    }

    .step:not(:last-child)::after {
        display: none;
    }

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

    .language-item {
        padding: 1rem;
    }

    .faq-question h3 {
        font-size: 1rem;
    }
}