:root {
    --bg-color: #0f172a;
    --bg-gradient: radial-gradient(circle at top center, #1e293b 0%, #0f172a 100%);
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-hover: rgba(30, 41, 59, 0.9);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-glow: rgba(56, 189, 248, 0.2);
    --border-color: #334155;
    --border-hover: #475569;
    --input-focus: #1e293b;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-color);
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1.5rem;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    height: -webkit-fill-available;
    scroll-behavior: smooth;
}

.container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--accent-color);
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.02);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo i {
    width: 32px;
    height: 32px;
}

.logo h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    line-height: 1;
    background: linear-gradient(to right, #f8fafc, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-subtitle {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 0.25rem;
}

.mode-indicator {
    position: absolute;
    bottom: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--panel-bg);
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-color);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    z-index: 5;
}

.mode-indicator i {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

/* Main Layout */
.translator-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 1.5rem;
    width: 100%;
    position: relative;
}

.panel {
    flex: 1;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.panel:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    background: var(--panel-hover);
}

.panel:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow-lg);
    transform: translateY(-2px);
}

.panel-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.3);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-body {
    flex: 1;
    padding: 1.5rem;
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

.panel-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: rgba(15, 23, 42, 0.2);
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

.footer-left i {
    width: 14px;
    height: 14px;
}

/* Elements */
.lang-select {
    background: rgba(51, 65, 85, 0.5);
    color: var(--text-primary);
    border: 1px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
}

.lang-select:hover {
    background-color: var(--border-color);
    border-color: var(--border-hover);
}

.lang-select:focus {
    border-color: var(--accent-color);
}

.lang-select option {
    background-color: var(--bg-color);
    color: var(--text-primary);
    padding: 10px;
}

textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    resize: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    line-height: 1.5;
    outline: none;
    transition: var(--transition);
}

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

.output-display {
    width: 100%;
    height: 100%;
    font-size: 1.5rem;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.output-display.placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.output-display.error-text {
    color: #ef4444;
}

/* Buttons */
.icon-btn {
    background: rgba(51, 65, 85, 0.3);
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-btn:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.icon-btn:active {
    transform: translateY(0);
}

.icon-btn.success {
    color: #10b981;
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.swap-container {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.swap-btn {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    color: var(--accent-color);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.swap-btn:hover {
    border-color: var(--accent-color);
    transform: scale(1.1) rotate(180deg);
    background: var(--panel-hover);
    box-shadow: 0 0 15px var(--accent-glow);
}

.mobile-icon {
    display: none;
}

/* Status Badge */
.status-badge {
    padding: 0.4rem 1rem;
    background-color: rgba(56, 189, 248, 0.1);
    color: var(--accent-color);
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.status-badge.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.2);
}

.status-badge.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

/* Footer */
footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    padding-bottom: 1rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        max-width: 900px;
    }
    
    textarea, .output-display {
        font-size: 1.25rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
        align-items: flex-start;
        display: block; /* Better for mobile scrolling */
    }

    .container {
        gap: 1.5rem;
        padding-bottom: 2rem;
    }

    .logo h1 {
        font-size: 1.75rem;
    }

    .mode-indicator {
        position: static;
        transform: none;
        margin: 0.5rem auto 0;
        width: fit-content;
    }

    header {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .translator-container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .panel {
        width: 100%;
        border-radius: var(--radius-md); /* Slightly smaller radius for mobile */
    }

    .panel-body {
        min-height: 160px; /* More compact for small screens */
        padding: 1rem;
    }

    .swap-container {
        margin: 0;
        padding: 0.25rem 0;
    }

    .swap-btn {
        width: 44px;
        height: 44px;
        box-shadow: var(--shadow-sm);
    }

    .desktop-icon {
        display: none;
    }

    .mobile-icon {
        display: block;
    }

    /* Larger touch targets for mobile */
    .icon-btn, .lang-select {
        min-height: 44px; /* Standard touch target size */
        padding: 0.6rem 1rem;
    }

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

    .panel-footer {
        padding: 0.75rem 1rem;
    }
    
    textarea, .output-display {
        font-size: 1.15rem;
        line-height: 1.4;
    }

    .footer-left span {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.75rem;
    }

    .panel-header {
        flex-direction: row; /* Keep row for space efficiency */
        align-items: center;
        gap: 0.5rem;
    }

    .lang-select {
        flex: 1;
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }

    .panel-footer {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .footer-left {
        width: 100%;
    }

    #char-count, .status-badge {
        font-size: 0.75rem;
    }
}
