* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #e0e0e0;
    background: #1a1a1a;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: #f0f0f0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-text {
    flex: 1;
    text-align: center;
}

.logout-btn {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: auto;
}

.logout-btn:hover {
    background: #c82333;
    border-color: #c82333;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 300;
}

header p {
    font-size: 1.2rem;
    opacity: 0.7;
}

.translator {
    background: #2a2a2a;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    flex-grow: 1;
    border: 1px solid #404040;
}

.language-selector {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.language-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.language-option input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #666;
    margin: 0;
}

.language-option label {
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    color: #ccc;
}

.translation-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

.input-section, .output-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

label {
    font-weight: 500;
    color: #ccc;
    font-size: 0.95rem;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #555;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.3s ease;
    font-family: inherit;
    background: #333;
    color: #e0e0e0;
}

textarea:focus {
    outline: none;
    border-color: #777;
}

textarea#output-text {
    background-color: #2f2f2f;
    color: #e0e0e0;
}

textarea::placeholder {
    color: #888;
}

.button-section {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 90px;
}

#translate-btn {
    background: #444;
    color: #fff;
    border: 1px solid #666;
}

#translate-btn:hover:not(:disabled) {
    background: #555;
    border-color: #777;
}

#translate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#interpret-btn {
    background: #555;
    color: #fff;
    border: 1px solid #777;
}

#interpret-btn:hover:not(:disabled) {
    background: #666;
    border-color: #888;
}

#interpret-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#clear-btn {
    background: #333;
    color: #ccc;
    border: 1px solid #555;
}

#clear-btn:hover {
    background: #3a3a3a;
    border-color: #666;
}

#copy-btn {
    background: #333;
    color: #ccc;
    border: 1px solid #555;
    padding: 6px 12px;
    font-size: 0.85rem;
    min-width: auto;
}

#copy-btn:hover {
    background: #3a3a3a;
    border-color: #666;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}



.error-message {
    background: #2d1b1b;
    color: #ff6b6b;
    padding: 15px;
    border-radius: 6px;
    border-left: 3px solid #ff6b6b;
    margin-top: 20px;
}

footer {
    text-align: center;
    margin-top: 30px;
    color: #888;
    font-size: 0.85rem;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .translator {
        padding: 20px;
    }
    
    .language-selector {
        gap: 15px;
        justify-content: center;
    }
    
    .language-option {
        justify-content: center;
    }
    
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .button-section {
        flex-direction: column;
        align-items: center;
    }
    
    button {
        width: 100%;
        max-width: 280px;
    }

    .output-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    #copy-btn {
        align-self: flex-end;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header-text {
        text-align: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .language-selector {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .translator {
        padding: 15px;
    }
}

/* Loading Spinner Overlay */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.spinner-overlay.visible {
    visibility: visible;
    opacity: 1;
}

.spinner-large {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}